Howto: mutt + gpg + gmail

Getting mutt, gmail and gnupg working together was a bit of a pain for me. So here is my configuration in all "simplicity".

Mutt unfortunately does not support multiple mainboxes, but a workaround is to create separate rcfiles that are sourced via a hotkey.


set spoolfile=~/mbox  
set record=~/mail/sent  
set folder=~/mail  
set use_envelope_from=yes

folder-hook '' 'source ~/.mutt/'  
macro index 'source ~/.mutt/!'

set pgp_sign_as=0xDECAFBAD # your key  
set pgp_timeout=60  
set crypt_replysign  
set crypt_verify_sig=yes  
set crypt_autopgp=yes  
set pgp_auto_decode=yes # traditional pgp support

source ~/.mutt/gpg.rc


See Lifehacker's "How to Use the Fast and Powerful Mutt Email Client with Gmail" article for more details.

set imap_user = ""  
#set imap_pass = "PASSWORD" # I recommend not setting this here, put
inputting it manually when asked  
set smtp_url = "smtp://"  
#set smtp_pass = "PASSWORD" # ditto  
set from = ""  
set realname = "Your Name"

set editor = "vim"

set folder = "imaps://"  
set spoolfile = "+INBOX"  
set imap_check_subscribed  
set hostname =  
set mail_check = 120  
set timeout = 300  
set imap_keepalive = 300  
set postponed = "+[GMail]/Drafts"  
# Gmail SMTP stores message automatically  
#set record = "+[GMail]/Sent Mail"  
unset record  
set header_cache=~/.mutt/cache/headers  
set message_cachedir=~/.mutt/cache/bodies  
set certificate_file=~/.mutt/certificates  
set move = no  
set include  
set sort = 'threads'  
set sort_aux = 'reverse-last-date-received'  
set auto_tag = yes  
ignore "Authentication-Results:"  
ignore "DomainKey-Signature:"  
ignore "DKIM-Signature:"  
hdr_order Date From To Cc  
alternative_order text/plain text/html *  
auto_view text/html  
bind editor complete-query  
bind editor ^T complete  
bind editor noop·

And for the GPG part, let's just use what Debian ships with, except for the few overrides mentioned earlier:

cp /usr/share/doc/mutt/examples/gpg.rc ~/.mutt/gpg.rc

With any luck, that was all. Nice, and simple. Not.