By patfc59d06f
Hi, I have a website running on a droplet on DO (ubuntu). I’d like to implement virtual hosts, and setup another website on the same droplet.
So i wondered how can i set the SMTP credentials for this new website. Currently, i have my sendgrid credentials in /etc/postfix/sasl_passwd , and configured in /etc/postfix/main.cf
But those are for just one account. Is there a way that i can use another SMTP account for the second website? Or create a sub-account so the transactional emails can go through for the 2nd website?
Any help is appreciated, thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You can configure Postfix for multiple domains by using a hash file, which contains the list of domains used for local delivery. Look at the file /etc/postfix/main.cf for this section:
# Define the domain list as hash file or as list in the config file.
virtual_alias_domains = hash:/etc/postfix/virtual_domains
Then, create the file you specified in the main.cf, and add your domains:
example.com #domain
example2.com #domain
Test1.com #domain
Save the file, then run this command to create your hash db file:
postmap /etc/postfix/virtual_domains
Finally, reload Postfix:
/etc/init.d/postfix reload
The Postfix documentation may help you further if you want to make a more complex setup: http://www.postfix.org/VIRTUAL_README.html
Can you provide a bit more information on your use-case? It is possible to use domain mapping to handle email for multiple domains in postfix and this guide will help you in setting that up. SASL will then let you configure authentication.
What I am confused by is your reference to SendGrid. Are you relaying emails from postfix via sendgrid rather than sending them directly? Is this being used to send emails from a web site or script or do you have users who will connect via SMTP directly? I think by better understanding your intended use case I can help you to find a good solution.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.