Sometimes you want to have your own SMTP Server locally. Your Mac may be mobile and your ISP does not accept your outgoing mails on some IP addresses.
Fortunately, every Mac OS X, "Server" or not, comes with an SMTP server. It used to be Sendmail before Mac OS X v10.3 (Panther as follows). From Panther postfix is bundled. It is not as easy to configure as BIND but it was faily easy. You may even use a utility called Postfix Enabler to do so.
Things are ALMOST the same with Mac OS X v10.4 ("Tiger" as follows). The big difference is how it is invoked. Instead of StartupItems, Tiger now uses what is called launch daemon to interface postfix.
In this document, you will learn how to enable postfix on Tiger. This document DOES NOT discuss how to manage it. Once up and running, postfix on Tiger is no different from an ordinarypostfix.
I, Dan Kogai, makes no guarantee whatsoever on this document. Use at your own risk.
You need a root priviledge for further tasks. To gain the root privileged, launch Terminal and issue the command below.
First you edit /etc/postfix/master.cf, a master configuration file for postfix. Very fortunately we already have a working copy so all you have to do is copy it.
mv /etc/postfix/master.cf /etc/postfix/master.cf.dist cp -p /etc/postfix/master.cf.defaultserver /etc/postfix/master.cf
cp -p /System/Library/LaunchDaemons/org.postfix.master.plist /System/Library/LaunchDaemons/org.postfix.master.plist.dist
and here it goes.
#diff -u /System/Library/LaunchDaemons/org.postfix.master.plist.dist /System//Library/LaunchDaemons/org.postfix.master.plist --- /System/Library/LaunchDaemons/org.postfix.master.plist.dist 2005-04-30 02:16:02.000000000 +0900 +++ /System//Library/LaunchDaemons/org.postfix.master.plist 2005-04-30 02:50:21.000000000 +0900 @@ -9,12 +9,12 @@ <key>ProgramArguments</key> <array> <string>master</string> - <string>-e</string> - <string>60</string> </array> <key>QueueDirectories</key> <array> <string>/var/spool/postfix/maildrop</string> </array> + <key>OnDemand</key> + <false/> </dict> </plist>
There are two items that are different. The command parameters (from master -e 60 to simply master) and whether it is always run (add OnDemand false). Here is the whole.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.postfix.master</string> <key>Program</key> <string>/usr/libexec/postfix/master</string> <key>ProgramArguments</key> <array> <string>master</string> </array> <key>QueueDirectories</key> <array> <string>/var/spool/postfix/maildrop</string> </array> <key>OnDemand</key> <false/> </dict> </plist>
Now let's use launchctl to start postfix
# launchctl stop org.postfix.master # launchctl unload org.postfix.master.plist # for sure # launchctl load org.postfix.master.plist # for sure # launchctl start org.postfix.master
If it works well, you can send mail via command below:
date | mail -s test firstname.lastname@example.org
log is at /var/log/mail.log so check it out in case of troubles.
Now all you need to do is add localhost for SMTP server in Mail.app and other use agents. Enjoy!