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

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



On Thu, May 10, 2007 at 04:58:12PM -0700, Darrin Chandler wrote:
> 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

I would probably just send the clearsigned PGP message (using mutt or
sendmail), rather than attaching a foo.pgp file.

I use a pgp command like this to send encrypted mail from within a
program - probably some of these options will be helpful to people doing
similar things:

 gpg -r 0xXXXXXXXX -ae --batch --yes --always-trust

using the "batch" option means that it'll never allow interactive
commands, --yes assumes yes on most questions, --always-trust prevents
gpg from barfing if the recipient isn't trusted (according to TFM on one
machine I'm on, this is deprecated in favor of "--trust-model always").

w