Sendmail vs SMTP

dwaynemac picture dwaynemac · Aug 25, 2009 · Viewed 20.9k times · Source

A rails application in production should use smtp or sendmail to send mails?

Answer

Mei picture Mei · Aug 25, 2009

SMTP is the protocol that is used by nearly all Internet hosts to send mail. This protocol is spoken by sendmail. Sendmail determines where to send your message and how.

Some mail programs (most, today) will connect directly to a mail server and speak SMTP to it. However, the "traditional" method - and arguable the better method - is to let sendmail do it.

There are two reasons for this: 1) nearly every program in UNIX that does what sendmail does is designed to be a drop-in replacement (this includes Postfix and Exim for instance); and 2) sendmail or its replacement was designed to handle mail and nothing else - by using sendmail you don't have to design a SMTP client.

The Mutt email client for UNIX is one email client that still refuses to talk SMTP directly to a mail server; a good (technical) description is on the wiki.

If you have a choice (on UNIX anyway) of talking SMTP directly or using sendmail, use sendmail - especially on servers.