Home           RSS           Search

January 10, 2013





Mutt config ( .muttrc )



Many people have asked for my .muttrc Mutt config file. This page is here to make it easier for people to find. to use this config file just cut/paste into your .muttrc file.

If you would like to use this .muttrc file you need to change a few variables for your mail account.

1. The "Headers" section you need to replace the example email address "username@your_isp.com". Replace the example setting with your email and full name you want to be known as.

2. The "Macros" section setup the mail boxes you would like to have "hot key" access to. For example in in this config "F5" will switch to the "inbox"."

3. The "Hooks" section make sure your signature files are setup correctly. Also, take a look at some of the commented option to see if you will find them useful.

4. The PGP/GPG options are commented out. You need to setup a GPG key first on a public or private key server before using these options. Onced your key is setup then replace the three(3) entires "E316DAB9" with your real GPG key. Then uncommnet the "GPG Hooks" options. Good to go.

5. Lastly, take some time and look at all of the options in the config file. There are a lot of things to learn about mutt. Read the man pages and join the mutt discussion groups. Block out a few minutes a day and find out what a few of the .muttrc options do. You may find out the options here are perfect for your uses or you may want to tweek a few. Just take your time and have fun. Mutt is a really good mail client.


#######################################################
###  Calomel.org .muttrc   BEGIN
#######################################################
# System configuration file for Mutt ( .muttrc )
#
#######################################################
###  Pager
#######################################################
ignore *
unignore  X-Bogosity From: Reply-To: To: Cc: Date: Subject:
hdr_order X-Bogosity From: Reply-To: To: Cc: Date: Subject:

#######################################################
###  Macros
#######################################################
# change mailbox
macro index <f5> 'c =inbox^M'
macro pager <f5> 'c =inbox^M'
macro index <f6> 'c =archive^M'
macro pager <f6> 'c =archive^M'
macro index <f7> 'c =saved^M'
macro pager <f7> 'c =saved^M'
macro index <f8> 'c =SPAM^M'
macro pager <f8> 'c =SPAM^M'
macro generic <f12> '!fetchmail^M'

# save attachments to incoming
macro attach s <save-entry>lt;bol>my_saved/incoming/

#######################################################
###  Headers
#######################################################
my_hdr From: username@your_isp.com (User Name)
my_hdr Reply-To: username@your_isp.com (User Name)
my_hdr Errors-To: username@your_isp.com
my_hdr Organization: Open Source Software Supporter (OSSs)

# email address mutt knows this client as. This is used to
# avoid problems with the "metoo" argument not taking effect.
set alternates=username@your_isp.com

# When OutLook receives email it will put it at the
# top of their mailbox list and flag it with an "urgent"
# red box. Just another way to play with Outlook/LookOut users.
my_hdr X-Message-Flag: OUTLOOK WARNING!! Use Open Source
my_hdr Reply-By: `date --date="-3 days"`
my_hdr X-MSMail-Priority: High

#######################################################
###  Colors
#######################################################
color quoted    yellow     default
color quoted1   cyan       default
color quoted2   magenta    default
color quoted3   green      default
color quoted4   red        default

color signature blue default
color normal    white black
color status    brightgreen blue
color indicator brightyellow black
color error     red black
color tree      yellow black
color attachment blue default
color index     cyan black (calomel.org)
color header    green black .*
color header    brightred  black (^From\:|^Reply-To\:)
color header    brightyellow black (^To\:|^cc\:|^Cc\:)

color body      magenta      default "(ftp|http|https)://[^ ]+"
color body      magenta      default [-a-z_0-9.]+@[-a-z_0-9.]+
color body      brightgreen  default "^(gpg: )?Good signature"
color body      brightgreen  default "^(gpg: )?encrypted"
color body      brightred    default "^(gpg: )?Bad signature"
color body      red          default "^(gpg: )?warning:"
color body      red          default "^(gpg: ).*failed:"

color message    magenta        default # info messages
color search     brightyellow   red     # search matches
color tilde      brightmagenta  default # ~ at bottom of msg
color markers    red            default # + at beginning of wrapped lines
color hdrdefault cyan           default # default header lines
color bold       cyan           default # hiliting bold patterns in body
color underline  cyan           default # hiliting underlined patterns in body

color index     green          default  ~T      # Tagged
color index     red            default  ~D      # Deleted

#######################################################
###  Options
#######################################################
bind editor <BackSpace> backspace
push <show-version>
source ~/Mutt/address
mailboxes ~/Mail/inbox

# Autoview attachments
unset implicit_autoview
alternative_order text/html text/enriched text/plain
auto_view text/html
set mailcap_path=~/.mailcap


set status_format="-%r-Mutt: %f --------[Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]-%>-----%h-(%P)"

  set alias_file="~/Mutt/address"
unset abort_nosubject
unset abort_unmodified
  set allow_8bit
unset arrow_cursor
unset ascii_chars
  set autoedit
unset beep
unset beep_new
unset bounce_delivered
  set check_new
unset confirmappend
  set copy
  set delete
unset edit_headers
  set editor = "vim -c 'set textwidth=77' -c 'map  gqap' -c 'map  :50d 9999'"
  set envelope_from
  set fast_reply
unset fcc_attach
  set fcc_clear
  set folder="~/Mail"
  set forward_decode
  set forward_format="Fwd: %s"
  set help
  set hostname="your_isp.com"
  set include
  set index_format="%3C %Z %(%D) %-27.27L (%4c) %s"
  set indent_string=">"
  set ispell="clear;aspell -e -c"
  set mailcap_sanitize
  set mail_check=1
