SSMTP no longer works - 'Invalid answer: 501 5.5.4 HELO / EHLO argument MYEMAILADDRESS@gmail.com is invalid, closing the connection.'

As the title / tags say, I am running sSMTP for Linux for the PHP server.

Whenever I try to send an email, I get these errors (which do not appear in PHP, only in sendmail / sudo service sendmail status or "sudo service php5-fpm status")

From / var / log / mail.log

Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Creating SSL connection to host Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Invalid response: 501 5.5.4 HELO/ELO argument MYEMAILADDRESS@gmail.com invalid, closing connection. v74sm9147441pfa.7- gsmtp (MYEMAILADDRESS@gmail.com) Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: SSL connection using (null) Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Cannot open smtp.gmail.com:587 

From / var / log / mail.err and mail.warn

 Mar 31 03:34:10 ip-172-31-22-38 sSMTP[1997]: Cannot open smtp.gmail.com:587 Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Invalid response: 501 5.5.4 HELO/EHLO argument MYEMAILADDRESS@gmail.com invalid, closing connection. v74sm9147441pfa.7 - gsmtp (MYEMAILADDRESS@gmail.com) Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Cannot open smtp.gmail.com:587 

My / etc / ssmtp / ssmtp.conf

 # # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=MYEMAILADDRESS@gmail.com # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=smtp.gmail.com:587 # Where will the mail seem to come from? #rewriteDomain= # The full hostname hostname=MYEMAILADDRESS@gmail.com AuthUser=MYEMAILADDRESS@gmail.com AuthPass=[removed] UseSTARTTLS=YES # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address FromLineOverride=YES 

My revaliases

 root:MYEMAILADDRESS@gmail.com:smtp.gmail.com:587 localusername:MYEMAILADDRESS@gmail.com:smtp.gmail.com:587 
+8
linux php email ssmtp
source share
2 answers

my ssmtp.conf is enabled hostname=xxx@gmail.com , I changed it to hostname=localhost and the problem was resolved.

+15
source share

After pulling my hair out for ages, I finally tied and copied the configuration from the Arch Linux wiki article for Gmail and SSMTP, and it ended up working! Be sure to do a triple check of your configurations guys!

 # The user that gets all the mails (UID < 1000, usually the admin) root=username@gmail.com # The mail server (where the mail is sent to), both port 465 or 587 should be acceptable # See also http://mail.google.com/support/bin/answer.py?answer=78799 mailhub=smtp.gmail.com:587 # The address where the mail appears to come from for user authentication. rewriteDomain=gmail.com # The full hostname hostname=localhost # Use SSL/TLS before starting negotiation UseTLS=Yes UseSTARTTLS=Yes # Username/Password AuthUser=username AuthPass=password # Email 'From header can override the default domain? FromLineOverride=yes 
+5
source share

All Articles