Setup Qmail to Listen on port 587 for SMTP

From Brian Nelson Ramblings
Jump to: navigation, search

Setting up Qmail to Listen on Alternative Port 587

When setting my home connection to use port 25 to send my mail, I discovered that ATT does block port 25. This was making it hard to send my emails when on my home network. To fix this problme I have enabled port 587 to connect and send emails with.

Setup Qmail to use Port 587

You can probably do this in many different ways, but I used the following

cd /var/qmail/supervise/
cp -rf qmail-smptd/ qmail-smptd587/

Now we have to change this to listen to port 587

vim qmail-smptd587/run

Now find the following line

exec /usr/local/bin/softlimit -m 50000000 \
/usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \

and replace the smtp with 587

exec /usr/local/bin/softlimit -m 50000000 \
/usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 587 \

Now save that file and edit the log file, unless you want it to log to the same file as smtpd

vim qmail-smptd587/log/run

Now find the following line

exec setuidgid qmaill multilog t s100000 n20 /var/log/qmail/qmail-smtpd 2>&1

and replace the log location to

exec setuidgid qmaill multilog t s100000 n20 /var/log/qmail/qmail-smtpd587 2>&1

Set smptd587 to run in /service/

Now we just have to make it start up with the rest of the qmail scripts

cd /service/
ln -s /var/qmail/supervise/qmail-smtpd587

Now your all set, if you check the listening ports it should be listed

netstat -nplt

One last thing, if you have a firewall on your server, you will want to open port 587