Enabling postfix (sendmail) on Mac OS X 10.5 Leopard
by William Jackson on 2009-06-21
I recently migrated off a web server running Ubuntu onto a server running Mac OS X 10.5 (client, not server). Everything has been working except sending email. On Ubuntu, when someone left a comment on my blog, the web server sent me an email. I hadnʼt received any email from the server since I moved to OS X. Today I found out why.
Mac OS X 10.5 comes with a mail-sending program called postfix
, but it is not turned on by default. Today, while diagnosing the problem, I found None on OS X.
If you just want to send all of your outgoing mail to some relay server, like the SMTP server of your Internet service provider, you usually need to have a host name for the computer that is sending the mail. This configuration is for a server that is not being used to receive mail.
Open Terminal and enter the following commands, each on a single line. After the first command you will be prompted for your password. (Oh, you need to be logged on as a user with administrative privileges.)
First, you want to set postfix
to run when your computer tries to send mail:
```% sudo launchctl unload /System/Library/LaunchDaemons/org.postfix.master.plist % sudo defaults write /System/Library/LaunchDaemons/org.postfix.master OnDemand -bool true % sudo launchctl load /System/Library/LaunchDaemons/org.postfix.master.plist
Next, you want to tell `postfix` what the host name of the computer is:
```% sudo postconf -e myhostname=<host-name-of-computer>
Next, tell postfix
what SMTP server to use to send email:
```% sudo postconf -e relayhost=<your-isps-smtp-server>
This works for me because my ISP does not require authentication to use their SMTP server. They only require that the traffic be coming from their network.
If the SMTP server you are using requires authentication, there are [a few extra steps](http://www.freelock.com/kb/postfix-relayhost):
```% sudo echo <you-isps-smtp-server> <username>:<password> >> /etc/postfix/sasl_passwd
% sudo postconf -e smtp_sasl_auth_enable=yes
% sudo postconf -e smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
At this point, if postfix
tries to send email to someone@<host-name-of-computer>
, the email will be delivered locally. If your email for this host name is handled by some other server, tell postfix
that this is not the final destination for email sent to that host name:
```% sudo postconf -e mydestination=localhost
I used the following specifically for my environment:
```% sudo postconf -e myhostname=subtlecoolness.com
% sudo postconf -e relayhost=smtp-server.austin.rr.com
There! You should now be running postfix
and your web server will send emails (again)!