I set up msmtp and s-nail to work with my gmail account. It works if the password is stored in plain text in .netrc, but does not work with .netrc.gpg:
echo 'Message body' | mailx -A mymail --subject='A subject' email@address 'name <email@address>'
Here is the error message:
email@address requires a password:
mail: A password is necessary for smtp authentication
/home/myuser/mail/dead.mbox 3/49
mail: ... message not sent
My .mailrc config:
account mymail {
# Localize options, forget them when changing the account
localopts yes
####
# this part does not work with netrc.gpg, only plain netrc:
wysh set netrc-lookup # even if I comment this line
netrc-pipe='gpg -qd ~/.netrc.gpg'
####
set mta=smtp://smtp.gmail.com:587 smtp-use-starttls # only works if I specify user:pass@ ahead of smtp.gmail
set from="name <email@address>"
}
I encrypted my .netrc file for email@address with:
gpg -e /home/myuser/.netrc
and running this in terminal
gpg -qd ~/.netrc.gpg
works, however, this asks for the secret.
This is my netrc file:
machine *.gmail.com login NAME password PASS