pcmanbob
Posts: 13753
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Client email to send emails from command line

Tue Aug 13, 2019 9:52 am

As long as you are not using any special characters in the email name or the password , your config file looks correct.

Try logging in to your gmail account from a browser to check the account credentials and to check there are no security messages from google , I have had them refuse to allow a pi to use an account until you ok it via their security check email.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
RDK
Posts: 455
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Client email to send emails from command line

Tue Aug 13, 2019 11:00 am

Sheer stupidity!!! When I created this new Gmail account, I mistyped the userid. A subtle error, an 'n' instead of a 'r' in the middle, so it was not obvious. Thus in my config file I had the wrong Gmail authorized user name. Seems to be working now... Thanks for your time....RDK

pcmanbob
Posts: 13753
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Client email to send emails from command line

Tue Aug 13, 2019 6:10 pm

The old sausage finger problem , makes you look a plonker every time :lol:

glad you got it working .
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Crafticus
Posts: 1
Joined: Fri Aug 16, 2019 7:22 am

Re: Client email to send emails from command line

Thu Aug 22, 2019 1:51 am

I'm also having trouble sending mail from the command line, and would really appreciate any help.

Running Pi4 with Raspbian Buster.

Code: Select all

$ uname -r
4.19.58-v71+

$ ssmtp -V
sSMTP 2.64 (Not sendmail at all)

$ cat /etc/ssmtp/ssmtp.conf
Debug=YES
root=<my.pi.email.account>@gmail.com
mailhub=smtp.gmail.com:587
RewriteDomain=gmail.com
hostname=localhost
FromLineOverride=YES
AuthUser=<my.pi.email.account>@gmail.com
AuthPass=<password>
UseSTARTTLS=YES
UseTLS=YES

/usr/sbin/ssmtp -v <name>@gmail.com < /home/pi/.bashrc
[<-] 220 smtp.gmail.com ESMTP y23sm31281846pfr.86 - gsmtp
[->] EHLO localhost
[<-] 250 SMTPUTF8
[->] STARTTLS
[<-] 220 2.0.0 Ready to start TLS
[->] EHLO localhost
[<-]
ssmtp:  (localhost)
My Pi gmail account password uses only lower case letters.
My Pi gmail account also has "Allow less secure apps: ON".

So that's it. It just sort of stops and prints the hostname. I've looked at every post I can find, and I'm stumped.

pcmanbob
Posts: 13753
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Client email to send emails from command line

Thu Aug 22, 2019 12:35 pm

Crafticus wrote:
Thu Aug 22, 2019 1:51 am
I'm also having trouble sending mail from the command line, and would really appreciate any help.

Running Pi4 with Raspbian Buster.
Hi

Not surprised it does not work ssmtp is no longer maintained and will not work with buster.

You now need to switch to msmtp to send mail from buster, there is a thread about it here.
https://www.raspberrypi.org/forums/view ... 8&t=244147
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Ernst
Posts: 1397
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Client email to send emails from command line

Thu Aug 22, 2019 1:35 pm

pcmanbob wrote:
Thu Aug 22, 2019 12:35 pm
Crafticus wrote:
Thu Aug 22, 2019 1:51 am
I'm also having trouble sending mail from the command line, and would really appreciate any help.

Running Pi4 with Raspbian Buster.
Hi

Not surprised it does not work ssmtp is no longer maintained and will does not work for gmail with buster

You now need to switch to msmtp to send mail from buster, there is a thread about it here.
https://www.raspberrypi.org/forums/view ... 8&t=244147
I am using ssmtp for cron with buster to send emails to my ISP, but I have been unable to get it to work with gmail.
For sending email from the cli I also use sendemail.

Code: Select all

sudo apt install sendemail libnet-ssleay-perl libio-socket-ssl-perl
The road to insanity is paved with static ip addresses

pcmanbob
Posts: 13753
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Client email to send emails from command line

