Getting Postfix to send mail to a smarthost on Mountain Lion

The following is added to the bottom of /etc/postfix/

mydomain_fallback = localhost
message_size_limit = 10485760
biff = no
mynetworks =, [::1]/128
smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated permit
recipient_delimiter = +
smtpd_tls_ciphers = medium
inet_protocols = all
inet_interfaces = loopback-only
relayhost = [mailhost.domain.tld]:port
smtp_tls_loglevel = 1
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
# edit /etc/postfix/sasl_passwd, then execute postmap /etc/postfix/sasl_passwd
# <relay host>:<port> <username>:<password>
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# edit /etc/postfix/aliases, then execute newaliases
# root kent
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
# edit sender_canonical_maps, then eecute postmap /etc/postfix/sender_canonical; postfix reload
# <local user> <email from>
# kent [email protected]
sender_canonical_maps = hash:/etc/postfix/sender_canonical

The following commands are also listed in the file fragment above

Create the ssl mail host password file:

# sudo vi /etc/postfix/sasl_passwd
[mailhost.domain.tld]:port       [email protected]:password

Create the hashed ssl mail host password file:

$ sudo postmap /etc/postfix/sasl_passwd

Edit the aliases file:

# sudo vi /etc/postfix/aliases

Uncomment #root and add your local user name.

root: username

Create the hashed aliases file:

$ sudo postmap /etc/postfix/aliases

Create the local name to email username mapping:

$ sudo vi /etc/postfix/sender_canonical

Create the hashed name to email username mapping:

$ sudo postmap /etc/postfix/sender_canonical

Reload postfix with updated settings:

$ sudo postfix reload


Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk