Revision as of 21:46, January 26, 2014 by Duncan.Britton (Talk) (Mutt postfix setup)

Mutt is a popular mail reader for Linux systems. This page is being created as a good place for people to place their mutt configurations to share with others. These configuration settings go in the user's ~/.muttrc file.

Essential Mutt

set pager_stop

This turns off the default behavior of mutt where hitting space to scroll will automatically move to the next message when the end of the current message is reached. This is very annoying when scrolling in long emails like cron jobs, and the line above sets this behavior to off.

angry_vincent's .muttrc:


Interesting Color Options

golodhrim's mutt config

First I split up my muttconfig in several subfiles under ~/.mutt. The resulting files will be:

  • ~/.mutt/account_hooks
  • ~/.mutt/colors
  • ~/.mutt/folder_hooks
  • ~/.mutt/gpg
  • ~/.mutt/lists
  • ~/.mutt/macros
  • ~/.mutt/mutt-alias
  • ~/.mutt/muttrc
  • ~/.mutt/sidebar
  • ~/.secret/.passwd.gpg


Next, edit ~/.mutt/account_hooks</pre>:











# Macros to toggle the sidebar visibility                                       
macro index b '<enter-command>toggle sidebar_visible<enter><refresh>'
macro pager b '<enter-command>toggle sidebar_visible<enter><redraw-screen>'

# abook query
macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook"
macro generic,index,pager \Cb "abook" "launch abook"


multiple lines like

alias nick Realname <email@host.tld>


# Some minimal Mutt settings, Gentoo-style.  These reflect the Gentoo
# predilection for maildir folders.
# Please don't add settings to this file to change other user
# preferences (such as colors), since those can be hard for a user to
# undo if their preference doesn't match yours!  For example, it is
# *impossible* currently in mutt to remove color settings from objects
# other than the index.

# Process the password file first
set my_tmp=`gpg -o ~/.secret/.tmp -d ~/.secret/.passwd.gpg`                     
set my_pass1=`awk '/user:/ {print $2}' ~/.secret/.tmp`
set my_del=`rm -f ~/.secret/.tmp`
# Further customisations
set smart_wrap = yes
set sort = 'threads'
set sort_aux = 'last-date-received'
set imap_check_subscribed

ignore "Authentication-Results:"
ignore "DoaminKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc

# Configuration variables
set abort_nosubject=yes
set abort_unmodified=yes
set query_command="abook --mutt-query '%s'"
set alias_file="~/.mutt/mutt-alias"
set alias_format="%4n %t %a %r"
source $alias_file
set assumed_charset="utf-8"
set attach_charset="utf-8"
set charset="utf-8"
set date_format=""
set edit_headers=yes
set editor='vim + -c "set textwidth=72" -c "set wrap" -c "set nocp" -c "?^$"        '
set folder="~/.offlineimap"
set forward_quote=yes
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set help=yes
set imap_idle=yes
set imap_peek=yes
set imap_servernoise=no
set include=yes
set mail_check=60
set mbox_type=Maildir
set menu_move_off=no
set menu_scroll=no
set mime_forward=ask-no
set pager_context=2
set pager_stop=yes
set postponed="~/.mutt/mail/postponed"
set realname="Martin 'golodhrim' Scholz"
set record="~/.mutt/mail/sent"
set reply_regexp="^(re([\[0-9\]+])*|betr):[ \t]*"
#set reply_to=yes
set tilde=yes

# muttprint for printing
set print_command="muttprint"

# Automatically process html mails
auto_view text/html

# Other configuration files
source ~/.mutt/account_hooks
source ~/.mutt/folder_hooks
source ~/.mutt/colors
source ~/.mutt/sidebar
source ~/.mutt/gpg
source ~/.mutt/macros
source ~/.mutt/lists 


# Sidebar configuration
set sidebar_width=30
set sidebar_visible=yes
set sidebar_delim='|'
color sidebar_new yellow default

# Sidebar keys
bind index \CP sidebar-prev
bind index \CN sidebar-next
bind index \CO sidebar-open
bind pager \CP sidebar-prev
bind pager \CN sidebar-next
bind pager \CO sidebar-open


For this file follow the next steps:

  • Step 1:

Create a folder ~/.secret and inside a file .passwd and enter the following into it:

user1:    passwd1
user2:    passwd2

where user1 and user2 are your identifiers for the accounts you added in account_hooks and folder_hooks and at the start of muttrc.

  • Step 2:

Now encrypt the file with your gpg-key, if you don't have one execute gpg --gen-key and create one first. After that don't forget to delete your unencrypted passwordstorage.

$ gpg -r 0x<Your-ID-fingerprint> -o .passwd.gpg --encrypt .passwd
$ rm -f .passwd

Mutt postfix setup

Postfix is another popular and powerful mail transfer agent which somehow easier to configure than sendmail. Let's start a quick postfix mail transfer setup that will work with mutt. Set sasl,berkdb USE flags to mail-mta/potsfix and mail-client/mutt

# echo "mail-mta/postfix berkdb sasl" >> /etc/portage/package.use/mail
# echo "mail-client/mutt berkdb sasl" >> /etc/portage/package.use/mail
# emerge -uN1 mutt postfix

Edit /etc/postfix/ and add the following lines:


Create and edit above mentioned authorization file gmail_passwd

# touch /etc/postfix/gmail_passwd
# echo "" >> /etc/postfix/gmail_passwd

Where <> is gmail account and passwd is account password. Convert gmail_passwd into Berkeley DB format, secure the file and finaly restart the postfix daemon

# postmap /etc/postfix/gmail_passwd
# chown root:postfix /etc/postfix/gmail_passwd*
# chmod 0640 /etc/postfix/gmail_passwd*
# /etc/init.d/postfix restart