I'm sure someone here has configured ssmtp to send mail to their gmail/google account. While I think I've done everything correctly, a second set of eyes always seems to help. I've installed mailutils and ssmtp and edit the ssmtp.conf file in /etc/ssmtp. Here it is, with the secure info redacted by ****:
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
# root=postmaster
I tried the above both commented and uncommented. No change.
# 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=mail
root=****@gmail.com
mailhub=smtp.gmail.com:587
AuthUser=****@gmail.com
AuthPass=**** **** **** ****
UseTLS=YES
UseSTARTTLS=YES
# Where will the mail seem to come from?
#rewriteDomain=
# The full hostname
hostname=r710 # The hostname of my Dell r710 server
# 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
FromLineOverride=YES
The AuthPass given above is a 16-character application password created under my Google account. I've tried using both the hostname and "ssmtp" as the app name. But Google rejects a test message: echo "This is a test message" | ssmtp -v ****@gmail.com
with
I can see the "hello" (EHLO) acknowledges my hostname (r710) but then throws a 535 5.7.8 error. Google's error codes indicate Application-specific password required. For more information, go to Sign in with app passwords.
I'm guessing I haven't properly set the app name in my Google settings, or there's a config setting I've overlooked or entered incorrectly.
Thank you for the links. Unfortunately, I didn't learn anything new or helpful from them that I haven't already tried.
But...
Google isn't the only email provider. Before Google was even a search engine, I have been a customer of an ISP that began life as a BBS. These folks are wonderful, responsive, tech-savvy and very helpful. I figure I've been with them since about 1988. They host my "real" email address (as well as a web site I maintain) that I don't give out to anyone except my family, my bank and those I "need" to maintain contact with.
So, I decided to try them instead of Google. At first, I didn't think they supported SMTP and used only IMAP or POP3. But I was wrong. IMAP is used for receiving mail, but SMTP can be used for sending mail. Sadly, I didn't learn that until I'd spent much of the day watching baseball and mucking around with mutt and Evolution (which is installed on my machine).
On a side note, my login id is NOT the same as my email login, and I could find no way in Evolution to change that. Weird? But? Design choice? Regardless, I won't be using Evolution. Ever.
A bit of minor tweaking of my /etc/ssmtp/ssmtp.conf file to point to my ISP's email account, and off I went. Zounds! Success on the first try! But I check my other account's inbox (to where I'd send my test message) and: Nothing. A couple more tries. Then, all of a sudden I had multiple test messages (NOT dupes) in my inbox! Must have been some latency upline. All that was missing was a Subject: line. I can't find any instructions on how to accomplish this, but that's the least of my problems. Here's a sample test message I sent:
echo "Your IP address has changed to curl ipinfo.io/ip" | ssmtp -v -f [email protected][email protected] -- the -v is only to show verbosity, and won't be used as I implement this in my automation process.
Just a heads up. A couple of years ago, I ran into some roadblocks with using POP3/IMAP for GMail. I still use regular password login for Yahoo/Rogers.
I was forced to abandon my regular password-driven approach for the Port 995 SSL/TLS connection and implement OAuth2, which is my current method.
I can't remember what Google gave as the reason to force the switchover at the time. Thought I should share that with you.
(P.S. I haven't faced sufficient urgency to learn about SMTP to replace my interraction with my eMail service providers.)