Skip to content

SSMPT

Debian 7, 8, 9

# Installation
apt-get install ssmtp
#
# After installation, it should look like this
ls -l /usr/sbin/sendmail
lrwxrwxrwx 1 root root 5 Jul 15  2014 /usr/sbin/sendmail -> ssmtp

Configuration: /etc/ssmtp/ssmtp.conf

# on port 25
mailhub=mail.firma.com
# User
[email protected]
AuthPass=superpassword
# 
# with SSL
mailhub=mail.firma.com:465
UseTLS=Yes
UseSTARTTLS=Yes

Logs are written to Syslog:

May 30 08:54:07 vps-9513 sSMTP[30111]: Creating SSL connection to host
May 30 08:54:07 vps-9513 sSMTP[30111]: SSL connection using RSA_AES_128_CBC_SHA1
May 30 08:54:10 vps-9513 sSMTP[30111]: Sent mail for [email protected] (221 2.0.0 closing connection r10sm16495247wmd.9 - gsmtp) uid=33 username=www-data outbytes=667

Name substituted into MAIL FROM: /etc/ssmtp/revaliases

SSMTP does not use /etc/aliases and does not resolve recipient address aliases; it sends to the specified address. For example, logwatch sends through sendmail by default logwatch.

Use mail to forward local recipients to external addresses: /etc/mail.rc

# Multiple addresses can be specified for one name
alias root [email protected]
alias root [email protected]
#
alias postmaster [email protected]

Verification:

#
echo "test message body" | mail -v -s "subject test" [email protected]
# If the response is: mail not found
apt-get install mailutils

CentOS 4.8

# Download RPM
wget http://dl.fedoraproject.org/pub/epel/4/i386/ssmtp-2.61-15.el4.i386.rpm
# Install
rpm -ivh ssmtp-2.61-15.el4.i386.rpm
# Change MTA
alternatives --config mta
# Remove sendmail
yum erase sendmail
# Check what responds
sendmail -V
sSMTP 2.61 (Not sendmail at all)

Configuration: /etc/ssmtp/ssmtp.conf

CentOS 6.5

# Install
yum install ssmtp
# Change MTA
alternatives --config mta
# Remove postfix
yum erase postfix

CentOS 6.6

Needed to add:

rpm -ivh http://fedora.ip-connect.vn.ua/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm

Verification:

echo "test message body" | mail -v -s "subject test" [email protected]

FreeBSD

FreeBSD 10 /etc/mail/mailer.conf

sendmail        /usr/local/sbin/ssmtp
send-mail       /usr/local/sbin/ssmtp
mailq           /usr/local/sbin/ssmtp
newaliases      /usr/local/sbin/ssmtp
hoststat        /usr/bin/true
purgestat       /usr/bin/true

Configuration: /usr/local/etc/ssmtp/ssmtp.conf

root=
mailhub=mail # your mail-server DNS
rewriteDomain=domain.com # your mail domain
hostname=v12.domain.local # this host name

Ukr.net

Enable access: read here

mailhub=smtp.ukr.net:465
[email protected]
AuthPass=PASSWORD
FromLineOverride=YES
UseTLS=Yes

Yandex

# /etc/ssmtp/ssmtp.conf
#
[email protected]
AuthPass=PASSWORD
#
mailhub=smtp.yandex.ru:587
UseTLS=YES
UseSTARTTLS=YES
#
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt

Gmail

mailhub=smtp.gmail.com:587
#
[email protected]
AuthPass=password
AuthMethod=LOGIN
#
FromLineOverride=YES
UseTLS=Yes
UseSTARTTLS=Yes

An error appears while testing sending:

[<-] 534 5.7.14  https://support.google.com/mail/answer/78754 x64sm2348353wrb.10 - gsmtp
send-mail: Authorization failed (534 5.7.14  https://support.google.com/mail/answer/78754 x64sm2348353wrb.10 - gsmtp)
Can't send mail: sendmail process failed with error code 1

Solution: 1) Sign in to Google Account in a browser. 2) Open https://accounts.google.com/b/0/DisplayUnlockCaptcha. 3) Enable it. 4) Send a test email from the server.

ERROR: SSL not working: unknown protocol (0)

On: centos 6.8 Solution: update openssl