fetchmail configuration

Oohara Yuuma

oohara@libra.interq.or.jp

Revision History
Revision v0.2Fri, 5 Oct 2001Revised by: oohara
Revision v0.1Tue, 25 Sep 2001Revised by: oohara
This is the initial draft.

Table of Contents
1. What is fetchmail?
2. Assumptions
3. Editing the configuration file by hand
4. With fetchmailconf
5. Finding more info
6. (appendix) How to sniff your POP3 password

1. What is fetchmail?

fetchmail does what its name means --- it fetches mails from a remote machine.

If you want to receive an e-mail from the outside of your machine, you must have a running machine with internet connection when the sender sends it. This may be too expensive or simply impossible. With fetchmail you don't need 24-hour internet connection to receive e-mails.

An internet service provider (ISP) usually has a special server which receives and stores e-mails sent to you. fetchmail queries that server and downloads e-mails stored in it. Then you can read them on your machine.

fetchmail is not for a selective download. From fetchmail FAQ: [You can do spam filtering better with procmail or maildrop on the server side and (if you're the server sysadmin) sendmail.cf domain exclusions.] [fetchmail's job is transport, not policy, and I refuse to change it from doing one thing well to attempting many things badly. One of my objectives is to keep fetchmail simple so it stays reliable.]


2. Assumptions

This document assumes that:


3. Editing the configuration file by hand

On a Debian system, the upstream fetchmail distribution is divided into 2 packages:

so that you can use fetchmail without X Window System. Here we show how to configure fetchmail by editing the configuration file by hand. You don't need X Window System to configure fetchmail.

The configuration file for fetchmail is ".fetchmailrc" in your home directory. You must be careful when you edit it, because you write your password for the remote server in that file. If someone else can read the file, you are in a deep trouble. So make sure no one else can read it.

First make an empty file named ".fetchmailrc" in your home directory. The easiest way for it is to use the command "touch".
$ cd ~/
$ touch .fetchmailrc

Then change the permission of that file to 600 (that is, readable and writable only by the owner of the file).
$ chmod 600 .fetchmailrc

Now add these lines to the empty file.
poll SERVER with proto PROTOCOL
user REMOTE_USER there with password REMOTE_PASSWORD is LOCAL_USER here
You must replace all the capital-letter words with the real values.

  • SERVER is the name of server you use to receive e-mails.

  • PROTOCOL is the type of SERVER (for example, IMAP or POP3). If you don't know, use AUTO. POP3 is depreciated.

  • REMOTE_USER is the user name of the account you have on the SERVER.

  • REMOTE_PASSWORD is the password for REMOTE_USER.

  • LOCAL_USER is the user name of the account you have on your machine. Don't use "root".

You will have something like this:
poll pop.members.interq.or.jp with proto POP3
user me358881 there with password aaaaaaaa is oohara here

You can specify 2 more more servers. Foe example:
poll pop.members.interq.or.jp with proto POP3
user me358881 there with password aaaaaaaa is oohara here

poll pop.geocities.co.jp with proto POP3
user o_o_hara_yuuma there with password aaaaaaaa is oohara here

It's the time to run fetchmail.
$ fetchmail
You can use "-v" option to see what is going on.
$ fetchmail -v


4. With fetchmailconf

fetchmailconf is not for a minimalist, but it is useful. To use it, first install it (as root):
# apt-get install fetchmailconf
This will install X Window System, TCL/Tk and Python as well as fetchmailconf.

All you have to do is to run fetchmailconf
$ fetchmailconf
and fill in the box.


5. Finding more info

fetchmail comes with a very long manual page. To see it:
$ man fetchmail

fetchmail also has a FAQ, /usr/share/doc/fetchmail/FAQ.gz . It covers from the background to how to play with some brain-dead servers.

If you have a trouble, check the known bugs of fetchmail. The fetchmail home page may be useful. A bug in fetchmail can be a security hole.


6. (appendix) How to sniff your POP3 password

POP3 is depreciated because you can sniff your POP3 password if you have root privilege on your machine.

To sniff your POP3 password, use tcpdump. First install it.
# apt-get install tcpdump

Run tcpdump in this way (running tcpdump requires root privilege):
$ touch result
$ chmod 600 result
# tcpdump -w result
Replace "result" with your favorite file name.

Use fetchmail normally, and your POP3 password will be written to the file "result". The easiest (but not always correct) way to see it is to use the command "strings" in the package "binutils".
# apt-get install binutils
$ strings result
The output of "strings" may have a line like this:
PASS ********
This may be your POP3 password.