Home > Mutt, Tech Note > Mutt Configuration of GPG and From field

Mutt Configuration of GPG and From field


Mutt is one of those programs I have a love-hate relationship with: I hate to love it.  It’s flexibility and almost infinite configuration options makes this email client one of the best and worst to use.  Once you get mutt configured you’ll want to put the configuration file in the same place you keep your other important papers, passport, etc.  I have been on the losing end of not doing this and had to start over from scratch with my configuration.  Trust me, it’s not fun.  Pair that with reconfiguring offlineimap and postfix and you’ll have a new-found respect for backing up your configuration files (/home and /etc).  If you’ve ever looked at another mutt configuration file and feel overwhelmed a good place to start to build your own config file is the muttrc builder.  That builder will help you build your configuration file for most settings.

I won’t bore you with all 1334 words that is my configuration file but I will point out the GPG settings, how to customize the From field, and working with listservs.

I am subscribed to many listservs.  Probably not as many as some but more than average.  Because of this I receive an obscene amount of email everyday.  Mutt allows you to mark these messages as coming from a list so you can safely ignore these messages for several days weeks and you won’t miss that personal message that someone responded directly to you from the list.  To do this you must provide the lists you are subscribed to.  Wildcards are allowed, thankfully.

subscribe @lists.fedoraproject.org
subscribe @yahoogroups.com

That’s it, you can just list the from address of each list, or just use partials, and mutt will show these messages as coming from a list.  This brings up another interesting aspect of dealing with lists: the address from which you subscribed.  Maybe you use one email address for certain lists or contacts and you want to automatically use that address for messages going to certain addresses.  No problem, just use this string:

send-hook '~t @fedoraproject.org' my_hdr From: "First Last <me@example.com>"

That configuration will change the from address to “First Last <me@example.com>” when sending to an address that contains @fedoraproject.org.  You can put in as many of these as you’d like.

Mutt also works well with GnuPG (GPG) and S/MIME.  While I haven’t worked with S/MIME certificates I can attest to mutt’s ability to utilize GPG gracefully.  There are some settings you’ll want to set in the configuration file to make sure GPG does as you expect.

set forward_decrypt = no <- This setting means that you won't accidentally forward a previously encrypted message.
set crypt_autoencrypt = no <- This will force all messages to be encrypted.
set crypt_autopgp = yes <- This will force the crypto to be PGP or GPG.
set crypt_autosign = no <- Sign all messages.
set crypt_autosmime = no <- Use MIME instead of in-line signatures
set crypt_replyencrypt = yes <- Encrypt replies to encrypted messages.
set crypt_replysign = yes <- Reply to signed messages with a signature
set crypt_replysignencrypted = yes <- Reply to signed and encrypted messages with a signed and encrypted message.
set crypt_timestamp = yes <- Use a timestamp.
set crypt_use_gpgme = no <- Use GPGME
set crypt_verify_sig = yes <- Verify signatures on incoming messages
set pgp_auto_decode = yes <- Automatically decode PGP signatures
set pgp_autoinline = yes <- Use auto inline.
set pgp_sign_as = '024BB3D1' <- Which key you want to use by default.

You don’t have to use the settings I use but you should know what each setting does.  There may also be some duplicate or deprecated commands in there as well.  You can even set mutt to automatically sign and/or encrypt messages based on the address you are sending the message to:

send-hook friend@example.com 'set pgp_autosign'
send-hook friend@example.com 'set pgp_autoencrypt'

Aliases are your address book of email addresses.  They look like this:

source $HOME/.mutt/mutt-aliases <- Points to where the file of aliases is located.  You can put them in muttrc.
alias Friend First Last <friend@example.com>

This means that when you send a message to ‘Friend’ the message will magically be sent to  ‘First Last <friend@example.com>’.  A very handy way of sending messages to people without having to type their entire name or email address.

I hope this has been a helpful post on mutt.  I’ll happily attempt to answer any questions although I’ll have to say that I’m far from a mutt expert.  There are also many other customizations that I did not get into that could further increase your enjoyment of this great program.

Advertisements
Categories: Mutt, Tech Note
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s