8.7. Encrypted Mail with elm

Problem

You want to send and receive encrypted email conveniently with the elm mailer.

Solution

While viewing an encrypted message, type:

| gpg --decrypt | less

to display the decrypted text page by page. To send an encrypted message, encrypt it in your text editor. [Recipe 8.1][Recipe 8.2]

Discussion

We take advantage of elm’s pipe feature, which sends the body of a mail message to another Linux command, in this case gpg . We further pipe it to a pager (we chose less) for convenient display. For encryption, we handle it in the text editor invoked by elm to compose messages. [Recipe 8.1][Recipe 8.2]

There are alternatives. A patched version of elm, known as ELMME+ , supports GnuPG directly. (The author, Michael Elkins, went on to create mutt, [Recipe 8.6] which also supports GnuPG.)

You might also try the pair of scripts morepgp (for decrypting and reading) and mailpgp (for encrypting and sending), available at http://www.math.fu-berlin.de/~guckes/elm/scripts/elm.pgp.scripts.html. These scripts are for PGP, but modification for GnuPG should not be difficult.

Get Linux Security Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.