Sample Header Ad - 728x90

Problem sending email using ssmtp

3 votes
2 answers
24887 views
I am attempting to setup so I can mail from Raspbian. When I attempt to send I get an error ssmtp: Cannot open smtp.gmail.com:587 (I also tried port:465) I have set "Access for less secure apps" on Google and can send/receive from the account on Thunderbird. I have installed ssmtp and configured /etc/ssmtp/ssmtp.conf to contain:- # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=xxxxxx.raspberry.pi@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 AuthUser=xxxxxx.raspberry.pi@gmail.com AuthPass=xxxxxxxxxxxxxx UseTLS=YES UseSTARTTLS=YES # Where will the mail seem to come from? rewriteDomain=gmail.com # The full hostname hostname=xxxxxx.raspberry.pi@gmail.com # 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 I have also configured /etc/ssmtp/revaliases to contain:- # sSMTP aliases # # Format: local_account:outgoing_address:mailhub # # Example: root:your_login@your.domain:mailhub.your.domain[:port] # where [:port] is an optional port number that defaults to 25. root:xxxxxx.raspberry.pi@gmail.com:smtp.gmail.com:587 Any suggestions? ---------- Edit The settings above based on https://wiki.archlinux.org/index.php/SSMTP I have done some further testing. 1. I selected a different SMTP server, which worked. (I do not want to use this, as it is only available when directly connected to my ISP.) 2. I tried setting an Application Specific password, and got the response"The setting you are looking for is not available for your account". (Presumably because this account does not have 2-factor authentication.) The gmail account I am trying to use was specifically created to send messages from the Raspberry Pi.
Asked by Milliways (1408 rep)
Apr 19, 2017, 07:41 AM
Last activity: Feb 11, 2022, 04:04 AM