0

This is not a duplicate, I'm aware of the other question and it didn't help me.

Here's my ssmtp.conf:

root=info@mydomain.com
rewriteDomain=mydomain.com
hostname=myHostnameHere
FromLineOverride=YES
AuthUser=info@mydomain.com
AuthPass=myPasswordHere
AuthMethod=LOGIN
FromLineOverride=YES
mailhub=mail.mymailhost.com:465
UseSTARTTLS=YES
UseTLS=YES
TLS_CA_Dir=/usr/share/ca-certificates/mozilla/

I also tried telnet-ing to the server, and it worked, so the port and the host are correct (here it is redacted).

The problem is:

sSMTP[{PID}]: STARTTLS not working
sSMTP[{PID}]: Cannot open mail.mymailhost.com:465

Executed command: echo "This is a test" | mail -s "Test" mygmail@gmail.com

Response: mail: cannot send message: Process exited with a non-zero status

OS: debian

ForceMagic
  • 103
  • 1
  • 1
  • 4

2 Answers2

1

Either

  • disable TLS and / or StartTLS in your ssmtp config

or

  • fix TLS and / or StartTLS on mail.mymailhost.com.
gxx
  • 5,483
  • 2
  • 21
  • 42
  • Disabled both of TLS and StartTLS settings. It works! Thanks! – ForceMagic Jul 08 '16 at 16:00
  • @ForceMagic Think about if you really would like to go this route because of the security implications. Maybe it would be wise to investigate the second point I've raised. Good luck! – gxx Jul 08 '16 at 16:03
  • Oh, I don't own the mail host. So I can't really do anything about it. But anyways, thanks again :) – ForceMagic Jul 08 '16 at 16:04
  • also one more question... I want to know how to setup `info@mydomain.com` as the email sender instead of `root@myhostname.com` – ForceMagic Jul 08 '16 at 16:07
  • @ForceMagic No idea, sorry. I'm quite sure this is described in the docs. If you're unable to solve this on your own, post a new question. – gxx Jul 08 '16 at 16:10
1
  1. Log in with the gmail account you want to send mail as and switch on "Allow less secure apps". Here is the link https://myaccount.google.com/lesssecureapps?pli=1

  2. In my /etc/ssmtp/ssmtp.conf file I have the following. Notice UseTLSCert=YES and UseTLS=YES are commented out? I fiddled until it started working. I don't know why it works like this, but anyway this is what I did.

root=xxx@gmail.com
mailhub=smtp.gmail.com:587
Hostname=localhost
AuthUser=xxx@gmail.com
AuthPass=xxx
FromLineOverride=YES
RewriteDomain=gmail.com
#UseTLS=YES
#UseTLSCert=YES
UseSTARTTLS=YES
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
  1. I then used this page to know how to use ssmtp https://tecadmin.net/send-email-smtp-server-linux-command-line-ssmtp/
Sean Ryder
  • 11
  • 1