1. fix the command search path
echo '
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/lib:/usr/local/include:/usr/bin:/bin:/usr/sbin:/sbin"
' >> $HOME/.bash_login
source $HOME/.bash_login
2. upgrade Postfix
sudo /usr/bin/ditto -rsrc -c -k /private/etc/postfix "/private/etc/postfixdir-$(/bin/date "+%Y-%m-%d-%H.%M.%S").zip"
cd ~/Desktop
curl -L -O http://mirrors.isc.org/pub/postfix/official/postfix-2.5.0.tar.gz
tar -xzf postfix-2.5.0.tar.gz
cd postfix-2.5.0
find /usr -type f \( -name "libcrypto*" -or -name "libssl*" \) -print0 2>/dev/null | xargs -0 ls -l
make makefiles \
CFLAGS='-arch $(/usr/bin/arch) -isysroot /Developer/SDKs/MacOSX10.4u.sdk' \
CCARGS="-DUSE_TLS" \
AUXLIBS="-lssl.0.9.7 -lcrypto.0.9.7"
make
sudo make upgrade
3. remove comments & empty lines from /private/etc/postfix/main.cf
sudo cp -p /private/etc/postfix/main.cf /private/etc/postfix/main.cf.orig
sudo sed -i "" -e 's/^[[:space:]]*#.*$//g' -e '/^[[:space:]]*$/d' /private/etc/postfix/main.cf
sudo nano /etc/postfix/main.cf
4. create a new Postfix launch daemon
sudo cp -p /System/Library/LaunchDaemons/org.postfix.master.plist /System/Library/LaunchDaemons/org.postfix.master.plist.orig
sudo nano /System/Library/LaunchDaemons/org.postfix.master.plist
<?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>Disabled</key>
<true/>
<key>Label</key>
<string>org.postfix.master</string>
<key>OnDemand</key>
<false/>
<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>
</dict>
</plist>
sudo launchctl load -w /System/Library/LaunchDaemons/org.postfix.master.plist 2>/dev/null
5. initialize the configuration
sudo mv /private/etc/postfix/master.cf /private/etc/postfix/master.cf.orig
sudo cp -p /private/etc/postfix/master.cf.defaultserver /private/etc/postfix/master.cf
sudo nano /private/etc/postfix/master.cf
sudo /usr/sbin/postfix reload
6. test
sudo ln -s "/Applications/Utilities/Network Utility.app/Contents/Resources/stroke" /bin/portscan
portscan localhost 25 25
/usr/sbin/postconf -d | grep 'mail_version ='
sudo postfix check
sudo postfix status
open -a Console
dscl . -read /Users/postfix
dscl . -read /Groups/postfix
dscl . -read /Groups/postdrop
dscl . list /Groups GroupMembership
otool -Lv /usr/libexec/postfix/smtp
otool -Lv /usr/libexec/postfix/smtpd
otool -Lv $(/usr/sbin/postconf -h daemon_directory)/smtpd
echo 'hello world' | mail -s 'test mail' $(/usr/bin/logname)@localhost
mail
your_logname="$(/usr/bin/logname)"
echo $your_logname
telnet localhost 25
<...>
helo localhost
<...>
ehlo localhost
<...>
mail from:<your_logname>@localhost
<...>
rcpt to:<your_lognam>@localhost
<...>
data
<...>
subject: something
my message
.
<...>
quit
mail
Further information:
-
Postfix Installation From Source Code-
Postfix Basic Configuration-
Postfix TLS Support-
Postfix on Mac OS X-
Troubleshooting Postfix-
DIYMacServer