Mail collection - Fetchmail program




Fetchmail is a program whose sole purpose is to collect mail through one of the common protocols for collecting mail from a remote mailbox. Once mail is collected it is handed to your local delivery agent. Sendmail is the most comprehensive of these.

Fetchmail can be obtained from http://www.tuxedo.org/~esr/fetchmail/.

Once fetchmail is compiled and installed, it needs a configuration file. Fetchmail will be run from cron by user root, so the configuration file should be placed in /root. It is called /root/.fetchmailrc. A complete sample file is included in the fetchmail distribution, but this must be trimmed down so that only the items relevant to your own setup are left.

This is what my own .fetchmailrc file says:

server mail.enterprise.net protocol pop3 username user password password
The file is fully explained by the fetchmail man page; this particular version says to get mail from mail.enterprise.net using protocol POP3 (which is what Enterprise uses). My username and password are supplied to enable the program to be authorised to collect the mail.

Because it contains a password, which must be kept secret, the configuration file must only be readable and writable by root; if it has any other permissions, fetchmail will refuse to use it.

In order to set up .fetchmailrc correctly, run these commands as superuser:

# vi /root/.fetchmailrc
(Edit in the appropriate entries for your setup.)
# chmod 600 /root/.fetchmailrc
# chown root /root/.fetchmailrc



Up to the Automatic mail collection and delivery page

Last updated on 6th July 2000 by Oliver Elphick