MTA: Mail server
Jump to navigation
Jump to search
Overview
- Do not confuse the different parts of an entire mail system. The MTA (Mail Transfert Agent) is responsible for the delivery of messages across the network, whereas the MDA (Mail Delivery Agent) deliver finally the email to the user's mailbox. On some systems, the MTA and MDA are one and the same. But most software packages act as either MDA or MTA.
- Mail servers can be very tricky about the DNS / reverse DNS configuration. In particular your mail server should have a reverse DNS configured. For more information see the wiki page about Hostnames, Domains.
Installing Qmail on OS X 10.4
- WARNING: Qmail is not fully open-source, and has been unmaintained for years. It is recommended to use Postfix instead.
- Excellent Mac OS X resource for Qmail.
- Issue the following commands (the following tutorial is adapted from Life with Qmail, with some OS X specific notes):
- Download source packages, setup:
cd /usr/local/src curl http://www.qmail.org/netqmail-1.05.tar.gz -RO curl http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz -RO curl http://cr.yp.to/daemontools/daemontools-0.76.tar.gz -RO curl http://http.netdevice.com:9080/qmail/patch/panther.patch -RO mkdir /var/qmail
- Setup necessary system accounts:
nireport . /groups name gid niload group . <<EOF > qmail:*:2107: > nofiles:*:2108: > EOF nidump group . >/etc/group nireport . /users name uid niload passwd . <<EOF > alias:*:7790:2108::0:0::/var/qmail/alias:/bin/true > qmaild:*:7791:2108::0:0::/var/qmail:/bin/true > qmaill:*:7792:2108::0:0::/var/qmail:/bin/true > qmailp:*:7793:2108::0:0::/var/qmail:/bin/true > qmailq:*:7794:2107::0:0::/var/qmail:/bin/true > qmailr:*:7795:2107::0:0::/var/qmail:/bin/true > qmails:*:7796:2107::0:0::/var/qmail:/bin/true > EOF nidump passwd . >/etc/passwd
- Compile packages (applying patches):
gunzip -cd netqmail-1.05.tar.gz | tar -xf - cd netqmail-1.05 ./collate.sh cd netqmail-1.05 patch </usr/local/src/panther.patch make setup check ./config cd ../.. gunzip -cd ucspi-tcp-0.88.tar.gz |tar -xf - cd ucspi-tcp-0.88 make setup check cd .. mkdir -p /package mv daemontools-0.76.tar.gz /package chmod 1755 /package cd /package gunzip -cd daemontools-0.76.tar.gz |tar -xf - echo x >> /package/admin/daemontools-0.76/src/trypoll.c # This is a necessary patch for OS X 10.4 cd admin/daemontools-0.76 package/install
- Lots of configuration follows:
cat /etc/rc.local csh -cf '/command/svscanboot &' rm /etc/rc.local mkdir /Library/StartupItems/svscanboot cd /Library/StartupItems/svscanboot nano svscanboot
#!/bin/sh . /etc/rc.common StartService( ) { ConsoleMessage "Starting svscanboot" csh -cf '/command/svscanboot &' } RunService "\$1"
chmod 755 svscanboot nano StartupParameters.plist
{ Description = svscanboot; Provides = (svscanboot); Requires = (Network); OrderPreference = None; }
nano /var/qmail/rc
#!/bin/sh # Using stdout for logging # Using control/defaultdelivery from qmail-local to deliver messages by default exec env - PATH="/var/qmail/bin:$PATH" qmail-start "`cat /var/qmail/control/defaultdelivery`"
chmod 755 /var/qmail/rc echo ./Maildir/ >/var/qmail/control/defaultdelivery cd /var/qmail/bin curl http://lifewithqmail.org/qmailctl-script-dt70 -RO mv qmailctl-script-dt70 qmailctl chmod 755 qmailctl ln -s /var/qmail/bin/qmailctl /usr/bin cp -p /etc/periodic/daily/500.daily /etc/periodic/500.daily.0 sh -c "cat /etc/periodic/daily/500.daily |sed -e s/mailq/qmailctl\ queue/ >/etc/periodic/daily/500.daily" mkdir -p /var/qmail/supervise/qmail-send/log mkdir -p /var/qmail/supervise/qmail-smtpd/log nano /var/qmail/supervise/qmail-send/run
#!/bin/sh exec /var/qmail/rc
nano /var/qmail/supervise/qmail-send/log/run
#!/bin/sh exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail
nano /var/qmail/supervise/qmail-smtpd/run
#!/bin/sh QMAILDUID=`id -u qmaild` NOFILESGID=`id -g qmaild` MAXSMTPD=`cat /var/qmail/control/concurrencyincoming` LOCAL=`head -1 /var/qmail/control/me` if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in echo /var/qmail/supervise/qmail-smtpd/run exit 1 fi if [ ! -f /var/qmail/control/rcpthosts ]; then echo "No /var/qmail/control/rcpthosts!" echo "Refusing to start SMTP listener because it'll create an open relay" exit 1 fi exec /usr/local/bin/softlimit -m 2000000 /usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
echo 20 >/var/qmail/control/concurrencyincoming chmod 644 /var/qmail/control/concurrencyincoming nano /var/qmail/supervise/qmail-smtpd/log/run
#!/bin/sh exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail/smtpd
chmod 755 /var/qmail/supervise/qmail-send/run chmod 755 /var/qmail/supervise/qmail-send/log/run chmod 755 /var/qmail/supervise/qmail-smtpd/run chmod 755 /var/qmail/supervise/qmail-smtpd/log/run mkdir -p /var/log/qmail/smtpd chown qmaill /var/log/qmail /var/log/qmail/smtpd ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service echo '127.:allow,RELAYCLIENT=""' >>/etc/tcp.smtp qmailctl cdb mv /usr/sbin/sendmail /usr/sbin/sendmail.old chmod 0 /usr/sbin/sendmail.old ln -s /var/qmail/bin/sendmail /usr/sbin
- Last configuration step, involving the main account on the server:
echo elvanor >/var/qmail/alias/.qmail-root echo elvanor >/var/qmail/alias/.qmail-postmaster ln -s .qmail-postmaster /var/qmail/alias/.qmail-mailer-daemon chmod 644 /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-postmaster sudo -u elvanor -s cd /var/qmail/bin/maildirmake Maildir echo ./Maildir/ >.qmail /Developer/Tools/SetFile -a V Maildir # This is optional, it will make Maildir invisible in the Finder exit
- Reboot and test:
reboot qmailctl stat
Configuring Qmail
- If you need to relay through your ISP SMTP server, modify the file /var/qmail/control/smtproutes:
:smtp.free.fr
- To add a mailbox to a new user, run:
/var/qmail/bin/maildirmake Maildir
in the root directory of the user, and as the user to add the Maildir to.
- Setting up forwarding is pretty simple for an user. Just edit the .qmail file in the user's home directory:
./Maildir/ &elvanor@gmail.com
The first line specifies that a copy should go to the Maildir directory; the second forwards a copy to elvanor@gmail.com.