Menu
SSMTP is a tiny simple utility which lets you relay your Linux system’s emails to Google Or Microsoft Office 365 accounts. Its pretty simple and straightforward utility which forwards your Linux system’s emails to reliable relay mail servers like Google or MSN and then email is forwarded to the destination addresses using those SMTP servers (smtp.gmail.com or smtp.office365.com).
One main point to understand here is that its not a full fledged mail server, its just a utility which forwards automated emails to an external email address. In this article, we will learn how to install and configure SSMTP to use Gmail and Office365 email accounts for email sending.
How SSMTP WorksBefore we go ahead with its installation and configuration process, lets understand how it works. Once it has been installed and configured on any Linux system, all emails from root, nobody or any other such applications will be forwarded to SSMTP. We can also configure our PHP, Python, Ruby applications to forward their emails to this utility, SSMTP uses the concept of Mailhub. Mailhub could be either Gmail SMTP server or Microsof Office365 SMTP server. As soon as it gets email, it forwards this email to the configured Mailhub and the email is delivered to the destination address using your specified Google/Office365 address.
Main Configurations. The system accepts any mail from the local network and forwards them with the ones sent by the local users to a central mail server: this is the mail gateway configuration. The RHCE 7 exam objective seems to be more geared towards the null-client configuration. This tutorial will explain how to put in place this.
Installing SSMTP on CentOS and UbuntuThe installation process for this utility is pretty simple, use following command to install it on RHEL based systems (RHEL, CentOS, Fedora). Sudo apt-get install ssmptAs soon as the installation is complete, you should be able to see a directory “/etc/ssmtp” on your system. All configuration files will be located in this directory. Let’s go ahead and configure SSMTP to use Gmail and Office365 address. Configuring Linux System to use SSMTP instead of Sendmail / PostfixBy default, Linux system uses Sendmail or Postfix (depending on which one is installed) to relay emails to the outside world.
But once we have installed SSMTP and want to use it for external relay, we need to configure our Linu system to use SSMTP by default. First of all make sure to stop sendmail or postfix services. Echo 'Testing' mail -s 'Test Email'It should deliver fine to your mention address, you can view /var/log/maillog file if email delivery is unsuccessful. ConclusionThis is a very useful utility, but it comes with many limitations. You can not use it as a complete mail server. It does not offer anything for receiving emails. It is just a tool to send out emails to external mail servers.
It is useful in many situations, specially when you want to avoid your system IP getting blacklisted due to email volume, or you don’t want to rely on your system for email deliver, rather want to use Gmail or Microsoft addresses/email servers for stable email delivery.