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

Re: send encrypted mail from commandline?



On 05/01/08 22:09, Joseph wrote:
> On 05/01/08 20:04, Marianne Promberger wrote:
>> Can mutt send encrypted mail from the commandline? The mail should
>> always be encrypted to myself.
>> [...]
>> Background:
>>
>> I'd like to use procmail to automatically encrypt some messages I
>> receive and forward them on to a gmail account for storage.
>>
>> I currently do this using in ~/.procmailrc:
>> [snip]
>>  :0fbw  | $GPG --encrypt -r 80AD9916 --armour --output -
>>  
>> This works okay except it doesn't add the correct headers, and
>> while mutt decrypts the message text fine (with Alt-Shift-p) I cannot
>> see attachments (which in turn may be related to having the wrong
>> headers).
>>
>
> Why complicate simple things :-)
> Why don't you use:
> gpg -ea -r public_key_ID  file.txt && mutt -a file.txt.asc

Thanks, but I don't know how I would integrate this into the procmail
filter to solve my problem.

I tried the following:

| gpg --encrypt -r 8AD9916 --armour --output ~/mymail && \
mutt address@domain -a ~/mymail < /dev/null

but I'm not surprised it doesn't work. For an e-mail without
attachment, I get almost the same result as before: mail gets
encrypted, attached and sent; I get it just fine but there's no
automatic decryption when reading in mutt, so the result is almost
identical to m y solution (except now I have an extra attachment).

For an e-mail with attachment, procmail gets an error:

gpg: cannot open /dev/tty': No such device or address
procmail: Error while writing to " gpg --encrypt -r 80AD9916 --armour
[...]
procmail: Rescue of unfiltered data succeeded

Maybe I'm missing something, but I don't see how encrypting the e-mail
as-is using gpg and using mutt to forward that as an attachment would
be any better than encrypting the e-mail as-is and using sendmail to
forward that. It seems I'd have to tell gpg to encrypt each part of
the message and use something like formail to write the correct
headers.

That's just too much trouble -- the current solution is 95% good for
messages without attachment and messages with att'ment I can still
manually encrypt and forward  from mutt to the storage account.

I just thought maybe it would be straightforward using mutt directly.

m.