Using remote mail server with postfix.

Setting up Postfix to use a remote mailserver

Edit /etc/postfix/main.cf and add the following

Set this to your email provider’s smtp server.

relayhost = yourisp.smtp.servername:25 #or your smtp port if different

smtpd_sasl_auth_enable = yes
smtpd_sasl_path = smtpd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_type = cyrus
smtp_sasl_auth_enable = yes

optional: necessary if email provider uses load balancing and

forwards emails to another smtp server

for delivery (ie: smtp.yahoo.com –> smtp.phx.1.yahoo.com)

smtp_cname_overrides_servername = no

optional: necessary if email provider

requires passwords sent in clear text

smtp_sasl_security_options = noanonymous

Add the following line to /etc/postfix/sasl_passwd

The server info must exactly match the value

for “relayhost” in /etc/postfix/main.cf

yourisp.smtp.servername:25 username:password

Generate a postfix lookup table from the previous file

postmap hash:/etc/postfix/sasl_passwd

Test the lookup table, if all is good then the following will return the specified username:password

postmap -q yourisp.smtp.servername:25 /etc/postfix/sasl_passwd

Remove the clear text password file

rm /etc/postfix/sasl_passwd

service postfix restart ( or /etc/init.d/postfix restart)