Postfix 2.x SMTP Mail Transfer Agent for Linux and Unix - Setup Guide

Important Points

  • This instructions will guide you through configuring Postfix to use AuthSMTP as an authenticated SMTP relay host for all your outbound email.
  • First you need to make sure the addresses have been authorised on your account in our Control Panel.
  • These instructions assume your server is already configured with Postfix, email can be received and you have external network access on one of the following ports - 23, 25, 26, 2525
  • Backup your Postfix configuration files before making any changes.
  • These instructions are only for the Postfix Mail Transfer Agent, they are based on Postfix version 2.3.3 installed on a Linux platform but will loosely apply to many other versions and platforms providing:
    • It is version 2.3 or greater.
    • The Cyrus SASL Library is installed.
    • CRAM-MD5 and DIGEST-MD5 support for Cyrus SASL.
  • For other email programs please see How To Setup AuthSMTP or contact us.

IMPORTANT: This is only intended as a basic guide to setting up AuthSMTP and assumes prior knowledge of Linux / Unix system administration, we CANNOT provide support on general usage of the operating system or on implementing more complex configurations - for additional support with the MTA please use the software vendors support channels.

Instructions

  • Login to your server on a command line as 'root' via SSH etc
  • Move to your Postfix configuration directory (typically /etc/postfix)
  • >cd /etc/postfix
  • Backup your configuration files:
    >mkdir /POSTFIX_BACKUP
    >cp /etc/postfix/* /POSTFIX_BACKUP
  • Open your Postfix configuration file (typically /etc/postfix/main.cf)using 'vi' or an alternative file editor and do the following:
  • Check the following options are not already enabled in any form
  • Add the following lines to the bottom of the file:
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_mechanism_filter =
    smtp_sasl_security_options =
    relayhost = mail.authsmtp.com
  • The above configuration use's the default 'plain' SASL authentication mechanism but you have the option of PLAIN, LOGIN, CRAM-MD5 and DIGEST-MD5.
  • This next step is optional - the default SMTP port is 25 but some ISPs block this port so if you wish to use one of the alternative ports (23, 26, 2525) please add ':' and the alternative port to the end of the 'relayhost' line, so it should read as follows:
    relayhost = mail.authsmtp.com:2525
  • If you wish to send your messages using TLS/SSL you will need to also add the two following lines:
    smtp_tls_security_level = encrypt
    smtp_tls_mandatory_ciphers = high
  • IMPORTANT: If you do wish to send your messages using SSL you will also need to login to the Control Panel and enable SSL on your account.
  • Save and close the file.
  • Open your SASL password file (typically /etc/postfix/sasl_passwd)using 'vi' or an alternative file editor and add the following line replacing 'username' and 'password' with your AuthSMTP username and password:
    mail.authsmtp.com username:password
    
  • Save and close the file, then run the following command on your SASL password file:
    >postmap hash:/etc/postfix/sasl_passwd
  • Once you have made the changes you will need to restart Postfix for the changes to take effect:
    >/etc/rc.d/init.d/postfix restart
  • The setup is now complete, please try sending a test message to ensure everything works okay, for trouble shooting you can:
    • View sent messages and errors logged on your account by logging into the Control Panel .
    • View sent messages and errors in your server log, typically Postfix will log to:
      /var/log/maillog

Are you using Postfix on an Amazon EC2 instance?

Please see - How do I change the hostname and from address on my Amazon EC2 instance when using AuthSMTP?