Feb 13, 2017

f Comment

[SOLVED] Set Up Postfix With A Third-Party SMTP Server in SECONDS!

AmazonSuppose you use a cloud server like Amazon EC2 or Digital Ocean. If you want to set up Postfix to send out text emails or HTML emails via a third-party SMTP server, follow https://www.linode.com/docs/email/postfix/postfix-smtp-debian7 to install postfix and use it as a reference for the remainder of this article.

Then use my tutorial as a guide. I'll get right down to the most important parts of the setup process.

The third-party SMTP service I use is Elastic Email. Highly recommended.

Assumptions

Let's make some assumptions. Suppose you want to send emails from michael@chtoen.com to your website's newsletter's subscribers. Suppose the third-party SMTP server is smtp.elasticemail.com, port 2525.

Suppose the third-party SMTP server gave you a user name and password so that smtp.elasticemail.com can authenticate you as a verified sender.

Edit configurations

Open your Postfix configuration file, which is usually /etc/postfix/main.cf, and do the following:

Add the following line in the very beginning:

myhostname = chtoen.com

This setting is needed for Received-SPF's value to go from "none" to "pass" when you read the detailed headers of the email. With the setting, the SPF email header reads:

Received-SPF: pass (domain of chtoen.com designates 67.1.2.3 as permitted sender)

Without the setting, the SPF email header reads:

Received-SPF: none (domain of your.localdomain does not designate permitted sender hosts)

Make sure to set the following settings correctly:

relayhost = [smtp.elasticemail.com]:2525
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

If you don't know how to set any of them, consult the reference.

Run the following command to restart Postfix service:

sudo service postfix restart

You can use http://www.mail-tester.com/ to test the acceptability of emails sent by your own server via the third-party SMTP server.

That's it! Questions?
Please leave a comment here!
One Minute Information - by Michael Wen
ADVERTISING WITH US - Direct your advertising requests to Michael