Configuring Postfix as a smarthost for authenticated mail relaying

This document describes 5 easy steps to setup your Postfix email server as a smarthost to relay on a given mail relay server for all outgoing mail.

1. Create a password maps file (it assigns username/passwords to specified mail servers). You can choose any name, let’s say it is /etc/postfix/relay_passwd. It’s content should be as follows:

relay.mail.com USERNAME:PASSWORD

Note: Replace USERNAME and PASSWORD with your mail relay username and PASSWORD.

2. Set proper permissions for that file:
# chown root:root /etc/postfix/relay_passwd
# chmod 600 /etc/postfix/relay_passwd

3. Create hash from maps file (remember to do it each time you change your maps file):
# postmap /etc/postfix/relay_passwd

4. Configure your /etc/postfix/main.cf:
relayhost = [relay.dnsexit.com]
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd
smtp_sasl_security_options =

Note: If your ISP blocks outgoing port 25. You can choose to use alternative SMTP ports by appending the port at the end:
relayhost = [relay.mail.com]:26

5. Reload or restart your postfix:
# /etc/init.d/postfix restart

Advertisements
This entry was posted in Distributed Computing, Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s