more mutt goodness

here is my .muttrc which i will be explaining a little bit.

my needs with mutt were a little bit of a pain in the ass and here is why;
-i needed to be able to check 5 different accounts
–4 google apps domains, 1 gmail account
-one of the accounts needed to allow my pgp key for signing and encryption
-spell checking (achieved in vim using “set spell”)
-must be able to open images, doc files, and pdfs

so for the first part of the .muttrc file , most of the “sets” are commented:

set header_cache=~/.mutt/cache/headers                  # path for cached headers for single download
set message_cachedir=~/.mutt/cache/bodies               # path for cached messages for single download
set certificate_file=~/.mutt/mutt.crt                   # path for stored server certs
set move = no                                           # this tells mutt not to move messages off the mail server
set imap_check_subscribed                               # When set, mutt will fetch the set of subscribed folders from your server on connection, and add them to the set of mailboxes it polls for new mail
set sort=threads                                        # sort messages by thread
set sort_browser=reverse-date                           # sort by newest first
set sort_aux=reverse-last-date-received                 # show threads with youngest message list
alternative_order text/plain text/html application/vnd.msword application/msword    # Prefer Plain text to html, html to word etc ...
set index_format="%4C %Z %[!%b %d %Y %H:%M] %-17.17F (%3l) %s"                      # Simple modification to index format to display year in date column

# Header settings
ignore *                                                # Don't display all headers
unignore From To Cc Subject Date Organization X-Mailer User-Agent                   # header unignores
set editor="vim -c 'set syntax=mail ft=mail enc=utf-8'" # setting editor defaults
set markers=no                                          # Fix multiline url wrapping to not break in gnome terminal
set smart_wrap                                          # dont wrap mid word
set pager_context=5                                     # Retain 5 lines of previous page when scrolling.
set delete=yes                                          # Automatically delete messages marked for deletion on exit
set ssl_starttls=yes                                    # Start TLS if available on server
auto_view text/html                                     # autoview html
set strict_threads                                      # Don't thread messages by subject
set fast_reply=yes                                      # Skip prompt for subject and recipients when replying
set beep_new=yes                                        # Beep when new messages arrive in mailbox
set beep=no                                             # Don't beep on errors
set pager_index_lines=15                                # lines to leave in pager view
set pager_stop=yes                                      # while in pager prevent going to next message

# Printing
set print=yes                                           # Don't ask before printing
set print_command="muttprint"                           # Use muttprint for pretty printing
set print_split                                         # Split each msg selected for printing

the second part of my config file is just color definitions:

# Color definitions
# colors: white black green magenta blue cyan yellow red default colorx

color normal            color245        color233
color error             color124        color233
color tilde             color245        color233
color message           yellow          color233
color markers           yellow          color233
color attachment        color221        color233
color search            color48         color240        # how to hilite search patterns in the pager
color status            color42         color237
color indicator         color220        color88

color hdrdefault        color238        color233
color body              color128        color233        '[-.+\w]+@[-.\w]+[^.]' # e-mail addresses
color underline         brightgreen     color233

and the last section is where all my account definitions are, here is the breakdown:

DOMAIN_ONE is a google apps domain that needed to use my pgp key
DOMAIN_TWO, DOMAIN_THREE, & DOMAIN_FOUR are more google apps domains but did not need pgp keys
GMAIL is a gmail account

#########################
#### account configs ####
#########################

account-hook . 'unset preconnect imap_user imap_authenticators'

#### DOMAIN_ONE ####
account-hook 'imaps://USER@DOMAIN_ONE.COM@imap.gmail.com:993/' \
' set imap_user = "USER@DOMAIN_ONE.COM" \
imap_pass = "PASSWORD" '

folder-hook 'imaps://USER@DOMAIN_ONE.COM@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@DOMAIN_ONE.COM" \
imap_pass = "PASSWORD" \
smtp_url = "smtp://USER@DOMAIN_ONE.COM@smtp.gmail.com:587/" \
smtp_pass = "PASSWORD" \
from = "USER@DOMAIN_ONE.COM" \
realname = "USER" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 \
pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f" \
pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f" \
pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f" \
pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f" \
pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f" \
pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0xXXXXXXXX -- -r %r -- %f" \
pgp_encrypt_sign_command="pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0xXXXXXXXX -- -r %r -- %f" \
pgp_import_command="gpg --no-verbose --import -v %f" \
pgp_export_command="gpg --no-verbose --export --armor %r" \
pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r" \
pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" \
pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" \
pgp_autosign=yes \
pgp_sign_as=0xXXXXXXXX \
pgp_replyencrypt=yes \
pgp_timeout=1800 \
pgp_good_sign="^gpg: Good signature from" '
#### end DOMAIN_ONE ####

#### DOMAIN_TWO ####
account-hook 'imaps://USER@DOMAIN_TWO.COM@imap.gmail.com:993/' \
' set imap_user = "USER@DOMAIN_TWO.COM" \
imap_pass = "PASSWORD" '

