Question

set up smtp on Ubuntu 16.04 for use by local WordPress sites

I have a droplet running 2 WordPress sites, accessed via two different domain names, e.g. blog.site1.com and blog.site2.com. Both need smtp service to send occasional password reset emails, etc. What is the best approach to providing local-only smtp service for these sites. The “from” addresses need to be different for each. I installed mailutils, but I’m unclear what the ‘myhostname’ variable should be. Tried using a project gmail address in WordPress, but it fails to authenticate.


Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello there,

It is recommended to use ports 465 or 587 instead of insecure ports like 25 and also to use an SMTP plugin as well.

That way you will be able to specify an SMTP server with authentication which your emails would be going through. You could for example use Gmail’s SMTP settings. This would drastically increase the delivery rate of your emails as well compared to using plain PHP mail.

I’ve been using this plugin for a while now and it works very well: Easy WP SMTP

I’ll also recommend using a third-party mail provider like SendGrid to send your emails. You can also check this tutorial on: Why You May Not Want To Run Your Own Mail Server

https://www.digitalocean.com/community/tutorials/why-you-may-not-want-to-run-your-own-mail-server

Hope that this helps!

Hi @whgazetteer,

There are a couple of ways to go about this. The first one is to configure Postfix on your droplet only for sending emails. You can follow this article here to see how it should be done :

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04

There are some cons tho, you won’t be able to receive e-mails unless your MX record is pointing somewhere else.

The second way to go about this is to use a third-party provider to send out e-mails. There are a lot of free ones which I’ll recommend. Having said that this again means you won’t be able to receive e-mails.

The third option and the one I recommend is using a third-party provider where you can both host your e-mails and use as SMTP service. It’s better that way, as they’ll manage your e-mails, configurations, SPAM filters and so on. There are a lot of free ones and just a quick google search should show you more than enough providers from which you can choose.

Hi @whgazetteer,

There are a couple of ways to go about this. The first one is to configure Postfix on your droplet only for sending emails. You can follow this article here to see how it should be done :

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04

There are some cons tho, you won’t be able to receive e-mails unless your MX record is pointing somewhere else.

The second way to go about this is to use a third-party provider to send out e-mails. There are a lot of free ones which I’ll recommend. Having said that this again means you won’t be able to receive e-mails.

The third option and the one I recommend is using a third-party provider where you can both host your e-mails and use as SMTP service. It’s better that way, as they’ll manage your e-mails, configurations, SPAM filters and so on. There are a lot of free ones and just a quick google search should show you more than enough providers from which you can choose.