logo
Jiff Slater
🤔 About
✍️ Contact
📚Knowledge
30 Jul 2021
These articles have been archived. You may find them useful but I am no longer offering support for them. Check out my latest articles on plkt.io.
Setting up IMAP on Mutt
18 October 2008

After receiving my HP 2710p, I decided to use IMAP instead of POP for
managing my email.  As you know, Mutt is my primary MUA (mail user agent).

The benefits of this setup are obvious: synchronous email (both on the computer
and on the webserver), space savings, and less programs to configure.

In this example, I’ll be setting up an IMAP connection to Gmail from Mutt.

First download the certificate of the organisation that is providing the IMAP
service.  Gmail uses “ThawtePremiumServerCA.crt”.  Make sure you compare your
checksum with the one provided by the Thawte Certificate Authority.  Place this
certificate in “~/.certs”.

Next, configure a profile for use with the IMAP connection.  I have an
engineering account with my university as well as a Gmail account, so I need two
profiles.  The Mutt profile is simple.

---~/.mutt/mutt1---
# email@gmail.com

source ~/.muttrc
set imap_user="email@gmail.com"
set folder="imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed=+"[Gmail]/Drafts"
set smtp_url="smtp://email@smtp.gmail.com:587/"
------

Note: My ~/.muttrc” contains global configuration values.

Next, simply add aliases for each profile that you create.  For example:

---~/.bashrc---
[ ... ]
alias mutt1="mutt -F ~/.mutt/muttrc_gmail"
alias mutt2="mutt -F ~/.mutt/muttrc_college"
------

To use your configuration, issue “mutt1” or “mutt2” at the prompt.