top image
home  /  pages  /  tech tips  /  contact about

How to use a MailAvenger smart host on Mac OS X (Postfix)

Problem

You want to configure Postfix on Mac OS X (Snow Leopard in this case) to use a smart host. This is hard enough in itself, but once you think you're all set, you get "501 base64 decoding error" from MailAvenger.

Keywords

Postfix, MailAvenger, SASL, DIGEST-MD5, CRAM-MD5, TLS, SSL, Mac, Snow Leopard, Mac OS X 10.6.

Solution

There are various howtos that explain how to configure Postfix on Mac OS X to use a smart host. More precisely, it suggests you do:

$ sudo postconf -e relayhost=your.isps.mailserver \
                 smtp_use_tls=yes \
                 smtp_sasl_auth_enable=yes \
                 smtp_sasl_password_maps=hash:/etc/postfix/smtp_auth \
                 smtp_sasl_security_options=noanonymous \
                 tls_random_source=dev:/dev/urandom
$ sudo sh -c 'echo "your.isps.mailserver username:password" >> /etc/postfix/smtp_auth'
$ sudo chown root:wheel /etc/postfix/smtp_auth
$ sudo chmod 600 /etc/postfix/smtp_auth
$ sudo postmap hash:/etc/postfix/smtp_auth

I also did:

$ sudo postconf -e myhostname=machine.domain.name
$ sudo postconf -e mydomain=domain.name

However, in my case, the upstream mailserver runs MailAvenger and throws "501 base64 decoding error" messages, for some reason.

I solved this by forcing Postfix to use cram-md5 rather than digest-md5:

$ sudo postconf -e smtp_sasl_mechanism_filter=cram-md5

To run postfix, you need to modify /System/Library/LaunchDaemons/org.postfix.master.plist by deleting or commenting out the <key>Disabled</key> line and by commenting both the <string>-e</string> and <string>60</string> line that come after <string>master</string>. (The "-e 60" arguments cause the postfix master to exit after 60 seconds; you see this in /var/log/mail.log when it reports: "master exit time has arrived".) After making those changes, unload, load, and start the daemon:

$ sudo launchctl stop org.postfix.master
$ sudo launchctl unload /System/Library/LaunchDaemons/org.postfix.master.plist
$ sudo launchctl load /System/Library/LaunchDaemons/org.postfix.master.plist
$ sudo launchctl start org.postfix.master

You should then have a running master process.

URL: http://thomer.com/howtos/postfix_smarthost_mailavenger.html
Copyright © 1994-2011 by Thomer M. Gil
Updated: 2009/10/14