Friday, 2 September 2011

Postfix Smarthost Configuration

If you require a postfix setup which delivers e-mail using another mail server and authenticating by using an e-mail account on the other server, follow these steps:

1. Create a password file in /etc/postfix eg. /etc/postfix/smarthost which contains
otherserver.example.com username:password

2. Create the postfix hash file from the password file (needs to be done with any changes to the password file) using the command:
postmap /etc/postfix/smarthost

3. Modify the /etc/postfix/main.cf file by adding/changing the lines below:   
relayhost = [otherserver.example.com] #Add : to indicated port, example :2525 to use port 2525
smtp_sasl_auth_enable = yes 
smtp_sasl_password_maps = hash:/etc/postfix/smarthost 
smtp_sasl_security_options =   

4. Restart your postfix: 

/etc/init.d/postfix restart

If all goes well you should see the messages in your queue (if any) become less and go out via the smarthost, the /var/log/mail.log file should also give you an indication if your configuration is working correctly...

1 comment:

  1. Thank You. Works out of the box..

    ReplyDelete