If you’re using fetchmail with Mutt usually you have to keep your password in a plaintext configuration file. msmtp has a passwordeval option, but fetchmail doesn’t. Aside from patching fetchmail itself you’re pretty much out of luck.

However, there is a clever trick where you can generate the configuration on the fly.

Keep your email password in a GPG encrypted file called .pswd.gpg. The following command will then generate a configuration file from your existing .fetchmailrc with the password field appended to it and feed it to fetchmail.

echo "pass '`gpg -dq .pswd.gpg`'" | cat .fetchmailrc - | fetchmail -v -f -

In your .muttrc the following binding will get new mail.

macro index,pager I "<shell-escape> echo \"pass '`gpg -dq .pswd.gpg`'\" | cat .fetchmailrc - | fetchmail -v -f - <enter>"

In Mutt the “I” key should now activate fetchmail.