sSMTP is a program to deliver an email from a local computer to a configured mailhost (mailhub). It is not a mail server (like feature-rich mail server sendmail) and does not receive mail, expand aliases or manage a queue. One of its primary uses is for forwarding automated email (like system alerts) off your machine and to an external email address.
To install ssmtp, on DEB platforms, simply use the following command,
apt-get install ssmtp
apt-get install mailutils
On having the installation done, configure ssmtp using the settings in:
# Config file for sSMTP sendmail
# catch-all email address:
# Make this empty to disable rewriting.
# The place where the mail goes.
# MX records are consulted.
mailhub=smtp-server : smtp-server-port
# Where will the mail seem to come from?
# The full hostname, important,
# for VPS: it should be set in reverse DNS (see /etc/hosts)
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
UseTLS=YES # secured mailbox
AuthMethod=LOGIN # oAuth used, such as Gmail
echo "email body" | mail -s "email subject" receiver-email-address
Using ssmtp with PHP mail function
- in the php.ini file (/etc/php5/fpm/php.ini for Debian), search and set
sendmail_path = /usr/sbin/ssmtp -t
- Restart PHP web server
- To test mail function at shell command prompt
Using ssmtp with Wordpress
Please notice that SSMTP is no longer being developed. You might want to consider an alternative like MSMTP.