Home Mutt Tutorials - Part 1 - A Simple IMAP Setup
Post
Cancel

Mutt Tutorials - Part 1 - A Simple IMAP Setup

Mutt is small text-based email client that is also incredibly powerful in what it can do. As the creators so rightly say: ”All mail clients suck. This one just sucks less.” It can be a real pain to set up how you want, so I’m writing a set of tutorials to help those people out who are interested in trying.

In this tutorial, I will take you through a simple set up to connect to your email server and be able to read your emails. I will be taking you through setting up Mutt using IMAP that most e-mail providers support.


As some of you may know, I’m a huge fan of the Mutt e-mail client and using it to manage my email: in both Windows and Linux. It can be a little harder to get it working in Windows as you need to get and install Cygwin. I won’t describe that process here, but make sure during the install that you install mutt.

If you’re using a Unix-based operating system you should be able to easily get it from your package manager or by downloading the source code and compiling it yourself.

In order to use Mutt, you need to create a config file called .muttrc in your home directory. For Windows users, this will be inside the c:\cygwin\home\<user-name> folder or wherever you installed Cygwin.

Depending on how you want to set up your .muttrc config file, you can have between 3 and 5 settings. Open it up in your favourite text editor, and we shall get started. I’ll step through them line by line:

1
set mbox_type = Maildir

This line sets up the type of e-mail message box mutt will be reading; don’t worry about this line too much, just put it in there and move onto the next setting.

1
set folder = imaps://imap.gmail.com

This is an example of the line in one of my .muttrc config files. The set folder command will do just what it says on the tin: set the folder you will be reading from. Everything after imaps:// will have to be changed to the server of your choice, you will have to find the settings from your provider. The easiest way to find it is to search for something like ‘gmail imap settings’ on google.

There are a few things to note here:

  • If you don’t want a secure connection, replace the beginning of the URL with imap://
  • If you need to specify a port number, at the end put a : and then the port number afterwards e.g. imaps://imap.gmail.com:587
  • You can set your username here using the @ symbol e.g. imaps://USERNAME@imap.gmail.com. There is an clearer way of doing this though.
1
set imap_user = USERNAME

This one should be pretty obvious: this line is to set up your username. If you are using GMail, you will need to use your full gmail e-mail address e.g. example@gmail.com.

1
set imap_password = PASSWORD

Again, another obvious one: this is where you place your password if you want to. Bear in mind that this will leave your password in plain text on your hard drive, which is not recommended. If you don’t have a password when you open up Mutt, it will ask you for it. I shall talk about encryption in a later tutorial.

1
set spoolfile = "+INBOX"

Put simply: this line sets the first folder that Mutt will open, in most cases this will be the inbox. Just put it in exactly as it is.

A ‘+’ or ‘=’ symbol can be used to indicate to Mutt that it should use the folder that we set up before hand with the ‘set folder’ command. You don’t need to put it inside the “s unless you have a space in the name, but I tend to do it out of habit just in case.


And that should be it. You should now be able to open up mutt and read your emails. If you are a Cygwin user, just type mutt in the Cygwin terminal to open it. You will NOT be able to send emails at this stage; read my later tutorials to find out how to do this. Here are a few basic keys to get you started:

  • Arrow Keys: move up and down your e-mail list, even when you are reading an e-mail
  • Enter Key: read an e-mail
  • Page Up and Down: scroll up and down an email when you are reading an e-mail
  • i: Exit reading an email
  • d: Delete an email (GMail Users: This will not properly delete your e-mail, I will write a short tutorial specifically for GMail users about this and other things)
  • q: quit when you are in the e-mail list

If you have any questions or want to comment on anything to do with this tutorial: please leave a comment at the bottom of this post and I will respond to the best of my ability. Thank you for reading this tutorial and I hope to see you again soon!