in reply to Re: getting SMTP capability working
in thread getting SMTP capability working

[re-ordered]

My installation came from following these instructions: https://www.howtoraspberry.com/2021/06/how-to-send-mail-from-a-raspberry-pi/

Thanks, Bod, I lurk on a lot of your threads, as we seem to be doing a lot of similar things. I thought that this was gonna work for me, but the folks at google are gonna rain on this parade:

To help keep your account secure, starting May 30, 2022, ​&#8203 +;Google will no longer support the use of third-party apps or devices + which ask you to sign in to your Google Account using only your user +name and password. Please note this deadline does not apply to Google Workspace or Google + Cloud Identity customers. The enforcement date for these customers w +ill be announced on the Workspace blog at a later date. For more information, please continue reading. Special Note on Apple Device Sign-Ins. Users who have not recently sig +ned into their Google Account using only username and password will b +e able to only make new sign in attempts using the Google account typ +e starting from February 28, 2022. Existing users may continue to sig +n into their Google Account using their username and password until M +ay 30, 2022.

I did follow through on the first part, so I'm not completely shut out:

sudo apt install bsd-mailx msmtp msmtp-mta

I ran:

msmtp --configure=tallharry84@gmail.com

Tried to generate a key properly:

gpg --full-generate-key

Followed by:

gpg --encrypt --output=msmtp-password.gpg --recipient=tallharry84@gmail.com

I had to wrestle with STDOUT here, and this is what I thought I did, and what I thought was right, but gpg was unable to decrypt it at runtime:

password newline CTRL-D $

I know the key is there, and I found the questions asked very exotic for what my idea of a "key" is.

$ gpg --list-secret-keys --keyid-format LONG gpg: checking the trustdb gpg: marginals needed: 3 completes needed: 1 trust model: pgp gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u /home/pi/.gnupg/pubring.kbx --------------------------- sec rsa3072/7D027B03F4826BFA 2022-05-09 [SC] D4E5BC39CE4FBA0C694BBF837D027B03F4826BFA uid [ultimate] harry (tja) <tallharry84@gmail.com> ssb rsa3072/017426C56FA76146 2022-05-09 [E]

I couldn't get the encryption to work on my first try. I think I'll delete this and give it a fresh try. I did, however get something going with this as .msmtprc :

#Set default values for all accounts. defaults auth on tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile /var/log/msmtp.log #Gmail settings account gmail host smtp.gmail.com port 587 from tallharry84gmail.com user tallharry84 #passwordeval gpg --decrypt /home/pi/msmtp-password.gpg password redacted #Set a default account account default : gmail

and, lo and behold, I received output with this command:

echo "BEEP BEEP" | mailx -s "Subject: This is a test!" tallharry84@gmail.com

As I look at STDOUT, I see that I still have work to do in terms of setting permissions:

$ echo "BEEP BEEP" | mailx -s "Subject: This is a test!" tallharry84@g +mail.com send-mail: cannot log to /var/log/msmtp.log: cannot open: Permission d +enied send-mail: log info was: host=smtp.gmail.com tls=on auth=on user=tallh +arry84 from=tallharry84@gmail.com recipients=tallharry84@gmail.com ma +ilsize=229 smtpstatus=250 smtpmsg='250 2.0.0 OK 1652063682 bh2-20020 +a170902a98200b0015e8d4eb2desm5726348plb.296 - gsmtp' exitcode=EX_OK $

What type of persistence would text written to /var/log/msmtp.log have? Does a person need to "wipe his own logs" on occasion? It looks like I'm gonna have to get several different mail programs with varying capabilities, but they all seem to log, and I might generate a ginormous amount of data while forgetting about the software entirely.

To be able to send mail from a Raspberry Pi, you need to install software to allow this. You could use sendmail but I understand this is difficult to configure.

I looked at several of the ones mentioned on this thread. I read up on alpine only to find that the treatment had a dependence on gmail just like this one. alpine-gmail-imap-in-linux

I have one Raspberry Pi that operates remotely which has email capability and sends me a weekly report. To do this I installed msmtp and used MIME::Lite to manipulate the emails.

I'd like to see your script that sends your mail, edited appropriately. One big question here at the end:

How does one send email without using the Google?