Linux comes with numerous e-mail clients including Kmail,
Evolution, and Thunderbird. For most users these are sufficient, but for others
with more esoteric needs, text-based e-mail clients may be preferred. Clients
such as mutt and pine are often best served when having a dedicated e-mail downloader,
or spooler, to do the downloading for them.

One piece of the puzzle is fetchmail. Fetchmail is a program
that downloads e-mail, and nothing else. It can download POP3 and IMAP messages,
over SSL or not, and it spools the mail it downloads to the system SMTP server
or another local MDA (Mail Delivery Agent) such as procmail.

Even for servers, the use of fetchmail may be desired. If you
typically use IMAP on one server but have multiple accounts, instead of
connecting to each separately, you can have fetchmail running on the server to
download mail from your other accounts and deliver them to the system SMTP
server for delivery to your IMAP inbox.

Tips in your inbox

Delivered each Tuesday, TechRepublic’s free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills.

Automatically sign up today!

Fetchmail is extremely easy to use. The first step is to
create a local configuration file such as ~/.fetchmailrc.
This file must be mode 0600 (or read/write by the user only) as it will contain
sensitive information like your passwords. A simple .fetchmailrc may look like:

poll protocol pop3 user "joe" password "bar2"

This tells fetchmail to poll the server using
POP3 with the username being “joe” and the password being
“bar2”. As fetchmail downloads messages, it will deliver them to the
system SMTP server. If you wish to use procmail instead, you would use:

poll protocol pop3 user "joe" password "bar2" mda
"/usr/bin/procmail -d %T"

You can have as many poll lines in the configuration file as
you like. For a test run, run fetchmail like so:

$ fetchmail -v

Fetchmail will give you a play-by-play of the downloaded
messages. Check the fetchmail manpage
for more configuration items for IMAP, SSL, and other options you can use.