Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Best simple mail server/MTA for a web server?
2 points by nitrogen on July 2, 2011 | hide | past | favorite | 3 comments
What's the best mail server to run on a Linux web server for local delivery and delivery of e-mail generated by scripts? I found this old Ask HN (http://news.ycombinator.com/item?id=240713), but the responses were less than helpful.

I was recently bitten by a supposedly-simple Exim configuration that hasn't been changed in years. My VPS host recently made some datacenter changes, but failed to mention the requirement to change the name servers in /etc/resolv.conf. Since Exim couldn't deliver mail in the face of total DNS failure, and the web server continued to function, I didn't find out about the problem for quite a while. Exim was intended to be using an external SMTP server strictly as a relay for external mail, but instead was sending all mail, including local mail to root and postmaster, through the external server.

The result? Messages from my sites' contact forms (and the resulting delivery failure messages) were discarded rather than winding up in /var/spool/mail/. How did I find out? Google Analytics was showing hits to my contact forms, but I wasn't getting any e-mail.

I've fixed the DNS problem for now, but I don't want to keep using this fail-deadly setup. All I need is something that will forward mail from PHP and Ruby scripts to an external SMTP server, and deliver mail for local users into /var/spool/mail/ or similar. I don't need to receive SMTP, I don't need any custom routing, etc. I don't want to have to manage a full-blown e-mail server. Is there nothing simpler than Postfix, Exim, and Qmail?



I'll use postfix for that case.

For yet another point of view, how about using external SMTP server directly? You are sending messages as follows:

  app -> local MTA -> /var/spool/mail <- users read mails
but this is easier to setup:

  app -> gmail's SMTP server -> users


Well I like postfix and it is fairly easy to setup, from what I have heard exim is as well. With that said you did not have a exim failure, you had a dns failure that broke the delivery of mail because exim could not map host names to ip addresses.

The best way to fix that is with a monitoring setup to check that dns is working. use something like monit or nagios(much heavier) to do a local dns look up on the server box every so often, once every 5 minutes, and get an alert form a different box that does the checking. Another way is to setup a cron job that send you email and filter to a folder put a time stamp in the subject and look at it every so often to see new stuff is there, run job once an hour and filter into a folder


If you have an external SMTP server via which you can relay all outgoing mails, just install msmtp: http://msmtp.sourceforge.net/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: