Fetchmail is an MTA which retrieves email from remote servers and delivers it to the local MTA. Many users appreciate the ability to separate the process of downloading their messages located on a remote server from the process of reading and organizing their email in an MUA. Designed with the needs of dial-up users in mind, Fetchmail connects and quickly downloads all of the email messages to the mail spool file using any number of protocols, including POP3 and IMAP. It can even forward email messages to an SMTP server, if necessary.
Fetchmail is configured for each user through the use of a
.fetchmailrcfile in the user's home directory.
Using preferences in the
.fetchmailrcfile, Fetchmail checks for email on a remote server and downloads it. It then delivers it to port 25 on the local machine, using the local MTA to place the email in the correct user's spool file. If Procmail is available, it is launched to filter the email and place it in a mailbox so that it can be read by an MUA.
220.127.116.11. Fetchmail Configuration Options
Although it is possible to pass all necessary options on the command line to check for email on a remote server when executing Fetchmail, using a
.fetchmailrcfile is much easier. Place any desired configuration options in the
.fetchmailrcfile for those options to be used each time the
fetchmailcommand is issued. It is possible to override these at the time Fetchmail is run by specifying that option on the command line.
.fetchmailrcfile contains three classes of configuration options:
- global options — Gives Fetchmail instructions that control the operation of the program or provide settings for every connection that checks for email.
- server options — Specifies necessary information about the server being polled, such as the hostname, as well as preferences for specific email servers, such as the port to check or number of seconds to wait before timing out. These options affect every user using that server.
- user options — Contains information, such as username and password, necessary to authenticate and check for email using a specified email server.
Global options appear at the top of the
.fetchmailrcfile, followed by one or more server options, each of which designate a different email server that Fetchmail should check. User options follow server options for each user account checking that email server. Like server options, multiple user options may be specified for use with a particular server as well as to check multiple email accounts on the same server.
Server options are called into service in the
.fetchmailrcfile by the use of a special option verb,
skip, that precedes any of the server information. The
pollaction tells Fetchmail to use this server option when it is run, which checks for email using the specified user options. Any server options after a
skipaction, however, are not checked unless this server's hostname is specified when Fetchmail is invoked. The
skipoption is useful when testing configurations in
.fetchmailrcbecause it only checks skipped servers when specifically invoked, and does not affect any currently working configurations.
.fetchmailrcfile looks similar to the following example:
set postmaster "user1" set bouncemail poll pop.domain.com proto pop3 user 'user1' there with password 'secret' is user1 here poll mail.domain2.com user 'user5' there with password 'secret2' is user1 here user 'user7' there with password 'secret3' is user1 here
In this example, the global options specify that the user is sent email as a last resort (
postmasteroption) and all email errors are sent to the postmaster instead of the sender (
setaction tells Fetchmail that this line contains a global option. Then, two email servers are specified, one set to check using POP3, the other for trying various protocols to find one that works. Two users are checked using the second server option, but all email found for any user is sent to
user1's mail spool. This allows multiple mailboxes to be checked on multiple servers, while appearing in a single MUA inbox. Each user's specific information begins with the
Users are not required to place their password in the
.fetchmailrcfile. Omitting the
with password '<password>'section causes Fetchmail to ask for a password when it is launched.
Fetchmail has numerous global, server, and local options. Many of these options are rarely used or only apply to very specific situations. The
fetchmailman page explains each option in detail, but the most common ones are listed here.