folder-hook 'imaps://USER@DOMAIN_TWO.COM@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@DOMAIN_TWO.COM" \
imap_pass = "PASSWORD" \
smtp_url = "smtp://USER@DOMAIN_TWO.COM@smtp.gmail.com:587/" \
smtp_pass = "PASSWORD" \
from = "USER@DOMAIN_TWO.COM" \
realname = "USER" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 '
#### end DOMAIN_TWO ####

#### DOMAIN_THREE ####
account-hook 'imaps://USER@DOMAIN_THREE.COM@imap.gmail.com:993/' \
' set imap_user = "USER@DOMAIN_THREE.COM" \
imap_pass = "\PASSWORD" '

folder-hook 'imaps://USER@DOMAIN_THREE.COM@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@DOMAIN_THREE.COM" \
imap_pass = "\PASSWORD" \
smtp_url = "smtp://USER@DOMAIN_THREE.COM@smtp.gmail.com:587/" \
smtp_pass = "\PASSWORD" \
from = "USER@DOMAIN_THREE.COM" \
realname = "ebay" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 '
#### end DOMAIN_THREE ####

#### GMAIL ####
account-hook 'imaps://USER@imap.gmail.com:993/' \
' set imap_user = "USER@GMAIL.COM" \
imap_pass = "PASSWORD" '

folder-hook 'imaps://USER@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@GMAIL.COM" \
imap_pass = "PASSWORD" \
smtp_url = "smtp://USER@smtp.gmail.com:587/" \
smtp_pass = "PASSWORD" \
from = "USER@GMAIL.COM" \
realname = "USER" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 '
#### end GMAIL ####

#### DOMAIN_FOUR ####
account-hook 'imaps://USER@DOMAIN_FOUR.COM@imap.gmail.com:993/' \
' set imap_user = "USER@DOMAIN_FOUR.COM" \
imap_pass = "PASSWORD" '

folder-hook 'imaps://USER@DOMAIN_FOUR.COM@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@DOMAIN_FOUR.COM" \
imap_pass = "PASSWORD" \
smtp_url = "smtp://USER@DOMAIN_FOUR.COM@smtp.gmail.com:587/" \
smtp_pass = "PASSWORD" \
from = "USER@DOMAIN_FOUR.COM" \
realname = "USER" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 '
#### end DOMAIN_FOUR ####

for the mailbox names section, those are labeled to be able to switch using “c”:

#### mailbox names ####
mailboxes 'imaps://USER@DOMAIN_ONE.COM@imap.gmail.com:993/INBOX' \
'imaps://USER@DOMAIN_TWO.COM@imap.gmail.com:993/INBOX' \
'imaps://USER@DOMAIN_THREE.COM@imap.gmail.com:993/INBOX' \
'imaps://USER@imap.gmail.com:993/INBOX' \
'imaps://USER@DOMAIN_FOUR.COM@imap.gmail.com:993/INBOX'

the f key macros allow me to switch between accounts by just pressing F5-F9. i would have used F1-F5 but F1-F4 did not work.:

#### f key macros for direct mailbox access
macro generic,index,pager  "c imaps://USER@DOMAIN_ONE.COM@imap.gmail.com:993/INBOX/\n"
macro generic,index,pager  "c imaps://USER@DOMAIN_TWO.COM@imap.gmail.com:993/INBOX/\n"
macro generic,index,pager  "c imaps://USER@DOMAIN_THREE.COM@imap.gmail.com:993/INBOX/\n"
macro generic,index,pager  "c imaps://USER@imap.gmail.com:993/INBOX/\n"
macro generic,index,pager  "c imaps://USER@DOMAIN_FOUR.COM@imap.gmail.com:993/INBOX/\n"

for the /etc/mailcap file, i added these lines:

application/msword; antiword %s | less ; copiousoutput
application/pdf; acroread -tempFile -openInNewWindow %s
image/*; feh %s; copiousoutput

for opening images i use feh, for docs i use antiword, and for pdf’s i use acroread.

for spell checking, i enabled “set spell” (here is my vimrc) which when used, will underline the incorrect words.
usage:

]s - move to the next misspelled word
[s - move to the previous misspelled word
zg - add a word to the dictionary
zug - undo the addition of a word to the dictionary
z= - view spelling suggestions for a misspelled word

a lot of the stuff on this page was done with a lot of searching all over google for various portions of stuff.
here are some of the links that i did bookmark that i used for reference:

http://codesorcery.net/old/mutt/mutt-gnupg-howto
http://www.cmdln.org/2008/11/07/how-i-tamed-my-mutt/
http://mig5.net/content/viewing-docx-attachments-mutt
http://www.spocom.com/users/gjohnson/mutt/

«
»

    Leave a Reply

    Your email address will not be published. Required fields are marked *