[Disclaimer: sendmail is very complicated, and I lack some knowledge. The following solution might be even bad, although it works (tm). Please post comments if you know better ways, and I'll update the post]
I was looking for a quick n' simple SMTP solution for sending mails only. Requirements:
- A service that'll simply accept mails submitted locally and maintain a queue of mails-for-sending.
- It'll then send the mails by SMTP directly to the target servers (i.e. gmail.com).
- It should retry for a few days, if failed sending due to a local (dead connection) or remote problem.
- A bizarre one: it should be listening on a port other than 25, because another daemon uses it already. I know it's nonstandard and doesn't make sense, but should be possible..
I'm using CentOS 5, which comes by default with sendmail, so using the native service is an advantage.
After some digging in sendmail docs, I've found that all my requirements could be met by changing 3 lines, based on the default configuration (yum install sendmail-cf to get it):
- Added an MSA listener on port 'submission' (587):
- Removed the following line to prevent MTA on port 25:
- Added the following line to enable MSA mode:
FEATURE(`msp'," "FEATURE(`msp', `[127.0.0.1]', `MSA')
The final part: "Compiling" sendmail's configuration
m4 /etc/mail/submit.mc > /etc/mail/submit.cf
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
service sendmail restart