<<< Date Index >>>     <<< Thread Index >>>

Re: How to send PGP-encrypted mail non-interactively?



On Wed, May 09, 2007 at 12:34:33PM -0700, Darrin Chandler wrote:
> On Wed, Nov 22, 2006 at 05:53:52PM +0100, Rene Tschirley wrote:
> > I'd like to have a script which sends eMail Cron-triggered on a daily
> > basis. So far no problem for mutt, but it has to be PGP-encrypted with
> > gnupg.
> 
> Did you ever get this working? If so, I would be interested to know how
> you did it!

For the archives, I've got a method working well, though it's not very
elegant. Here's what I've got going, in a shell snippet:

----------
gpg --encrypt --armor --output foo.pgp $RECIPIENT < foo
echo encrypted stuff attached | mutt -s Subject -a foo.pgp $RECIPIENT
----------

This works fine. Note the .pgp on the attachment. It's needed to get
mutt to use the desired MIME type of application/pgp. The same methods
should hold for any other gpg machinations, such as encrypt & sign. Of
course anything that would cause prompting will cause problems in a
batch situation such as cron, but that's not a problem for my usage.

Hopefully this will save someone a couple of minutes. :)

-- 
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
dwchandler@xxxxxxxxxxxxx   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation