oohara@libra.interq.or.jp
Copyright © 2001 by Oohara Yuuma.
Revision History | ||
---|---|---|
Revision v0.2 | Fri, 5 Oct 2001 | Revised by: oohara |
Revision v0.1 | Tue, 25 Sep 2001 | Revised by: oohara |
This is the initial draft. |
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.]
This document assumes that:
you have only one machine.
you can use a remote server which receives e-mails sent to you.
you have installed fetchmail. To install fetchmail, do as root:
# apt-get install fetchmail |
you have a running Simple Mail Transfer Protocol (SMTP) server on your machine. You must have it if you want to read e-mails on your machine. fetchmail doesn't Depends: on mail-transport-agent (a virtual package for a SMTP server) only because you can use fetchmail to move e-mails from one remote machine to another remote machine.
If you don't have a SMTP server, try Exim.
# apt-get install exim |
On a Debian system, the upstream fetchmail distribution is divided into 2 packages:
fetchmail, which includes the command "fetchmail" (this works without X Window System)
fetchmailconf, a Graphical User Interface (GUI) tool 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 |
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 |
$ fetchmail -v |
fetchmailconf is not for a minimalist, but it is useful. To use it, first install it (as root):
# apt-get install fetchmailconf |
All you have to do is to run fetchmailconf
$ fetchmailconf |
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.
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 |
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 |
PASS ******** |