Using Mutt as Email client

I’ve always fascinated with my professor Jim Diamond’s email client, and how it interacts with his zsh. Start from today, I am going to change my main email client from Thunderbird to Mutt too. Here is a small piece of snippet that I put into my ~/.mutt configuration. You may follow my steps and copy the necessary information to your mutt configuration files.

It is nearly a year that I haven’t used Windows as my in-production OS, instead I’ve used either RedHat sponsored Linux distro (Fedora) or a RHEL-copy CentOS.

sudo yum install mutt

Now it is the fun part.

By default, your mutt will read info from ~/.muttrc or ~/.mutt/muttrc. Since I have several email addresses needed to be setup, I use the second one.

mkdir -p ~/.muttrc/accounts

Which creates requested folders.

Go to ~/.mutt/accounts/ and create your email account file (you may name it as your like, but keep track of the file name) like the following way:

# Uni Email Setting, file name: university
set from = "[email protected]"
set realname = "Your Name Here"
# IMAP settings here
set imap_user = "abcdef"
set imap_pass = ""       # Password is empty here so you'll key-in passwords everytime you wish to access your email account
set folder = "imaps://imap.mail.tld:993"
set spoolfile = "imaps://imap.mail.tld:993/Inbox"   # For gmail users, you need to set your spoolfiles to "+INBOX"
set imap_check_subscribed
set mime_forward=yes
set mime_forward_rest=yes

#SMTP settings
set smtp_url = "smtp://[email protected]:587/"
set smtp_pass = ""

set mail_check = 120
set timeout = 300
set imap_keepalive = 300
# You can set the postponed/record to "+Drafts" or "Sent" correspondently below.
set postponed = "imaps://imap.mail.tld:993/Inbox.Drafts"
set record = "imaps://imap.mail.tld:993/Inbox.Sent"
set header_cache=~/.mutt/cache/headers

You can also put your GnuPG keys under your account if you have multiple keys for multiple emails for some reason. You need to copy the content over under each of your account setting. Remember to substitute your public key identifier in the config files.

You can create similar ones with gmail, assume that you have read the comments above.

Now we put some general information into our muttrc:

vim ~/.mutt/muttrc
set editor = "vim"
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:"
alternative_order text/plain text/html *
auto_view text/html
bind editor  complete-query
bind editor ^T complete
bind editor  noop
set hostname = desktop.luxing.im
set sig_on_top = yes

# Create a statusbar shows the information in localtime.
set pager_format="%4C %Z %[!%b %e at %I:%M %p]  %.20n -- %s%* -- (%P)"

# Accounts and Shortcuts
source ~/.mutt/accounts/acadia
macro index  'source ~/.mutt/accounts/yeah!'
macro index  'source ~/.mutt/accounts/126!'


# move spam to Spam/ from: http://chrisjrob.com/2011/03/23/configuring-mutt-for-spam/
macro index S "unset resolveNset resolve=INBOX.Spam" "file as Spam"
macro pager S "=INBOX.Spam" "file as Spam"

macro index H "unset resolveNset resolve=INBOX" "file as Ham"
macro pager H "=INBOX" "file as Ham"

# return to inbox by pressing .
macro index . "=INBOX" "Inbox"

set pager_format="%4C %Z %[!%b %e at %I:%M %p]  %.20n  %s%* -- (%P)" # show the corresponding local time of the email.
set pgp_use_gpg_agent = yes

You need to adjust your accounts corresponding to your settings.

If you put sensitive information like your passwords into your account, remember to chmod 600 for security concern.

Join the conversation

1 Comment

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.