<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Good Day,<o:p></o:p></p><p class=MsoNormal> This very novice would appreciate some help.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText> My situation:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I have a Raspberry Pi 4 computer running the Raspberry Operating System (Raspbian GNU/Linux [buster], Version ID=10) at my home. I need it to send me an email notification when certain functions are performed.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>To this end, I have configured the mail system called msmtp on the Raspberry Pi 4 computer. I can send email to my myself via my email account manually and interactively using msmtp on the Raspberry Pi 4 computer, with the password not encrypted on the Raspberry Pi 4 computer.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I have gpg version 2.2.12-1+rpi1+deb10u1 installed on this Raspberry Pi 4 Computer.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Problem:<o:p></o:p></p><p class=MsoPlainText>Following good security policies, I encrypted my email account password using gpg. My encrypted password is stored in a file (/home/pi/.msmtp-2d-ionos.gpg) on the Raspberry Pi4 computer.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I successfully created my gpg key. I was able to successfully run the following command: <o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>gpg --encrypt -o .msmtp-2d.ionos.gpg -r 2d@daviddonnelly.com -<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>The password provided was encrypted with no problems and the associated file was created.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>However, when I run the following command, it initially works. Meaning the associated password is decrypted and the e-mail is sent:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>msmtp -t < message.txt<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>But after a few minutes, when I retest the command:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>msmtp -t < message.txt<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I get the following error:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>gpg: decryption failed: No secret key<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>When I run the following command:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>gpg --encrypt -o .msmtp-2d.ionos.gpg -r 2d@daviddonnelly.com -<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I am asked for my passphrase, once entered the file is decrypted and the contents displayed. I then rerun the command:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>msmtp -t < message.txt<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>and the associated e-mail is sent.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I wait a few minutes and the error repeats itself.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Is there some sort of timeout associated with gpg? Or my implementation is wrong…or ?<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Also, I have noticed, at times, gpg will not accept the passphrase until I reboot the Raspberry pi 4.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Your help in this matter is greatly appreciated,<o:p></o:p></p><p class=MsoPlainText>Dave<o:p></o:p></p></div></body></html>