Mutt is a text-based mail client renowned for its powerful features. Mutt, though over a decade old, remains the mail client of choice for great number of power-users. Unfortunately, a default mutt install is plagued by complex keybindings, and a daunting amount of documentation. This guide will help the average user get mutt up and running, and begin customizing it to his/her taste.
What Mutt Does Not Do
Mutt is a Mail User Agent (MUA), and was written to view mail. It was not written to retrieve, send, or sort mail. It relies on external programs to do those tasks. For this wiki, we will be using getmail to retrieve our mail, procmail to sort our mail, and msmtp to send our mail.
First install getmail. It is in the
pacman -S getmail
Now create the directory
~/.getmail/. Open the file
~/.getmail/getmailrc in your favorite text editor.
Here is an example getmailrc used with a gmail account.
[retriever] type = SimplePOP3SSLRetriever server = pop.gmail.com username = firstname.lastname@example.org port = 995 password = password [destination] type = Maildir path = ~/mail
You can tweak this to your POP3 service's specification. Note: IMAP is not covered in this tutorial
Now, run getmail. If it works fine, you can create a cronjob for getmail to run every n hours/minutes. Type
crontab -e to edit cronjobs, and enter the following:
/30 * * * * /usr/bin/getmail
That will run
getmail every 30 minutes.
Procmail is an extremely powerful sorting tool. For the purposes of this wiki, we will do some primitive sorting to get started.
First, install procmail. It is in the
pacman -S procmail
Now, edit your getmailrc to pass retrieved mail to procmail.
[destination] type = MDA_external path = /usr/bin/procmail
Now, open up .procmailrc in your favorite editor. The following will sort all mail from the happy-kangaroos mailing list, and all mail from your lovey-dovey friend in their own maildirs.
MAILDIR=$HOME/mail DEFAULT=$MAILDIR/inbox/ LOGFILE=$MAILDIR/log :0 * ^TOhappyemail@example.com happy-kangaroos/ * ^FROMloveydovey@iheartyou.net lovey-dovey/
After you've saved your procmailrc, run getmail and see if procmail succeeds in sorting your mail into the appropriate directories.
Msmtp is a very simple and easy to use smtp client. It is in the
pacman -S msmtp
Open up ~/.msmtprc in your favorite editor. The following is an example of an msmtprc for a gmail account:
account default host smtp.gmail.com port 587 protocol smtp auth on from firstname.lastname@example.org user email@example.com password mypassword tls on tls_starttls on
Now mutt must be configured to use msmtp. Make a directory
~/.mutt/, and open up
~/.mutt/muttrc. The following should get you started viewing and sending mail.
set realname='Disgruntled Kangaroo' set sendmail="/usr/bin/msmtp" set edit_headers=yes set folder=~/mail set mbox=+mbox set spoolfile=+inbox set record=+sent set postponed=+drafts set mbox_type=Maildir mailboxes +inbox +lovey-dovey +happy-kangaroos
Now, startup mutt. You should see all the mail in
~/mail/inbox. Press m to compose mail (it will use the editor defined by your
EDITOR environment variable. If this variable is not set, type
export EDITOR=/path/to/yourfavorite/editor. For testing purposes, address the letter to yourself. After you have written the lovely letter, use your editor's save and exit command. You will return to mutt, which will show you information about your e-mail. Press y to send it. If everything works, congratulations! You can use mutt! However, do not be surprised if you find it underwhelming. Realizing the true power of mutt comes with much customizing, which brings us to our next section...