[SOLVED] Sending email with msmtp and gpg

Hello everyone,

I installed and tested msmtp with success to send email both interactively and inside hotplug iface scripts. But, in order to have the password not readable and learning something new, I later installed gnupg and changed /etc/msmtprc with passwordeval gpg -qda /etc/msmtp-pass.gpg instead of password mypassword.

This time, while the CLI command echo -e "Subject: Message script\n\nEmail test" | msmtp myemail@example.com sends the email, this does not happen when executed inside the hotplug iface scripts.

The gpg --help command does not show any useful options/example, because it is incomplete (it says See the man page for a complete listing of all commands and options) and maybe almost outdated (rel. 1.4.23 vs 2.5.2).

Then tried with something like passwordeval gpg --no-tty -q -d /etc/msmtp-pass.gpg from msmtp pdf manual, and other options got from the man gpg pages (rel. 2.4) of my PC; moreover I was not able to find neither the gpg-agent package nor other options instead of gnupg, e.g. libsecret.

Last but not least, surfing the web and the forum did not helped: do you have any suggestion?

Thank you so much.

You must define the absolute path to the home directory (which defaults to ~/.gnupg).

passwordeval gpg --homedir /root/.gnupg -qda /etc/msmtp-pass.gpg
1 Like

Thank you so much, it works.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.