Your Proxy IP is:,

How to relay emails from Postfix to external SMTP server

In this example I am using Amazon SES as my smart host and all emails from postfix will be routed to Amazon

Let's begin:

Go to the postfix folder

cd /etc/postfix/

edit the file


At the very bottom enter the details

relayhost =

smtp_sasl_auth_enable = yes

smtp_sasl_security_options = noanonymous

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

smtp_use_tls = yes

smtp_tls_security_level = encrypt

smtp_tls_note_starttls_offer = yes

To change the domain name on the email, add the following line:

smtp_generic_maps = hash:/etc/postfix/generic

(We will have to modify the generic file too)

close the file and edit the sasl_passwd file

vi sasl_passwd

Add the line <SES USER>:<SES PASSWORD>

Close the file and run postmap

postmap hash:/etc/postfix/sasl_passwd

(Ignore the warning if any)

Change the file permission so that it can be read only by root

chmod 0400 sasl_passwd

Now modify the generic file

vi generic

Add the following line at the very bottom

@<local domain> @<public domain>

(change the local and public domain to your domain names)

save and run the postmap command

postmap generic

Restart postfix

service postfix restart

test by sending an email to your email address

echo test | mail -s "test message" <your email address>

check the mail log to confirm

tail -f /var/log/maillog

The email should arrive in your inbox with the following details:

From:<Email Address> via