unset markers
unset mark_old
  set menu_scroll
unset metoo
  set mime_forward=no
  set mime_forward_decode
  set mime_forward_rest
  set pager="builtin"
  set pager_format=""
  set pager_index_lines=10
  set pager_stop
unset postpone
  set postponed="~/Mail/postponed"
  set print=ask-no
  set read_inc=2
unset reply_self
  set reply_to
unset sig_dashes
  set sig_on_top
  set smart_wrap
  set sort_aux=last-date-received       
  set sort=threads
  set sort_re
  set status_on_top
unset strict_threads
unset suspend
  set tilde
  set timeout=5
  set thorough_search
unset user_agent
unset wait_key
unset write_bcc

#######################################################
###  Hooks
#######################################################
# Hooks
send-hook . "set signature=~/Mutt/signature_long"
send-hook calomel.org "set signature=~/Mutt/signature_short"
send-hook . 'unset pgp_autoencrypt pgp_autosign'
send-hook . 'set record="~/Mail/archive"'

# Mark mail as read
#folder-hook archive push '<tag-pattern>.*\r<tag-prefix><clear-flag>N<untag-pattern>.*\r'

# Delete old mail after a set number of days
#folder-hook archive push 'D~r>32d!~F\n'
#folder-hook SPAM push 'D~r>60d!~F\n'

#######################################################
###  GPG Hooks
#######################################################
#my_hdr X-GPG-Key-Server: http://pgp.mit.edu 
#my_hdr X-GPG-Key-FingerPrint: 1180 F11D 11E6 1176 11CC E1B1 

#send-hook example@calomel.org 'set pgp_autosign; set pgp_autoencrypt'
#pgp-hook example@calomel.org E316DAB9

#set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f"
#set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f"
#set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f"
#set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
#set pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f"
#set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to E316DAB9 -- -r %r -- %f"
#set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to E316DAB9 -- -r %r -- %f"
#set pgp_import_command="gpg --no-verbose --import -v %f"
#set pgp_export_command="gpg --no-verbose --export --armor %r"
#set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r"
#set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" 
#set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" 
#unset pgp_retainable_sigs
#set pgp_ignore_subkeys
#set pgp_verify_sig=yes
#set pgp_create_traditional=no
#set pgp_autosign=no
#set pgp_autoencrypt=no
#set pgp_sign_as=E316DAB9
#set pgp_replysignencrypted
#set pgp_replyencrypt=yes
#set pgp_replysign=yes
#set pgp_timeout=3600
#set pgp_good_sign="^gpg: Good signature from"

#######################################################
###  Calomel.org .muttrc  END
#######################################################



HELPFUL HINT: For an added layer of protection again spam you can use a bayesian spam filter. Check out our Bogofilter "how to" Anti-Spam Guide. With a little time and understanding you could easily filter up to 99% of any remaining spam.



Questions?

How can I generate a GPG key for use with Mutt?

All of the options you will need to make GPG work are in the example .muttrc file above. In order to use GPG you need to generate a GPG/PGP key. The key is made using the binary "gpg" and the supporting program "pgpwrap". Make sure both are alreay installed on your system.

Generating the GPG key. A key size of 1024 should be fine, but systems today are quite fast so lets make the key to be 4096 bit. The key files will be placed in the hime directory of the user in ~/.gnupg/

calomel@calomel# gpg --gen-key
Please select what kind of key you want:
   (1) DSA and Elgamal (default)
   (2) DSA (sign only)
   (5) RSA (sign only)
Your selection? 1
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) 5y
Key expires at Mon 01 Jan 2020 01:02:03 PM EDT
Is this correct? (y/N) y

Real name: Calomel
Email address: example@calomel.org
Comment: Calomel's Example
You selected this USER-ID:
    "Calomel (Calomel's Example) <example@calomel.org>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.

Make sure the key way generated. For this example the key ID is "E316DAB9". The key id is how this key will be refered to any time you need to manipulate or refer to it. Notice the three(3) instances of "E316DAB9" in the example .muttrc above.

calomel.@calomel# gpg --list-keys
/home/calomel/.gnupg/pubring.gpg
------------------------
pub   1024D/850CC8F8 2015-01-02 [expires: 2020-01-02]
uid                  Calomel (Calomel's Example) <example@calomel.org>
sub   4096g/E316DAB9 2015-01-02 [expires: 2020-01-02]

If you would like to make your GPG public so others may easily find it you can publish the key to a key server. The GPG key server at MIT has been around a long time and will also b a ble to share you key with other key servers around the world. Her will will publish our key and then do a quick search to make sure it can be found.

calomel@calomel# gpg --keyserver pgp.mit.edu --send-keys E316DAB9
gpg: sending key E316DAB9 to hkp server mit.edu

calomel@calomel# gpg --keyserver pgp.mit.edu --search-keys Calomel
gpg: searching for "Calomel" from hkp server pgp.mit.edu
(1)     Calomel (Calomel's Example) <example@calomel.org>
          1024 bit DSA key E316DAB9, created: 2015-01-02

Your next step is to collect the GPG keys from theose people you want to send encrypted mail to. If they also published their keys to a key server then you can use the gpg argument "--search-keys" like above to find their keys.

Once you collect the GPG keys of other people you must then sign their GPG on your keychain with your GPG key. This means that you fully trust the key. The following example uses the key id, "4C4FE4FE" from the other person's public key.

calomel@calomel# gpg --sign-key 4C4FE4FE

You should now be able to send encrypted email to any person you have a key for.





Questions, comments, or suggestions? Contact Calomel.org or