Draconis Software Blog

Mail Retrieval with Fetchmail

Fetchmail is one of the core Linux applications that I use consistently — pretty much every email I get is passed through it before getting filtered, forwarded or backed up. It fills an important place in the email chain between the Mail Transfer Agent (or MTA) such as sendmail or qmail, and the Mail Delivery Agent (MDA) such as procmail (there’s also MUA and MSA — the architecture of email seems to demand MxA style acronyms). Fetchmail’s place in this chain is to retrieve emails from a mail server using protocols like POP3 and IMAP, and then deliver them to local or remote users with SMTP.

HowtoForge has a nice tutorial on getting setup with fetchmail. Fetchmail’s robust configuration system allows for a variety of setups. This allows for a number of uses:

  1. Consolidating Accounts - It’s common nowadays for a person to have many email addresses, such as work, ISP, school, as well as plenty of free accounts. With fetchmail you can check all of these accounts and forward them to a single address.
  2. Usage of text-based email clients - Since fetchmail can also deliver to a local account, it allows you to store all your email on a Linux machine and read it using a client like mutt, pine, elm and others. This means you can check your email from any computer just by SSHing to your machine.
  3. Integration with mail filters - It’s easy to have messages be filtered before local delivery or remote forwarding. The Linux filter I use is procmail although there are many others. For example, you may want to filter out emails from a mailing list into a separate boxes. It also allows you to benefit from a spam filter that integrates with the mail delivery agent.

My personal email setup is rather complicated but it fits my needs very well. First emails are retrieved from my various accounts using fetchmail, and delivered to my local account with over Qmail. Procmail then filters out any spam, forwards the remaining emails to a separate email account, and then does further filtering before delivering to local mailbox files. The reason for doing this is it allows my email to be stored and backed up on my Linux machine, and if from any computer to SSH in and read email with mutt. But when I’m on my own computer, I can check the secondary account with Thunderbird, which gives me the benefits of a graphical mail client. It’s these kinds of personalized setups that fetchmail (along with the rest of the MxA family) allows.

Share and Enjoy:
  • Digg
  • Reddit
  • Ma.gnolia
  • del.icio.us
  • BlogMemes
  • Facebook
  • Mixx
  • Furl
  • Google
  • TwitThis
  • Spurl
  • LinkedIn
  • Propeller
  • E-mail this story to a friend!