Well, my first entry. And about a tui mail application no less!
I've been looking for a while for a good email client after moving from KDE to Openbox, and I recently discovered Mutt. And I love it. It is intuitive and fast once you have it configured.
It took me some time to find some good resources on how to configure it properly with imap. But let's get into configuring.
Now there are several ways to configure Mutt, but here we'll focus on imap, with Mutt letting Gmail handle the outgoing mail, and let Mutt read the ingoing.
By the end of this post you should have a working mail account in Mutt. Well let's get into it.
By now I assume you have Mutt installed the following options: sasl, ssl, smtp, and imap. And you'll probably want to install urlview as well, but we'll get back to this in a bit.
But before we dive into the .muttrc, we need to create some directories and files:
mkdir -p ~/.mutt/cache
touch certificatesOnly create the certificates file if you're using ssl.
First I suggest we set the editor command:
set editor = 'emacs'As you've probably guessed, this is the editor in which you'll be writing new mails and replies. Exchange "emacs" with your favourite editor.
Now we all have people we mail with often, and people that should be in our addressbook, and fear not! We can add an addressbook!
Simply create the file .mutt-alias (it doesn't matter where you put it as we'll be directing .muttrc to it, I keep mine in my .mutt directory)
Now direct your .muttrc to the addressbook file
source /path/to/.mutt-alias
set alias_file = /path/to/.mutt-aliasYou add contacts with by pressing "a" in a message.
If you're subscribing to any mailing lists (or there are a group of people that you want to put together as one entity) then add this:
lists address [name]
subscribe address [list mail address]Repeat for each list.
And now to the configuring of the email accounts!
# Name, password and such
set from = "email-address"
set realname = "The name you want displayed"
set imap_user = "your username"
set imap_pass = "password"Time to look at the folders :-)
# Remote folders
set folder = "imap[s]://server:port"We tell Mutt that the folders it is to edit are. Furthermore the [s] option in imap is in case you need ssl/tls encryption for the server.
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
set record = imap[s]://server/SentThe spoolfile, is (as I understand it) your inbox.
I'm leaving the set postponed value with the +[Gmail] for example, this can be edited to +[Whatever domain]
Set record isn't strictly necessary, but I like it. If the domain hosting your email address doesn't save the outgoing messages, I'd recommend it. If it does save the outgoing messages, it's unnecessary really.
On to the local files (yes there are some of those as well ;-) )
# Local folders
set header_cache = ~/.mutt/cache/headersThe file for a cache of headers, users with "uncommon" characters in your language (read other than English) will need to look at this later.
set message_cachedir = ~/.mutt/cache/bodiesSurprise surprise, a cache for the message bodies
set certificate_file = ~/.mutt/certificatesThis is where the necessary certificates will be saved.
And finally configuring the outgoing mail
# Outgoing/SMTP
set smtp_url="smtp[s]://username@outgoingserver:port/"
set smtp_pass = "password"Now an option that I'm betting you want is
set move = no This prevents Mutt from moving the mails from your inbox.
Well, this is pretty straightforward. smtp url and password. The password isn't necessary, and if you prefer to type it in every time (more secure obviously) then just omit the line.
Now for all of those using a non-english keyboard, and have need to be able to see special characters you need to set the character set as well as make sure your LC_CTYPE is set correctly. In my .muttrc I have:
set charset=ISO-8859-1and setting LC_CTYPE is done by export LC_CTYPE="the proper setting" Mine is set to
LC_CTYPE=en_US.ISO_8859-1
So in my case I had to write:
export LC_CTYPE=en_US.ISO_8859-1We're almost done with .muttrc. To be able to view urls in your favourite browser you'll need urlview and you'll need to set a macro:
macro pager \cb 'urlview' 'Follow links with urlview'And just as importantly, the .mailcap file. Again it doesn't matter where it is, as we define the location in .muttrc. The .mailcap file contains the actions that need to be taken by Mutt with the different filetypes you might be mailed, but to begin with we'll just set the variable in .muttrc and return to the .mailcap file later.
set mailcap_path=/path/to/.mailcapWe're almost done with .muttrc, all that's missing are the looks. Mutt is highly configurable and for now I've gotten my colours from Linux Journal (link at the end)
I like having my messages set in threads when applicable, so of course I have:
et sort = threads
set sort_aux = 'last-date-received'and the sort_aux, simply the order, we want the newest mails first :-)
And now it's time to have a look at .mailcap file:
Here's my .mailcap file, it'll give you an idea on how it's set up, and a link should be enough to get you started:
text/html; lynx -dump %s | more
application/pdf; /usr/bin/xpdf %s
image/jpeg; /usr/bin/comix %s
image/gif; /usr/bin/comix %s
image/png; /usr/bin/comix %sThe only option that might be necessary to explain is the first. That's simply to have lynx convert html to plaintext.
Anyway, here are some links to get a further understanding. (Remember to read the MuttWiki and MuttGuide, there's a lot to pick up)
The Mutt GuideMutt WikiThe Mutt Manual"Power Up Your E-Mail with Mutt" - Linux JournalI'll be trying to set up Mutt with more than one imap account. It seems like a lot of the syntax is different, so I'll post a guide as soon as I have it working.
That's it for this time
Zeerak