Question

How do I install sendmail to send emails from a external SMTP server on CentOS 7?

Id like to configure my server the ability to send thru SMTP (not recieve) emails thru my external SMTP server on CentOS for wordpress and general logging.

How can I do this?


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 @riahc4

May I recommend that you don’t use Sendmail, but use something like Postfix, which has a much better security track record? It’s a drop-in-replacement for Sendmail.

I’m not sure if CentOS comes with the wizard, like Ubuntu does, but run the installation:

sudo yum install postfix

Then have a look at the Ubuntu tutorial, but ignore the two first sudo apt ... commands and skip Step 3: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04