Thu Aug 22, 2019 1:53 pm

Ernst wrote:
Thu Aug 22, 2019 1:35 pm

I am using ssmtp for cron with buster to send emails to my ISP, but I have been unable to get it to work with gmail.
if you look at the thread I linked , you will see the reason ssmtp does not work in buster is because under buster its trying to use the wrong encryption.

you need to replace ssmtp with msmtp, which will work with mail utils and mpack just as ssmtp did, you can then use it in cron as before.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Ernst
Posts: 1397
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Client email to send emails from command line

Thu Aug 22, 2019 2:07 pm

pcmanbob wrote:
Thu Aug 22, 2019 1:53 pm
Ernst wrote:
Thu Aug 22, 2019 1:35 pm

I am using ssmtp for cron with buster to send emails to my ISP, but I have been unable to get it to work with gmail.
if you look at the thread I linked , you will see the reason ssmtp does not work in buster is because under buster its trying to use the wrong encryption.

you need to replace ssmtp with msmtp, which will work with mail utils and mpack just as ssmtp did, you can then use it in cron as before.
Why ?

Code: Select all

[<-] 220 smtp.strato.de ESMTP RZmta (P11 -)
[->] EHLO raspi1.xxxxxx.xxxxxxxxxxx.de
[<-] 250 HELP
[->] STARTTLS
[<-] 220 Ready to start TLS
[->] EHLO raspi1.xxxxxx.xxxxxxxxxxx.de
[<-] 250 HELP
[->] AUTH LOGIN
[<-] 334 VXNlcm5hbWU6
[->] ZXJuc3RAYm9ra2Vsa2FtcC5kZQ==
[<-] 334 UGFzc3dvcmQ6
[<-] 235 2.7.0 OK Authenticated
[->] MAIL FROM:<[email protected]>
[<-] 250 2.1.0 Sender ok
[->] RCPT TO:<[email protected]>
[<-] 250 2.1.5 Recipient ok
[->] DATA
[<-] 354 3.0.0 Enter data for mail with id 606450v7ME3YqXb
[->] Received: by raspi1.xxxxxx.xxxxxxxxxxx.de (sSMTP sendmail emulation); Thu, 22 Aug 2019 15:03:27 +0100
[->] From: [email protected]
[->] Date: Thu, 22 Aug 2019 15:03:27 +0100
[->] asdasd
[->]
[->] .
[<-] 250 2.0.0 queued as 606450v7ME3YqXb
[->] QUIT
[<-] 221 2.0.0 closing connection
The road to insanity is paved with static ip addresses

pcmanbob
Posts: 13753
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Client email to send emails from command line

Thu Aug 22, 2019 2:17 pm

Why what ?

why does ssmpt use the wrong encryption under buster - I don't know

why is ssmpt no longer maintained - I guess be cause the maintainer has given up on it.

why use msmtp - because it does work when running on buster.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Ernst
Posts: 1397
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Client email to send emails from command line

Thu Aug 22, 2019 2:22 pm

pcmanbob wrote:
Thu Aug 22, 2019 2:17 pm
Why what ?

why does ssmpt use the wrong encryption under buster - I don't know

why is ssmpt no longer maintained - I guess be cause the maintainer has given up on it.

why use msmtp - because it does work when running on buster.
You told me I have to change to msmtp, I told you ssmtp works with my ISP using TLS.
So why do I have to change ?
The road to insanity is paved with static ip addresses

pcmanbob
Posts: 13753
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Client email to send emails from command line

Thu Aug 22, 2019 2:35 pm

Ernst wrote:
Thu Aug 22, 2019 2:22 pm
You told me I have to change to msmtp, I told you ssmtp works with my ISP using TLS.
So why do I have to change ?
if it works with your ISP email then that's great carry on using it.

but most people use gmail with ssmtp because there are lots of examples around on how to set it up on a pi, and that does not work .

sorry of any confusion.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Raspberry Pi OS”