Configuring mutt, procmail, fetchmail, and exim to work with an ISP provided email account.
First there are several packages you will need on your system:
Exim is used to transfer you email to your ISP and can be configured by running the command
eximconf
This programs will ask you a series of questions. Choose number 2 to configure your email. You will want mostly the defaults. The questions are a bit confusing but most apply to local mail only. There are only two you have to be concerned with. When asked where want mail to go too will most likely be root. The main question that you want to answer is when it asks for which smtp smarthost you want to use. This is your ISP’s smtp server (ex. smtp.mailserver.com). This creates the file /etc/exim/exim.conf
To get it to work you must have the correct information in the From: line of outgoing mail. This is accomplished by editing the following like in /etc/email-addresses
user: someone@isp.com
For user you put your login name on the local computer. Not your ISP mail username. In place of someone@isp.com you enter your email address.
Fetchmail is used to retrieve email. It is extremely easy to set up. We will be using procmail to filter our email so there will be only two lines. This goes in a file ~/.fetchmailrc
poll smtp.isp.com proto pop3 username my_username password abc123
mda '/usr/bin/procmail -f fetchmail'
Just substiture your ISP’s smtp mail server, protocol (if yours is not pop3) and your mail username and password.
Procmail is a mail filtering agent. Useful for filtering mail from mailing lists to their own local email boxes.
First you will want to create email boxes. I use the directory ~/mail but you can substitite any directory you choose.
mkdir -p ~/mail/inbox/{cur,new,tmp}
mkdir -p ~/mail/sent/{cur,new,tmp}
mkdir -p ~/mail/postponed/{cur,new,tmp}
Do the above command for each needed mailbox.
Example ~/.procmailrc
MAILDIR=$HOME/mail/
LOGFILE=$HOME/.procmaillog
VERBOSE=no
#
# Mailing lists
#
# BLT
:0:
* ^TO_blt
blt/
#
# All other mail goes to inbox
:0:
inbox/
The first section sets the home directory to ~/mail and tells procmail where its log file is. It will create this file automatically.
Next is the mailing lists section. In the example here all mail that begins in the To: field with blt will be sent to the blt mail box. All other mail will be delivered to the inbox.
Finally! We get to the heart of the matter - the email program itself. Mutt is an easily configurable email client. All configurations are put in ~/.muttrc. Here, I will go over a few points of interest.
set realname="James Allen"
set from="jallen@starnetok.net"
Sets your real name and the from field in outgoing mail.
set mbox_type=maildir
set mbox="~/mail/inbox/"
set spoolfile="~/mail/inbox/"
set folder="~/mail/"
set record="~/mail/sent/"
set postpone=ask-yes recall=no postponed=~/mail/postponed/
Tells mutt where the local mailbox is, where to store sent mail and, if mail is not sent, asks if it is to be postponed and where to store the postponed mail.
Add an item for each additional mailbox that you created. As in the procmail example above.
# Add an item for each mailbox
mailboxes ~/mail/blt
Mutt needs to know about any mailing lists you are subscribed to for replying purposes.
# tell mutt about my mailing lists
subscribe blt
The ignore lines are so those lines do not have to be viewed when opened. If you open a message in mutt, you will notice quite a few headers. As in the example above, one of the headers will begin X-Authenticated: Just enter them up to the colon in an ignore directive line.
ignore X-Authenticated
Enter G while in mutt and fetchmail will retrieve email.
# for when you just can't wait for the cron job :)
# set up mutt so i can run fetchmail at any time by pressing G
macro index G "!fetchmail\n" "Invoke fetchmail"
macro pager G "!fetchmail\n" "Invoke fetchmail"
# simulate the old url menu
macro index \cb |urlview\n 'call urlview to extract URLs out of a message'
macro pager \cb |urlview\n 'call urlview to extract URLs out of a message'
If you installed urlview, pressing the key combination Ctrl-b will take you to a screen with all the links that the email contains. Setting can be stored in ~/.urlview or system wide in /etc/urlview/system.urlview The file calls the browser listed in the following /etc/urlview/url_handler.sh line
For individuals, in place of system wide configuration copy the /etc/urlview/sytem.urlview and /etc/urlview/url_hander.sh files to your home directory as ~/.urlview and ~/.url_handler.sh respectively.
In ~/.urlview change the following line
COMMAND /etc/urlview/url_handler.sh
to
COMMAND ~/.url_handler.sh
~/.urlview will contain the following line:
http_prgs="/usr/bin/x-www-browser:PW /usr/bin/www-browser:XT /usr/bin/galeon:PW
/usr/bin/konqueror:PW /usr/bin/mozilla:PW /usr/bin/lynx:XT /usr/bin/w3m:XT
/usr/bin/links:XT /usr/bin/X11/netscape:PW"
Edit so that your browser of choice is the first in the list.
Note: If you prefer opera or any other brower just add it.
:autocmd FileType mail :nmap :w:!aspell -e -c %:e
By default mutt uses vi as its editor. The above line should be added to ~/.vimrc Whenever in command mode, pressing F8 will bring up a spell checker.
Tip: If you place an asterisk (*) in place of mail, you can spell check any document.
Colors are configured in the following ~/.muttrc section:
# colors
color normal yellow black
color attachment brightyellow black
color hdrdefault cyan black
color indicator brightcyan blue
color markers brightred black
color quoted green black
color signature cyan black
color status brightcyan blue
color tilde blue black
color tree red black
color header brightgreen black ^From:
color header cyan black ^To:
color header cyan black ^Reply-To:
color header cyan black ^Cc:
color header brightcyan black ^Subject:
color body brightred black [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+
Of course, these are the colors I prefer. Edit to your choosing and have fun with Mutt!
Sample Configuration (.muttrc, etc.) Files
Email for the single user in Debian
– Created by James Allen
Copyright (c) by the authors.
Prior to editing, authors agreed to license their contributions by the terms of the GPL.
See our licensing page for details.
Linux® is a registered trademark of Linus Torvalds.