2

Actually, I'm using a RaspberryPI 3b.
This is my /etc/ssmtp/ssmtp.conf:

root=gmail_user@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
hostname=raspi
FromLineOverride=YES
UseTLS=Yes
UseSTARTTLS=YES
AuthUser=gmail_user
AuthPass=PASSWD

This is my /etc/ssmtp/revaliases:

root:gmail_user@gmail.com:smtp.gmail.com:587
pi:gmail_user@gmail.com:smtp.gmail.com:587

Trying to send a mail:

root@raspberrypi:~# echo "hola" | ssmtp filter.srv@gmail.com -v
[<-] 220 smtp.gmail.com ESMTP x129sm89284054wmg.44 - gsmtp
[->] EHLO raspi
[<-] 250 SMTPUTF8
[->] STARTTLS
[<-] 220 2.0.0 Ready to start TLS
[->] EHLO raspi
[<-]
ssmtp:  (raspi)

hostname:

root@raspberrypi:~# hostname
raspberrypi

This is a ping to google and the DNS servers that I'm using:

root@raspberrypi:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=13.1 ms
^C
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 13.134/13.134/13.134/0.000 ms
root@raspberrypi:~# cat /etc/resolv.conf
# Generated by resolvconf
nameserver 8.8.8.8
nameserver 8.8.4.4

Also...

  • the GMail account have the thing to let less secure applications use the account.
  • to make sure the name and password where correct, used copy/paste to google Chrome (Using SSH, so that I can copy/paste things)
  • I have a Debian server which works well, also trying to copy/paste all the configuration and change the names from users and hostname, but it didn't work.

1 Answers1

2

I had the same problem (on PC-x64) after updating from 18.04 to 18.10. As some other unrelated things got broken, I updated to 19.04 and even zero-installed 19.10 (currently beta). Now everything else works, but SSMTP still broken. It may be needing an unlisted dependent SSL/TLS library or something like that.

Sadly, SSMTP is unmaintained and my searches turned up of no help too. After reading this question and the comments, I too gave up and installed MSMTP, which is supposed to be the actively maintained, basically following the instructions of that link:

Install (I am assuming you use a debian-related distro on your pi):

apt install msmtp msmtp-mta ca-certificates

Edit /etc/msmtprc and put that minimal config:

account default
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile /var/log/mail.log
host     smtp.gmail.com
port     587
from     username@gmail.com
user     username@gmail.com
password plain-text-password

On the Ubuntu 19.10 beta I saw that the package installer added a user/group "msmtp", and made the binary SGUID, so, for security and homogeneity regarding permissions of the config and log file, I did the same on my other systems:

adduser --system --home /var/lib/msmtp --no-create-home --group msmtp
chown root:msmtp /etc/msmtprc
chmod 640 /etc/msmtprc
chown syslog:msmtp /var/log/mail.log
chmod 660 /var/log/mail.log

Try that, it has more features than SSMTP (like multiple accounts and user-specific ~/.msmtprc config) but continues to be simple to configure.