Sending signed e-mail via shell script

salahuddin salahuddin at
Fri Feb 24 21:11:09 CET 2012

On Wed, 2012-02-22 at 17:13 +0100, Martin Gollowitzer wrote:
> Hi,
> I'm currently trying to do a smal script that sends automated e-mail
> messages on a regular basis. I want to sign those e-mails and since mutt
> does not allow to use it's OpenPGP features in non-interactive mode, I
> try to at least have these messages signed using inline PGP.
> For this, I use the following commands on a Debian squeeze machine:
> cat $file | gpg --no-verbose --batch --quiet --output - --passphrase "<passphrase>" --armor --textmode --clearsign > $tmpfile
> mail -s "<Subject>" $address < $tmpfile
> The problem is that I get a "BAD SIGNATURE from …" when verifying the
> signature in mutt. I'm not entirely sure, but I think the problem has to
> do with the encoding. I'm not very talented in shell scripting, so any
> help is highly appreciated. Of course if you know a way to send
> automated PGP/MIME signed messages, that would be even better.
> Thanks, 
> Martin 

You may need to add header:
Content-Type: multipart/signed; protocol="application/pgp-signature"

"5. OpenPGP signed data" section may help:

> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users at

More information about the Gnupg-users mailing list