How to send a PGP-encrypted email from the CLI?
"W. D. Sadeep" <[email protected]> Sun, 19 Oct 2025 11:50:42 +0800
| Newsgroups | gmane.mail.mutt.user |
|---|---|
| Message-ID | <aPRgEicJoMGY1Hu9@wd> |
Hello,
I'm trying to send an encrypted email via a cron job. I can't get it to
work. For instance, I tried the following command, but it opens up mutt
for an interactive session:
echo "encrypted msg" | gpg -e --armor -f <pub_key> | \
mutt -s "PGP test" \
-e "my_hdr MIME-Version: 1.0" \
-e "my_hdr Content-Type: application/pgp-encrypted" \
-e "my_hdr Content-Disposition: inline" [email protected]
Also tried the following:
echo "encrypted msg" | gpg -e --armor -f <pub_key> | \
mutt -s "PGP test" \
-e "my_hdr MIME-Version: 1.0" \
-e "my_hdr Content-Type: multipart/encrypted; protocol='application/pgp-encrypted'" \
-e "my_hdr Content-Disposition: inline" [email protected]
And I get the error: Error in command line:
protocol=application/pgp-encrypted: unknown command
Is there a way to accomplish this (ideally, without creating temporary
files for the encrypted part)?
--
W. D. Sadeep
PGP: 103BF9E3E750BF7E