Wednesday, 7 November 2018

How to Install and Configure SSMTP in CentOS 7




SSMTP is a very simple and useful alternative of send mail and postfix. It provides the functionality to send mails via the standard user/agents and authentication with valid mail account to send mails. It is used to send mails on local and external domains.
SSMTP is available in EPEL repository (Extra Packages for Enterprise Linux) for CentOS 7.

This article describes How to install and configure SSMTP in CentOS7.

Step 1. Setup EPEL repository:  Follow tutorial How to install EPEL repository on CentOS7.

Step 2. SSMTP package installation: Run the following command to install the package:

[root@linuxcnf ~]# yum install ssmtp
Loaded plugins: fastestmirror
…………………………..

Installed:
  ssmtp.x86_64 0:2.64-14.el7

Complete!
[root@linuxcnf ~]#

Step 3. SSMTP Configuration: Now we will edit /etc/ssmtp/ssmtp.conf SSMTP configuration file and add the following lines:

[root@linuxcnf ~]# vi /etc/ssmtp/ssmtp.conf
root=postmaster
mailhub=mail.yourdomain.com:587
Hostname=serverhostname
FromLineOverride=YES
AuthUser=username@yourdomain.com
AuthPass=Password
UseSTARTTLS=YES

Step 4. Setup SSMTP as Default MTA: Rename the /use/sbin/sendmail script and create a symbolic link for SSMTP to sendmail with authentication:

[root@linuxcnf ~]# mv /usr/sbin/sendmail /usr/sbin/sendmail.ORIG
[root@linuxcnf ~]# ln -s /usr/sbin/ssmtp /usr/sbin/sendmail

Done!!! SSMTP installation and configuration is done. Now send a mail using any tool or application.

No comments:

Post a Comment