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

  • What did you do to (try to) solve the problem? – gf_ Jul 8 '16 at 15:58
  • I tried settings UseTLS and StartTLS to no with all variations, but no luck. Your answer worked. – ForceMagic Jul 8 '16 at 16:02
1

Either

  • disable TLS and / or StartTLS in your ssmtp config

or

  • fix TLS and / or StartTLS on mail.mymailhost.com.
  • Disabled both of TLS and StartTLS settings. It works! Thanks! – ForceMagic Jul 8 '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! – gf_ Jul 8 '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 8 '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 8 '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. – gf_ Jul 8 '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/

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.