Offline Mutt to replace Thunderbird on Ubuntu (4 of 4)

It’s about time I got back to this one…

So to bring together everything over the last 4 posts and to cover how offlineimap and msmtp can work together with Mutt, this is the config that’s needed:

# Show unicode
set charset=UTF8
set send_charset="iso-8859-1:utf-8"

# IMAP using offlineimap
set imap_user = "EMAIL"
set imap_pass = "PASSWORD"
set imap_check_subscribed
unset imap_passive
set mail_check = 10
set timeout = 10

# SMTP using msmtp
# Check this path
set sendmail="/usr/local/bin/msmtp-enqueue.sh"
set envelope_from=yes
set from = "EMAIL"
set realname = "REAL NAME"

# Change the following line to a different editor you prefer.
set editor="vim -c 'set tw=72 comments=nb:>'"
set tilde

# Directories and mailbox mappings
# These will depend on how you have set offlineimap to parse the GMail tags
set mbox_type = Maildir
set folder = ~/.imap
source ~/.mutt/mailboxes
set spoolfile = "+inbox"
set trash="=bak.trash"
set postponed = "+bak.drafts"
set record = "+bak.sent"

# Caching
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no

# Layout
set status_chars  = " *%A"
set status_format = "[ Folder: %f ][%r%m messages%?n? (%n new)?]"
set sort = 'reverse-last-date-received'
set pager_context = 5
set pager_index_lines = 10
set pager_stop
set quit = ask-yes

# Viewing and replies
set include
set forward_quote
set forward_format = "Fwd: %s"
unset mark_old
unset reply_self
alternative_order text/plain text/html *
auto_view text/html
unset sig_dashes
ignore *                               # first, ignore all headers
unignore From: To: Cc: Date: Subject:  # then, show only these
hdr_order From: Date: To: Cc: Subject  # in this order

# Commands
bind editor  complete
bind editor ^T complete
bind editor  noop 

# Keyboard shortcuts
# Again, mailbox names are dependent on offlineimap settings
macro pager d "" "Gmail delete message"
macro index d "" "Gmail delete message"
macro index,pager gi "=inbox" "Go to Inbox"
macro index,pager gs "=bak.sent" "Go to Sent"

# A 'set' of commands for easier moving between often-used folders
# and moving emails to those folders from pager and index views.
# Replace the first X with a key, and the XXXX with an inbox name
macro index,pager gX "=XXXX" "Go to XXXX"
macro pager zX "=XXXX" "Move To XXXX"
macro index zX "=XXXX" "Move To XXXX"

# Set an appropriate directory to save attachments to
macro attach W /home/user/Temp/
macro index,pager G 

# Only if the sidebar is used
set sidebar_width = 30
bind index,pager \CP sidebar-prev
bind index,pager \CN sidebar-next
bind index,pager \CO sidebar-open
macro index,pager \CH ":set sidebar_visible=no" "Hide Sidebar"
macro index,pager \CL ":set sidebar_visible=yes" "Show Sidebar"

# Address Book
source ~/.muttalias
set alias_file=~/.muttalias

Hopefully the comments explain what is needed here, and there are a few EMAIL and PASSWORD that need to be changed. A lot of the above is down to my own preferences, but the IMAP, SMTP and Directories sections give the bare bones of what is needed.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>