In this tutorial we’ll install the Debian Linux 9 (squeeze), Apache 2 with mpm-itk (to run each web as a isolated user),...
Installing sSMTP MTA (Mail Transfer Agent)
Ástþór IPsSMTP is an extremely simple MTA to get mail off the system to a mail hub. It contains no suid-binaries or other dangerous things – no mail spool to poke around in, and no daemons running in the background. Mail is simply forwarded to the configured mailhost. Extremely easy configuration.
This is ideal for web servers to avoid running MTA daemons like sendmail, Exim and Postfix which use up resources on the server.
1. Install sSMTP (Note: Any previously installed MTA will be removed)
apt-get install ssmtp
2. Configure the server (pico /etc/ssmtp/ssmtp.conf)
mailhub=mail.example.org
FromLineOverride=YES
Replace mail.example.org with the external mail server that you want to relay all mail to.
If you would like to relay through Google Mail servers, change these configuration values:
mailhub=smtp.gmail.com:587
UseSTARTTLS=Yes
AuthUser={username}
AuthPass={password}
FromLineOverride=YES
Replace {username} with your Gmail username and {password} with your Gmail password.
That’s all! sSMTP doesn’t run as service so there’s no restart required. sSMTP creates a link to /usr/sbin/sendmail which most programs use by default to send mail including PHP.