fetchmail - fetch mail from a POP, IMAP, ETRN, or ODMR-capable server


fetchmail [''option...''? [''mailserver...''? fetchmailconf


fetchmailconf has a blacklist of known-troublesome servers. Use it. Also, you must remember that fetchmail will discard mail if your MTA returns error codes 552 or 553, or any of the antispam error codes. The only way to avoid that is the keep fetchmail option. By default, codes 571, 550, 501 and 554 are in the antispam list. You have been warned.


fetchmail is a mail-retrieval and forwarding utility; it fetches mail from remote mailservers and forwards it to your local (client) machine's delivery system. You can then handle the retrieved mail using normal mail user agents such as mutt(1), elm(1)? or Mail(1). The fetchmail utility can be run in a daemon mode to repeatedly poll one or more systems at a specified interval.

The fetchmail program can gather mail from servers supporting any of the common mail-retrieval protocols: POP2, POP3, IMAP2bis, IMAP4, and IMAPrev1. It can also use the ESMTP ETRN extension and ODMR. (The RFCs describing all these protocols are listed at the end of this manual page.)

While fetchmail is primarily intended to be used over on-demand TCP/IP links (such as SLIP or PPP connections), it may also be useful as a message transfer agent for sites which refuse for security reasons to permit (sender-initiated) SMTP transactions with sendmail.

As each message is retrieved fetchmail normally delivers it via SMTP to port 25 on the machine it is running on (localhost), just as though it were being passed in over a normal TCP/IP link. The mail will then be delivered locally via your system's MDA (Mail Delivery Agent, usually sendmail(8) but your system may use a different one such as smail, mmdf, exim, or qmail). All the delivery-control mechanisms (such as .forward files) normally available through your system MDA and local delivery agents will therefore work.

If no port 25 listener is available, you must configure Debian fetchmail explicitly to use an MDA.

If the program fetchmailconf is available, it will assist you in setting up and editing a fetchmailrc configuration. It runs under X and requires that the language Python and the Tk toolkit be present on your system. If you are first setting up fetchmail for single-user mode, it is recommended that you use Novice mode. Expert mode provides complete control of fetchmail configuration, including the multidrop features. In either case, the `Autoprobe' button will tell you the most capable protocol a given mailserver supports, and warn you of potential problems with that server.


The behavior of fetchmail is controlled by command-line options and a run control file, /.fetchmailrc, the syntax of which we describe in a later section (this file is what the fetchmailconf program edits). Command-line options override /.fetchmailrc declarations.

Each server name that you specify following the options on the command line will be queried. If you don't specify any servers on the command line, each `poll' entry in your /.fetchmailrc file will be queried.

To facilitate the use of fetchmail in scripts and pipelines, it returns an appropriate exit code upon termination -- see EXIT CODES below.

The following options modify the behavior of fetchmail. It is seldom necessary to specify any of these once you have a working .fetchmailrc file set up.

Almost all options have a corresponding keyword which can be used to declare them in a fetchmailrc file.

Some special options are not covered here, but are documented instead in sections on AUTHENTICATION and DAEMON MODE which follow.

General Options

-V, --version

Displays the version information for your copy of fetchmail. No mail fetch is performed. Instead, for each server specified, all the option information that would be computed if fetchmail were connecting to that server is displayed. Any non-printables in passwords or other string names are shown as backslashed C-like escape sequences. This option is useful for verifying that your options are set the way you want them.

-c, --check

Return a status code to indicate whether there is mail waiting, without actually fetching or deleting mail (see EXIT CODES below). This option turns off daemon mode (in which it would be useless). It doesn't play well with queries to multiple sites, and doesn't work with ETRN or ODMR. It will return a false positive if you leave read but undeleted mail in your server mailbox and your fetch protocol can't tell kept messages from new ones. This means it will work with IMAP, not work with POP2, and may occasionally flake out under POP3.

-s, --silent

Silent mode. Suppresses all progress/status messages that are normally echoed to standard error during a fetch (but does not suppress actual error messages). The --verbose option overrides this.

-v, --verbose

Verbose mode. All control messages passed between fetchmail and the mailserver are echoed to stdout. Overrides --silent. Doubling this option (-v -v) causes extra diagnostic information to be printed.

Disposal Options

-a, --all

(Keyword: fetchall) Retrieve both old (seen) and new messages from the mailserver. The default is to fetch only messages the server has not marked seen. Under POP3, this option also forces the use of RETR rather than TOP. Note that POP2 retrieval behaves as though --all is always on (see RETRIEVAL FAILURE MODES below) and this option does not work with ETRN or ODMR.

-k, --keep

(Keyword: keep) Keep retrieved messages on the remote mailserver. Normally, messages are deleted from the folder on the mailserver after they have been retrieved. Specifying the keep option causes retrieved messages to remain in your folder on the mailserver. This option does not work with ETRN or ODMR.

-K, --nokeep

(Keyword: nokeep) Delete retrieved messages from the remote mailserver. This option forces retrieved mail to be deleted. It may be useful if you have specified a default of keep in your .fetchmailrc. This option is forced on with ETRN and ODMR.

-F, --flush

POP3/IMAP only. Delete old (previously retrieved) messages from the mailserver before retrieving new messages. This option does not work with ETRN or ODMR. Warning: if your local MTA hangs and fetchmail is aborted, the next time you run fetchmail, it will delete mail that was never delivered to you. What you probably want is the default setting: if you don't specify `-k', then fetchmail will automatically delete messages after successful delivery.

Protocol and Query Options

-p, --protocol

(Keyword: proto[col?) Specify the protocol to use when communicating with the remote mailserver. If no protocol is specified, the default is AUTO. proto may be one of the following:


Tries IMAP, POP3, and POP2 (skipping any of these for which support has not been compiled in).


Post Office Protocol 2


Post Office Protocol 3


Use POP3 with old-fashioned MD5-challenge authentication.


Use POP3 with RPOP authentication.


Use POP3 with Kerberos V4 authentication on port 1109.


Use POP3 with Demon Internet's SDPS extensions.


IMAP2bis, IMAP4, or IMAP4rev1 (fetchmail autodetects their capabilities).


Use the ESMTP ETRN option.


Use the the On-Demand Mail Relay ESMTP profile.

All these alternatives work in basically the same way (communicating with standard server daemons to fetch mail already delivered to a mailbox on the server) except ETRN and ODMR. The ETRN mode allows you to ask a compliant ESMTP server (such as BSD sendmail at release 8.8.0 or higher) to immediately open a sender-SMTP connection to your client machine and begin forwarding any items addressed to your client machine in the server's queue of undelivered mail. The ODMR mode requires an ODMR-capable server and works similarly to ETRN, except that it does not require the client machine to have a static DNS.

-U, --uidl

(Keyword: uidl) Force UIDL use (effective only with POP3). Force client-side tracking of `newness' of messages (UIDL stands for ``unique ID listing'' and is described in RFC1725). Use with `keep' to use a mailbox as a baby news drop for a group of users.

-P, --port

(Keyword: port) The port option permits you to specify a TCP/IP port to connect on. This option will seldom be necessary as all the supported protocols have well-established default port numbers.


(Keyword: principal) The principal option permits you to specify a service principal for mutual authentication. This is applicable to POP3 or IMAP with Kerberos authentication.

-t, --timeout

(Keyword: timeout) The timeout option allows you to set a server-nonresponse timeout in seconds. If a mailserver does not send a greeting message or respond to commands for the given number of seconds, fetchmail will hang up on it. Without such a timeout fetchmail might hang up indefinitely trying to fetch mail from a down host. This would be particularly annoying for a fetchmail running in background. There is a default timeout which fetchmail -V will report. If a given connection receives too many timeouts in succession, fetchmail will consider it wedged and stop retrying, the calkling user will be notified by email if this happens.


(Keyword: plugin) The plugin option allows you to use an external program to establish the TCP connection. This is useful if you want to use socks, SSL, ssh, or need some special firewalling setup. The program will be looked up in $PATH and can optionally be passed the hostname and port as arguments using


(Keyword: plugout) Identical to the plugin option above, but this one is used for the SMTP connections (which will probably not need it, so it has been separated from plugin).


(Keyword: folder[s?) Causes a specified non-default mail folder on the mailserver (or comma-separated list of folders) to be retrieved. The syntax of the folder name is server-dependent. This option is not available under POP3, ETRN, or ODMR.


(Keyword: tracepolls) Tell fetchail to poll trace information in the form `polling %s account %s' to the Received line it generates, where the %s parts are replaced by the user's remote name and the poll label (the Received header also normally includes the server's truename). This can be used to facilate mail filtering based on the account it is being received from.


(Keyword: ssl) Causes the connection to the mail server to be encrypted via SSL. Connect to the server using the specified base protocol over a connection secured by SSL. SSL support must be present at the server. If no port is specified, the connection is attempted to the well known port of the SSL version of the base protocol. This is generally a different port than the port used by the base protocol. For IMAP, this is port 143 for the clear protocol and port 993 for the SSL secured protocol.


(Keyword: sslcert) Specifies the file name of the client side public SSL certificate. Some SSL encrypted servers may require client side keys and certificates for authentication. In most cases, this is optional. This specifies the location of the public key certificate to be presented to the server at the time the SSL session is established. It is not required (but may be provided) if the server does not require it. Some servers may require it, some servers may request it but not require it, and some servers may not request it at all. It may be the same file as the private key (combined key and certificate file) but this is not recommended.


(Keyword: sslkey) Specifies the file name of the client side private SSL key. Some SSL encrypted servers may require client side keys and certificates for authentication. In most cases, this is optional. This specifies the location of the private key used to sign transactions with the server at the time the SSL session is established. It is not required (but may be provided) if the server does not require it. Some servers may require it, some servers may request it but not require it, and some servers may not request it at all. It may be the same file as the public key (combined key and certificate file) but this is not recommended. If a password is required to unlock the key, it will be prompted for at the time just prior to establishing the session to the server. This can cause some complications in daemon mode.


(Keyword: sslproto) Forces an ssl protocol. Possible values are `ssl2', `ssl3' and `tls1'. Try this if the default handshake does not work for your server.


(Keyword: sslcertck) Causes fetchmail to strictly check the server certificate against a set of local trusted certificates (see the sslcertpath option). If the server certificate is not signed by one of the trusted ones (directly or indirectly), the SSL connection will fail. This checking should prevent man-in-the-middle attacks against the SSL connection. Note that CRLs are seemingly not currently supported by OpenSSL in certificate verification! Your system clock should be reasonably accurate when using this option!


(Keyword: sslcertpath) Sets the directory fetchmail uses to look up local certificates. The default is your OpenSSL default one. The directory must be hashed as OpenSSL expects it - every time you add or modify a certificate in the directory, you need to use the c_rehash tool (which comes with OpenSSL in the tools/ subdirectory).


(Keyword: sslfingerprint) Specify the fingerprint of the server key (an MD5 hash of the key) in hexadecimal notation with colons separating groups of two digits. The letter hex digits must be in upper case. This is the default format OpenSSL uses, and the one fetchmail uses to report the fingerprint when an SSL connection is established. When this is specified, fetchmail will compare the server key fingerprint with the given one, and the connection will fail if they do not match. This can be used to prevent man-in-the-middle attacks.

Delivery Control Options


(Keyword: smtp[host?) Specify a hunt list of hosts to forward mail to (one or more hostnames, comma-separated). Hosts are tried in list order; the first one that is up becomes the forwarding target for the current run. Normally, `localhost' is added to the end of the list as an invisible default. However, when using Kerberos authentication, the FQDN of the machine running fetchmail is added to the end of the list as an invisible default. Each hostname may have a port number following the host name. The port number is separated from the host name by a slash; the default port is 25 (or ``smtp'' under IPv6). If you specify an absolute pathname (beginning with a /), it will be interpreted as the name of a UNIX socket accepting LMTP connections (such as is supported by the Cyrus IMAP daemon) Example:

--smtphost server1,server2/2525,server3,/var/imap/socket/lmtp

This option can be used with ODMR, and will make fetchmail a relay between the ODMR server and SMTP or LMTP receiver.


(Keyword: fetchdomains) In ETRN or ODMR mode, this option specifies the list of domains the server should ship mail for once the connection is turned around. The default is the FQDN of the machine running fetchmail.


(Keyword: smtpaddress) Specify the domain to be appended to addresses in RCPT TO lines shipped to SMTP. The name of the SMTP server (as specified by --smtphost, or defaulted to


(Keyword: smtpname) Specify the domain and user to be put in RCPT TO lines shipped to SMTP. The default user is the current local user.


(Keyword: antispam) Specifies the list of numeric SMTP errors that are to be interpreted as a spam-block response from the listener. A value of -1 disables this option. For the command-line option, the list values should be comma-separated.


(Keyword: mda) You can force mail to be passed to an MDA directly (rather than forwarded to port 25) with the -mda or

  • m option. To avoid losing mail, use this option only with

MDAs like procmail or sendmail that return a nonzero status on disk-full and other resource-exhaustion errors; the nonzero status tells fetchmail that delivery failed and prevents the message from being deleted off the server. If fetchmail is running as root, it sets its userid to that of the target user while delivering mail through an MDA. Some possible MDAs are not use an MDA invocation like ''


(Keyword: lmtp) Cause delivery via LMTP (Local Mail Transfer Protocol). A service port must be explicitly specified (with a slash suffix) on each host in the smtphost hunt list if this option is selected; the default port 25 will (in accordance with RFC 2033) not be accepted.


(keyword: bsmtp) Append fetched mail to a BSMTP file. This simply contains the SMTP commands that would normally be generated by fetchmail when passing mail to an SMTP listener daemon. An argument of `-' causes the mail to be written to standard output. Note that fetchmail's reconstruction of MAIL FROM and RCPT TO lines is not guaranteed correct; the caveats discussed under THE USE AND ABUSE OF MULTIDROP MAILBOXES below apply.

Resource Limit Control Options


(Keyword: limit) Takes a maximum octet size argument. Messages larger than this size will not be fetched and will be left on the server (in foreground sessions, the progress messages will note that they are


(Keyword: warnings) Takes an interval in seconds. When you call fetchmail with a `limit' option in daemon mode, this controls the interval at which warnings about oversized messages are mailed to the calling user (or the user specified by the `postmaster' option). One such notification is always mailed at the end of the the first poll that the oversized message is detected. Thereafter, renotification is suppressed until after the warning interval elapses (it will take place at the end of the first following poll).


(Keyword: batchlimit) Specify the maximum number of messages that will be shipped to an SMTP listener before the connection is deliberately torn down and rebuilt (defaults to 0, meaning no limit). An explicit --batchlimit of 0 overrides any limits set in your run control file. While sendmail(8) normally initiates delivery of a message immediately after receiving the message terminator, some SMTP listeners are not so prompt. MTAs like qmail(8)? and smail(8)? may wait till the delivery socket is shut down to deliver. This may produce annoying delays when fetchmail is processing very large batches. Setting the batch limit to some nonzero size will prevent these delays. This option does not work with ETRN or ODMR.


(Keyword: fetchlimit) Limit the number of messages accepted from a given server in a single poll. By default there is no limit. An explicit --fetchlimit of 0 overrides any limits set in your run control file. This option does not work with ETRN or ODMR.


(keyword: expunge) Arrange for deletions to be made final after a given number of messages. Under POP2 or POP3, fetchmail cannot make deletions final without sending QUIT and ending the session -- with this option on, fetchmail will break a long mail retrieval session into multiple subsessions, sending QUIT after each sub-session. This is a good defense against line drops on POP3 servers that do not do the equivalent of a QUIT on hangup. Under IMAP, fetchmail normally issues an EXPUNGE command after each deletion in order to force the deletion to be done immediately. This is safest when your connection to the server is flaky and expensive, as it avoids resending duplicate mail after a line hit. However, on large mailboxes the overhead of re-indexing after every message can slam the server pretty hard, so if your connection is reliable it is good to do expunges less frequently. Also note that some servers enforce a delay of a few seconds after each quit, so fetchmail may not be able to get back in immediately after an expunge -- you may see fetchmail to only issue expunges on every Nth delete. An argument of zero suppresses expunges entirely (so no expunges at all will be done until the end of run). This option does not work with ETRN or ODMR.

Authentication Options


(Keyword: user[name?) Specifies the user identification to be used when logging in to the mailserver. The appropriate user identification is both server and user-dependent. The default is your login name on the client machine that is running fetchmail. See USER AUTHENTICATION below for a complete description.


(Keyword: interface) Require that a specific interface device be up and have a specific local or remote IP address (or range) before polling. Frequently fetchmail is used over a transient point-to-point TCP/IP link established directly to a mailserver via SLIP or PPP. That is a relatively secure channel. But when other TCP/IP routes to the mailserver exist (e.g. when the link is connected to an alternate ISP), your username and password may be vulnerable to snooping (especially when daemon mode automatically polls for mail, shipping a clear password over the net at predictable intervals). The --interface option may be used to prevent this. When the specified link is not up or is not connected to a matching IP address, polling will be skipped. The format is:


The field before the first slash is the interface name (i.e. sl0, ppp0 etc.). The field before the second slash is the acceptable IP address. The field after the second slash is a mask which specifies a range of IP addresses to accept. If no mask is present is assumed (i.e. an exact match). This option is currently only supported under Linux and FreeBSD. Please see the monitor section for below for FreeBSD specific information.


(Keyword: monitor) Daemon mode can cause transient links which are automatically taken down after a period of inactivity (e.g. PPP links) to remain up indefinitely. This option identifies a system TCP/IP interface to be monitored for activity. After each poll interval, if the link is up but no other activity has occurred on the link, then the poll will be skipped. However, when fetchmail is woken up by a signal, the monitor check is skipped and the poll goes through unconditionally. This option is currently only supported under Linux and FreeBSD. For the monitor and interface options to work for non root users under FreeBSD, the fetchmail binary must be installed SGID kmem. This would be a security hole, but fetchmail runs with the effective GID set to that of the kmem group only when interface data is being collected.


(Keyword: auth[enticate?) This option permits you to specify an authentication type (see USER AUTHENTICATION below for details). The possible values are any, `password', `kerberos_v5' and `kerberos' (or, for excruciating exactness, `kerberos_v4'), gssapi, cram-md5, otp, ntlm, and ssh. When any (the default) is specified, fetchmail tries first methods that don't require a password (GSSAPI, KERBEROS_IV); then it looks for methods that mask your password (CRAM-MD5, X-OTP, NTLM); and only if the server doesn't support any of those will it ship your password en clair. Other values may be used to force various authentication methods (ssh suppresses authentication). Any value other than password, cram-md5, ntlm or otp suppresses fetchmail's normal inquiry for a password. Specify ssh when you are using an end-to-end secure connection such as an ssh tunnel; specify gssapi or kerberos_v4 if you are using a protocol variant that employs GSSAPI or K4. Choosing KPOP protocol automatically selects Kerberos authentication. This option does not work with ETRN.

Miscellaneous Options


Specify a non-default name for the /.fetchmailrc run control file. The pathname argument must be either ''


(Keyword: idfile) Specify an alternate name for the .fetchids file used to save POP3 UIDs.

-n, --norewrite

(Keyword: no rewrite) Normally, fetchmail edits RFC-822 address headers (To, From, Cc, Bcc, and Reply-To) in fetched mail so that any mail IDs local to the server are expanded to full addresses (@ and the mailserver hostname are appended). This enables replies on the client to get addressed correctly (otherwise your mailer might think they should be addressed to local users on the client machine!). This option disables the rewrite. (This option is provided to pacify people who are paranoid about having an MTA edit mail headers and want to know they can prevent it, but it is generally not a good idea to actually turn off rewrite.) When using ETRN or ODMR, the rewrite option is ineffective.


(Keyword: envelope) This option changes the header fetchmail assumes will carry a copy of the mail's envelope address. Normally this is `X-Envelope-To' but as this header is not standard, practice varies. See the discussion of multidrop address handling below. As a special case, `envelope .fetchmailrc file.


(Keyword: qvirtual) The string prefix assigned to this option will be removed from the user name found in the header specified with the envelope option (before doing multidrop name mapping or localdomain checking, if either is applicable). This option is useful if you are using fetchmail to collect the mail for an entire domain and your ISP (or your mail redirection provider) is using qmail. One of the basic features of qmail is the


message header. Whenever qmail delivers a message to a local mailbox it puts the username and hostname of the envelope recipient on this line. The major reason for this is to prevent mail loops. To set up qmail to batch mail for a disconnected site the ISP-mailhost will have normally put that site in its `Virtualhosts' control file so it will add a prefix to all mail addresses for this site. This results in mail sent to '' having a `Delivered-To:' line of the form:


The ISP can make the 'mbox-userstr-' prefix anything they choose but a string matching the user host name is likely. By using the option `envelope Delivered-To:' you can make fetchmail reliably identify the original envelope recipient, but you have to strip the `mbox-userstr-' prefix to deliver to the correct user. This is what this option is for.


Parse the /.fetchmailrc file, interpret any command-line options specified, and dump a configuration report to standard output. The configuration report is a data structure assignment in the language Python. This option is meant to be used with an interactive /.fetchmailrc editor like fetchmailconf, written in Python.


All modes except ETRN require authentication of the client to the server. Normal user authentication in fetchmail is very much like the authentication mechanism of ftp(1). The correct user-id and password depend upon the underlying security system at the mailserver.

If the mailserver is a Unix machine on which you have an ordinary user account, your regular login name and password are used with fetchmail. If you use the same login name on both the server and the client machines, you needn't worry about specifying a user-id with the -u option -- the default behavior is to use your login name on the client machine as the user-id on the server machine. If you use a different login name on the server machine, specify that login name with the -u option. e.g. if your login name is 'jsmith' on a machine named 'mailgrunt', you would start fetchmail as follows:

fetchmail -u jsmith mailgrunt

The default behavior of fetchmail is to prompt you for your mailserver password before the connection is established. This is the safest way to use fetchmail and ensures that your password will not be compromised. You may also specify your password in your /.fetchmailrc file. This is convenient when using fetchmail in daemon mode or with scripts.

If you do not specify a password, and fetchmail cannot extract one from your /.fetchmailrc file, it will look for a /.netrc file in your home directory before requesting one interactively; if an entry matching the mailserver is found in that file, the password will be used. Fetchmail first looks for a match on poll name; if it finds none, it checks for a match on via name. See the ftp(1) man page for details of the syntax of the /.netrc file. (This feature may allow you to avoid duplicating password information in more than one file.)

On mailservers that do not provide ordinary user accounts, your user-id and password are usually assigned by the server administrator when you apply for a mailbox on the server. Contact your server administrator if you don't know the correct user-id and password for your mailbox account.

Early versions of POP3 (RFC1081, RFC1225) supported a crude form of independent authentication using the rhosts file on the mailserver side. Under this RPOP variant, a fixed per-user ID equivalent to a password was sent in clear over a link to a reserved port, with the command RPOP rather than PASS to alert the server that it should do special checking. RPOP is supported by fetchmail (you can specify `protocol RPOP' to have the program send `RPOP' rather than `PASS') but its use is strongly discouraged. This facility was vulnerable to spoofing and was withdrawn in RFC1460.

RFC1460 introduced APOP authentication. In this variant of POP3, you register an APOP password on your server host (the program to do this with on the server is probably called popauth(8)?). You put the same password in your /.fetchmailrc file. Each time fetchmail logs in, it sends a cryptographically secure hash of your password and the server greeting time to the server, which can verify it by checking its authorization database.

If your fetchmail was built with Kerberos support and you specify Kerberos authentication (either with --auth or the .fetchmailrc option authenticate kerberos_v4) it will try to get a Kerberos ticket from the mailserver at the start of each query. Note: if either the pollnane or via name is `hesiod', fetchmail will try to use Hesiod to look up the mailserver.

If you use POP3 or IMAP with GSSAPI authentication, fetchmail will expect the server to have RFC1731- or RFC1734-conformant GSSAPI capability, and will use it. Currently this has only been tested over Kerberos V, so you're expected to already have a ticket-granting ticket. You may pass a username different from your principal name using the standard --user command or by the .fetchmailrc option user.

If your IMAP daemon returns the PREAUTH response in its greeting line, fetchmail will notice this and skip the normal authentication step. This can be useful, e.g. if you start imapd explicitly using ssh. In this case you can declare the authentication value `ssh' on that site entry to stop .fetchmail from asking you for a password when it starts up.

If you are using POP3, and the server issues a one-time-password challenge conforming to RFC1938, fetchmail will use your password as a pass phrase to generate the required response. This avoids sending secrets over the net unencrypted.

Compuserve's RPA authentication (similar to APOP) is supported. If you compile in the support, fetchmail will try to perform an RPA pass-phrase authentication instead of sending over the password en clair if it detects ''

If you are using IMAP, Microsoft's NTLM authentication (used by Microsoft Exchange) is supported. If you compile in the support, fetchmail will try to perform an NTLM authentication (instead of sending over the password en clair) whenever the server returns AUTH=NTLM in its capability response. Specify a user option value that looks like `user@domain': the part to the left of the @ will be passed as the username and the part to the right as the NTLM domain.

If you are using IPsec, the -T (--netsec) option can be used to pass an IP security request to be used when outgoing IP connections are initialized. You can also do this using the `netsec' server option in the .fetchmailrc file. In either case, the option value is a string in the format accepted by the net_security_strtorequest() function of the inet6_apps library.

You can access SSL encrypted services by specifying the --ssl option. You can also do this using the

When connecting to an SSL encrypted server, the server presents a certificate to the client for validation. The certificate is checked to verify that the common name in the certificate matches the name of the server being contacted and that the effective and expiration dates in the certificate indicate that it is currently valid. If any of these checks fail, a warning message is printed, but the connection continues. The server certificate does not need to be signed by any specific Certifying Authority and may be a

Some SSL encrypted servers may request a client side certificate. A client side public SSL certificate and private SSL key may be specified. If requested by the server, the client certificate is sent to the server for validation. Some servers may require a valid client certificate and may refuse connections if a certificate is not provided or if the certificate is not valid. Some servers may require client side certificates be signed by a recognized Certifying Authority. The format for the key files and the certificate files is that required by the underlying SSL libraries (OpenSSL in the general case).

A word of care about the use of SSL: While above mentioned setup with self-signed server certificates retrieved over the wires can protect you from a passive eavesdropper it doesn't help against an active attacker. It's clearly an improvement over sending the passwords in clear but you should be aware that a man-in-the-middle attack is trivially possible (in particular with tools such as dsniff, Use of an ssh tunnel (see below for some examples) is preferable if you care seriously about the security of your mailbox.

fetchmail also supports authentication to the ESMTP server on the client side according to RFC 2554. You can specify a name/password pair to be used with the keywords `esmtpname' and `esmtppassword'; the former defaults to the username of the calling user.


The --daemon or -d option runs fetchmail in daemon mode. You must specify a numeric argument which is a polling interval in seconds.

In daemon mode, fetchmail puts itself in background and runs forever, querying each specified host and then sleeping for the given polling interval.

Simply invoking

fetchmail -d 900

will, therefore, poll all the hosts described in your /.fetchmailrc file (except those explicitly excluded with the `skip' verb) once every fifteen minutes.

It is possible to set a polling interval in your /.fetchmailrc file by saying `set daemon ''

Only one daemon process is permitted per user; in daemon mode, fetchmail makes a per-user lockfile to guarantee this.

Normally, calling fetchmail with a daemon in the background sends a wakeup signal to the daemon, forcing it to poll mailservers immediately. (The wakeup signal is SIGHUP if fetchmail is running as root, SIGUSR1 otherwise.) The wakeup action also clears any `wedged' flags indicating that connections have wedged due to failed authentication or multiple timeouts.

The option --quit will kill a running daemon process instead of waking it up (if there is no such process, fetchmail notifies you). If the --quit option is the only command-line option, that's all there is to it.

The quit option may also be mixed with other command-line options; its effect is to kill any running daemon before doing what the other options specify in combination with the rc file.

The -L or --logfile option (keyword: set logfile) allows you to redirect status messages emitted while detached into a specified logfile (follow the option with the logfile name). The logfile is opened for append, so previous messages aren't deleted. This is primarily useful for debugging configurations.

The --syslog option (keyword: set syslog) allows you to redirect status and error messages emitted to the syslog(3) system daemon if available. Messages are logged with an id of fetchmail, the facility LOG_MAIL, and priorities LOG_ERR, LOG_ALERT or LOG_INFO. This option is intended for logging status and error messages which indicate the status of the daemon and the results while fetching mail from the server(s). Error messages for command line options and parsing the .fetchmailrc file are still written to stderr, or to the specified log file. The --nosyslog option turns off use of syslog(3), assuming it's turned on in the /.fetchmailrc file, or that the -L or --logfile option was used.

The -N or --nodetach option suppresses backgrounding and detachment of the daemon process from its control terminal. This is primarily useful for debugging. Note that this also causes the logfile option to be ignored (though perhaps it shouldn't).

Note that while running in daemon mode polling a POP2 or IMAP2bis server, transient errors (such as DNS failures or sendmail delivery refusals) may force the fetchall option on for the duration of the next polling cycle. This is a robustness feature. It means that if a message is fetched (and thus marked seen by the mailserver) but not delivered locally due to some transient error, it will be re-fetched during the next poll cycle. (The IMAP logic doesn't delete messages until they're delivered, so this problem does not arise.)

If you touch or change the /.fetchmailrc file while fetchmail is running in daemon mode, this will be detected at the beginning of the next poll cycle. When a changed /.fetchmailrc is detected, fetchmail rereads it and restarts from scratch (using exec(2)?; no state information is retained in the new instance). Note also that if you break the /.fetchmailrc file's syntax, the new instance will softly and silently vanish away on startup.


The --postmaster option (keyword: set postmaster) specifies the last-resort username to which multidrop mail is to be forwarded if no matching local recipient can be found. Normally this is just the user who invoked fetchmail. If the invoking user is root, then the default of this option is the user `postmaster'. Setting postmaster to the empty string causes such mail to be discarded.

The --nobounce option suppresses the normal action of bouncing errors back to the sender in an RFC1894-conformant error message. If nobounce is on, the message will go to the postmaster instead.

The --invisible option (keyword: set invisible) tries to make fetchmail invisible. Normally, fetchmail behaves like any other MTA would -- it generates a Received header into each message describing its place in the chain of transmission, and tells the MTA it forwards to that the mail came from the machine fetchmail itself is running on. If the invisible option is on, the Received header is suppressed and fetchmail tries to spoof the MTA it forwards to into thinking it came directly from the mailserver host.

The --showdots option (keyword: set showdots) forces fetchmail to show progress dots even if the current tty is not stdout (for example logfiles). Starting with fetchmail version 5.3.0, progress dots are only shown on stdout by default.

By specifying the --tracepolls option, you can ask fetchmail to add information to the Received header on the form __.fetchmailrc'', this is called `tracepolls'.


The protocols fetchmail uses to talk to mailservers are next to bulletproof. In normal operation forwarding to port 25, no message is ever deleted (or even marked for deletion) on the host until the SMTP listener on the client side has acknowledged to fetchmail that the message has been either accepted for delivery or rejected due to a spam block.

When forwarding to an MDA, however, there is more possibility of error. Some MDAs are `safe' and reliably return a nonzero status on any delivery error, even one due to temporary resource limits. The well-known procmail(1) program is like this; so are most programs designed as mail transport agents, such as sendmail(1)?, and exim(1)?. These programs give back a reliable positive acknowledgement and can be used with the mda option with no risk of mail loss. Unsafe MDAs, though, may return 0 even on delivery failure. If this happens, you will lose mail.

The normal mode of fetchmail is to try to download only `new' messages, leaving untouched (and undeleted) messages you have already read directly on the server (or fetched with a previous fetchmail --keep). But you may find that messages you've already read on the server are being fetched (and deleted) even when you don't specify --all. There are several reasons this can happen.

One could be that you're using POP2. The POP2 protocol includes no representation of `new' or `old' state in messages, so fetchmail must treat all messages as new all the time. But POP2 is obsolete, so this is unlikely.

Under POP3, blame RFC1725. That version of the POP3 protocol specification removed the LAST command, and some POP servers follow it (you can verify this by invoking ''fetchmail

  • v'' to the mailserver and watching the response to LAST

early in the query). The fetchmail code tries to compensate by using POP3's UID feature, storing the identifiers of messages seen in each session until the next session, in the .fetchids file. But this doesn't track messages seen with other clients, or read directly with a mailer on the host but not deleted afterward. A better solution would be to switch to IMAP.

Another potential POP3 problem might be servers that insert messages in the middle of mailboxes (some VMS implementations of mail are rumored to do this). The fetchmail code assumes that new messages are appended to the end of the mailbox; when this is not true it may treat some old messages as new and vice versa. The only real fix for this problem is to switch to IMAP.

Yet another POP3 problem is that if they can't make tempfiles in the user's home directory, some POP3 servers will hand back an undocumented response that causes fetchmail to spuriously report

The IMAP code uses the presence or absence of the server flag Seen to decide whether or not a message is new. Under Unix, it counts on your IMAP server to notice the BSD-style Status flags set by mail user agents and set the Seen flag from them when appropriate. All Unix IMAP servers we know of do this, though it's not specified by the IMAP RFCs. If you ever trip over a server that doesn't, the symptom will be that messages you have already read on your host will look new to the server. In this (unlikely) case, only messages you fetched with fetchmail --keep will be both undeleted and marked old.

In ETRN and ODMR modes, fetchmail does not actually retrieve messages; instead, it asks the server's SMTP listener to start a queue flush to the client via SMTP. Therefore it sends only undelivered messages.


Many SMTP listeners allow administrators to set up `spam filters' that block unsolicited email from specified domains. A MAIL FROM or DATA line that triggers this feature will elicit an SMTP response which (unfortunately) varies according to the listener.

Newer versions of sendmail return an error code of 571. This return value is blessed by RFC1893 as ''

According to current drafts of the replacement for RFC821, the correct thing to return in this situation is 550

The exim MTA returns 501 ''

The postfix MTA runs 554 as an antispam response.

The fetchmail code recognizes and discards the message on any of a list of responses that defaults to

Fatal Error:

lib/CachedMarkup.php (In template 'browse' < 'body' < 'html'):257: Error: Pure virtual

Fatal PhpWiki Error

lib/CachedMarkup.php (In template 'browse' < 'body' < 'html'):257: Error: Pure virtual