Rawr!!!

My fear of mutt, and why it was all for NULL

Written by
October 24th, 2011
root_window

mutt… For those of us that have been using linux for a long time, we’ve probably heard of mutt at least once or twice throughout our lives. And most of the things that go along with mutt are negatively centered around how much of a pain in the ass it is to configure. The awfully dreadful ~/.muttrc and all the confusion that is encompassed within. Well I fell woe to the same gossip of mutt for all the years, and have mostly stayed in my browser bubble; by using gmail in firefox, and being content.

After having some time to tinker with my current solution, I setup alpine. I was thrilled it took all of 2 minutes to setup, and have a working cli email solution. This wonderful setup experience was all that I liked about alpine. The Nano-esque feel and all the random buttons I had to press were painful. Coming from a vim background, using ‘w’ to search for something is unholy to the standard of ‘/’ that I’m so familiar with. So after using alpine for a few minutes, I was fed up, and did a pacman -Rs re-alpine… I was content for a little while, until the next day I figured I’d try out mutt, and if it took me more than 20 minutes I would call it quits, and just live with firefox & gmail.

To my surprise, mutt only took me about 5 minutes to fetch email, and about another 5 minutes to send mail, and about 15 to tweak to my liking. I was flabbergasted that I came away from the setup unscathed, and happy with what I achieved.

I started by pointing my browser at the ever helpful Arch Linux Wiki =>   https://wiki.archlinux.org/index.php/Mutt and gandering at the setup procedure.

  1. I started by adding my login information and name to ~/.mutt/muttrc
    #
    # ~/.mutt/muttrc -- Mutt configuration
    #
    
    # Name Info
    set realname = "Jonny Gerold"
    set from = "me@gmail.com"
    
    # IMAP Settings
    set imap_user=me@gmail.com
    set imap_pass=my_password_here
    set folder=imaps://imap.gmail.com
    set imap_check_subscribed
    
    # SMTP Settings
    set smtp_url=smtps://$imap_user@smtp.gmail.com
    set smtp_pass=my_password_here
    
  2. I then proceeded to re-install mutt with mutt-trash which enabled trash folder support:
    yaourt -Sy mutt-trash
  3. Then I found some sweet settings by searching the internet:
    # Folders
    mailboxes     = "+INBOX"
    set spoolfile = "+INBOX"
    set postponed = "+[Gmail]/Drafts"
    
    # Archive Messages (A)
    macro index,pager A "unset trash\n " "Gmail archive message"
    
    # Thread Sort
    set sort=threads
    
    # Need trash patch for this to work
    set trash = "+[Gmail]/Trash"
    
    # store message headers locally to speed things up
    set header_cache = ~/.mutt/hcache
    
    # allow mutt to open new imap connection automatically
    unset imap_passive
    
    # keep imap connection alive by polling intermittently (time in seconds)
    set imap_keepalive = 300
    
    # how often to check for new mail (time in seconds)
    set mail_check = 120
    
    # Auto display html
    set mailcap_path 	= ~/.mutt/mailcap
    auto_view text/html
    
  4. I topped the sunday with some pretty colors:
    cat /usr/share/doc/mutt/samples/colors.linux >> ~/.mutt/muttrc
  5. After that I cleaned everything up a little and was left with this (removed lots of color declarations to support transparency):https://raw.github.com/fsk141/dotfiles/master/Hot/.mutt/muttrc
    #
    # ~/.mutt/muttrc -- Mutt configuration
    #
    
    # Name Info
    set realname = "Jonny Gerold"
    set from = "fsk141@gmail.com"
    
    # IMAP Settings
    set imap_user=fsk141@gmail.com
    set imap_pass=mypass
    set folder=imaps://imap.gmail.com
    set imap_check_subscribed
    
    # SMTP Settings
    set smtp_url=smtps://$imap_user@smtp.gmail.com
    set smtp_pass=mypass
    
    # Folders
    mailboxes     = "+INBOX"
    set spoolfile = "+INBOX"
    set postponed = "+[Gmail]/Drafts"
    
    # Archive Messages (A)
    macro index,pager A "unset trash\n " "Gmail archive message"
    
    # Thread Sort
    set sort=threads
    
    # Need trash patch for this to work
    set trash = "+[Gmail]/Trash"
    
    # store message headers locally to speed things up
    set header_cache = ~/.mutt/hcache
    
    # allow mutt to open new imap connection automatically
    unset imap_passive
    
    # keep imap connection alive by polling intermittently (time in seconds)
    set imap_keepalive = 300
    
    # how often to check for new mail (time in seconds)
    set mail_check = 120
    
    # Auto display html
    set mailcap_path 	= ~/.mutt/mailcap
    auto_view text/html
    
    # Colors
    
    color error brightred white
    color indicator brightyellow red
    color status brightgreen blue
    color search white black
    
    # Contents of ~/.mutt/mailcap
    text/html; w3m -I %{charset} -T text/html; copiousoutput; #make sure you have w3m installed
    
  1. This is what I’m left with:
colors email_message

The learning curve for mutt is very simple (well for me anyways); all the basic applicable commands are available at the top of the page, and anything else can easily be found by hitting ‘?’ and just hitting spacebar a few times till you find what you need. The one custom thing that you should pay attention to is how to Archive / Delete messages. I added a little scriptlet so that if you are reading / selecting a message you can hit ‘A’ (capital A) & your message will be marked to be archived. Otherwise hit ‘d’, and your message will be sent to trash (unless you don’t have the trash patch, in which case you should comment out the set trash variable)

