Because the world of Spam email exists, sending emails direct from a server can sometimes be troublesome, especially if you end up in a situation where a large number are being sent. If you;re running some form of Web App, you obviously dont want your server being accused of Spamming, so a smarthost is the only option!
sendmail is either preinstalled, or easy to install on just about every Linux system I have come across, and setting this up is a breeze.
First you need to set the authorization credentials in /etc/mail/access
AuthInfo:smtp.example.com "U:yourUserName" "P:youPassword" "M:PLAIN"
Next we need to define the smarthost in /etc/mail/sendmail.mc
define('SMART_HOST', 'smtp.example.com')dnl FEATURE('access_db')dnl define('RELAY_MAILER_ARGS', 'TCP $h 587')dnl define('ESMTP_MAILER_ARGS', 'TCP $h 587')dnl
these files are all great human readable config files, but they need to be compiled:
$ cd /etc/mail $ m4 sendmail.mc > sendmail.cf $makemap hash access < access
Then we need need to restart to make the settings take effect:
$ service sendmail restart
And we’re done!