12

I updated sSMTP to version 2.61 and now when I try to us it I receive the following error:

ssmtp: Cannot open smtp.gmail.com:587

I can connect via telnet to their address, but sSMTP seems to get tripped up and Im not sure what changed after the update.

Here is the ssmtp.conf

root=XXXXX@gmail.com
mailhub=smtp.gmail.com:587
RewriteDomain=gmail.com
Hostname=localhost
UseTLS=YES
UseSTARTTLS=Yes
AuthUser=XXXXX
AuthPass=XXXXX
FromLineOverride=yes

Output when connecting via telnet:

[root@soupcan sbin]# telnet smtp.gmail.com 587
Trying 74.125.142.108...
Connected to smtp.gmail.com.
Escape character is '^]'.
220 mx.google.com ESMTP l7sm7330049igx.2 - gsmtp
quit
221 2.0.0 closing connection l7sm7330049igx.2 - gsmtp
Connection closed by foreign host.

And the output when I try to use sSMTP

[root@soupcan sbin]# /usr/sbin/ssmtp -v XXXXX@gmail.com < /home/user/Documents/Scripts/msg.txt
[<-] 220 mx.google.com ESMTP f5sm7367852igc.4 - gsmtp
[->] EHLO localhost
[<-] 250 CHUNKING
[->] STARTTLS
[<-] 220 2.0.0 Ready to start TLS
ssmtp: Cannot open smtp.gmail.com:587

EDIT Turning on debug logging I now see this, Im still digging:

SSL not working: certificate verify failed (20)

EDIT 2 This has been resolved by adding the following to my ssmtp.conf file

TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt

Found information from HERE and HERE

2

3 Answers 3

14

This has been resolved by adding the following to my ssmtp.conf file

TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt

Found information from HERE and HERE

1
  • It was failing for me until commented out #UseTLSCert=YES, TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt, UseTLS=YES, UseSTARTTLS=YES, FromLineOverride=YES, Hostname=/run hostname command to find out/, RewriteDomain=my.domain.ext, mailhub=smtp.office365.com:587 Dec 21, 2022 at 16:36
3

FYI -- For Ubuntu the .crt file is in a different place and should read:

TLS_CA-File=/etc/ssl/certs/ca-certificates.crt

Adding this enabled me to connect to my SMTP server via STARTTLS on port 587 with the settings:

mailhub=smtp.{myserver}.com:587
AuthUser={username}    
AuthPass={password}
UseSTARTTLS=YES 
UseTLS=NO
TLS_CA_File=/etc/ssl/certs/ca-certificates.crt

My mail server is configured to use STARTTLS and not SSL or TLS.

If I set UseTLS=YES, it fails. It has to be exclusively UseSTARTTLS=YES, not both. I don't know if other mail servers can do both at the same time, but mine does not.

1

Use the setup found here:

Simplest way to send one-line mail out via command line using gmail?

Excerpt:

root=rpi3abc@gmail
mailhub=smtp.gmail.com:465
FromLineOverride=YES
AuthUser=rpi3abc@gmail.com
AuthPass=testing123
UseTLS=YES

It is as simple as that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.