Another nifty inclusion in my muttrc is the ability to automatically parse html (so you don’t get a bunch of garbled html, that makes the emails hard to read. This inclusion is with the set mailcap & ~/.mutt/mailcap additions.

Other than that the configuration above is simple, commented, and straightforward. Nothing complicated, and if you just copy the config and go, it’s less than 5 minutes to have a wonderfully beautiful email client setup, and ready to use.

 

Update: http://fsk141.com/gooey-google-contact-goodness-with-mutt << Add Google Contacts to mutt

Posted in: Linux, OS's | Tags: , , , , |

20 Comments

  • [...] just being acquainted with mutt (My fear of mutt, and why it was all for NULL) I forgot that I hate remembering things. I have too many things to remember already by using [...]

  • Ghoul says:

    Hi, nice review. But what about attachments, html mail, contact managment, notifications etc.? Setting up a basic mutt config is easy using the arch wiki, but if you want to use other features that are standard in a modern email clients a lot of hacking is required IMHO. I’m mainly using thunderbird, which is a big compromise with respect to mutt or alpine considering lightness, but without above mentioned features I’m out. Even sylpheed seriously lacks in features.

    Kind regards

    • fsk141 says:

      I’ve updated a post to show how to use contacts (http://fsk141.com/gooey-google-contact-goodness-with-mutt) and am going to update a post on how to use images; but you could easily install feh & put something like the following in ~/.mutt/mailcap (images/jpeg; feh %s;)

    • fsk141 says:

      I’ll try and make a follow up post that addresses all your issues;

    • I’ve been using Mutt exclusively for a few years now, and here’s some answers to your questions:

      1) “what about attachments”? Attachments are no big deal. View the MIME attachments with ‘v’ on the message, the save with ‘s’, then view if you’re running Mutt locally, or SCP to your box if you’re running Mutt behind an SSH server.

      2) “what about html mail”? As he mentioned in his post, you can use your /etc/mailcap entry to have a text-based browwser parse the HTML, save the plain text result, and have Mutt parse that as a result. The conclusion is no HTML mail mess.

      3) “what about contact management”? You can hook mutt into any sorts or address books. Personally, I use Goobook to get my Google contacts into Mutt. You can alias them manually at each message, and save to a sourced alias file. You can tie Mutt into an external local address book such as abook or evolution. Your options are fairly flexible here.

      4) “what about notifications”? What sort of notifications? You mean when your INBOX has a new mail? Depends on your setup. If Mutt is local, you can have fnotify scripted to alert you to new mail. If Mutt is remote, you can setup an SSH tunnel, and still use fnotify to locally notify you. Regardless, you’re going to need to script it, and it’s rather painless.

      With respect to the comment that lots of hacking is reuired to get the other features, I disagree.

      * I have my current mutt setup with 2 IMAPS accounts, one account using PGP/MIME to sign mail, and the other using S/MIME. All I had to do was source two files that my operating system shipped with the Mutt package.
      * I have Mutt taking care of HTML email with a single entry in my ~/.muttrc. I’m even minting Hashcash tokens and adding a header easter egg with 3 lines in the ~/.muttrc.
      * Notifications aren’t a big deal to me, as I also have my phone setup to receive the same two mail accounts, and it’s constantly beeping, notifying me of mail.

      I’m hard pressed to find another mail client that is setup as well as my Mutt, and all the config is under 50 of my own lines, and 100 total with the sourced files. I spend more times in GUI menus tweaking stuff than I do in Mutt. But, that’s just me.

      Mutt scared me at first as well, but after finally taking the leap, I’m hard pressed to use another mail client. Even on my phone.

  • [...] My fear of mutt, and why it was all for NULL mutt… For those of us that have been using linux for a long time, we’ve probably heard of mutt at least once or twice throughout our lives. And most of the things that go along with mutt are negatively centered around how much of a pain in the ass it is to configure. The awfully dreadful ~/.muttrc and all the confusion that is encompassed within. Well I fell woe to the same gossip of mutt for all the years, and have mostly stayed in my browser bubble; by using gmail in firefox, and being content. [...]

  • Benji Orozco says:

    I found this another patch (http://aur.archlinux.org/packages.php?ID=7168) Looks great, any way to merge it with the Trash patch?

  • Benji Orozco says:

    I’m getting a “Login failed” message after typing my password at:

    “Password for benoror@gmail.com@imap.gmail.com:”

    Any idea?

    • fsk141 says:

      I’m not a gigantic fan of ruby otherwise I’ve seen it before; If you try it lemme know how it works out for you.

    • I have a friend who is a big fan of Sup. I’ve tried it, and couldn’t get into it. The biggest problem is the lack of control server-side. It only reads mail locally, which means you need to rely on an external program for fetching the mail. So, you create your own local labels and filters to sort your local mail, something I want to keep 100% controlled on the server, and use my MUA as a dummy terminal.

      Also, the claim that Sup handles large volumes of mail is accurate, but then so does Mutt. I have one directory that contains over 45,000 emails, and changing to it pulls up in 2-3 seconds.

      The only thing I wish Mutt did better was search, but there are some awesome utilities that take care of that for you, that you can easily hook Mutt into, such as mairix(1).

Leave a Reply

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

*

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