2 .\" ** The above line should force tbl to be used as a preprocessor **
4 .\" Man page for fetchmail
6 .\" For license terms, see the file COPYING in this directory.
9 fetchmail \- fetch mail from a POP, IMAP, or ETRN-capable server
12 \fBfetchmail\fR [\fIoptions\fR] [\fImailserver...\fR]
18 is a mail-retrieval and forwarding utility; it fetches
19 mail from remote mailservers and forwards it to your local (client)
20 machine's delivery system. You can then handle the retrieved mail
21 using normal mail user agents such as \fIelm\fR(1) or \fIMail\fR(1).
22 The \fBfetchmail\fR utility can be run in a daemon mode to repeatedly
23 poll one or more systems at a specified interval.
27 program can gather mail from servers supporting any of the common
28 mail-retrieval protocols: POP2, POP3, IMAP2bis, IMAP4, and IMAPrev1.
29 It can also use the ESMTP ETRN extension. (The RFCs describing all
30 these protocols are listed at the end of this manual page.)
34 is primarily intended to be used over on-demand TCP/IP links (such as
35 SLIP or PPP connections), it may also be useful as a message transfer
36 agent for sites which refuse for security reasons to permit
37 (sender-initiated) SMTP transactions with sendmail.
39 As each message is retrieved \fIfetchmail\fR normally delivers it via SMTP to
40 port 25 on the machine it is running on (localhost), just as though it
41 were being passed in over a normal TCP/IP link. The mail will then be
42 delivered locally via your system's MDA (Mail Delivery Agent, usually
43 \fIsendmail\fR(8) but your system may use a different one such
44 as \fIsmail\fR, \fImmdf\fR, \fIexim\fR, or \fIqmail\fR). All the
45 delivery-control mechanisms (such as \fI.forward\fR files) normally
46 available through your system MDA and local delivery agents will
51 is available, it will assist you in setting up and editing a
52 fetchmailrc configuration. It runs under X and requires that the
53 language Python and the Tk toolkit be present on your system. If
54 you are first setting up fetchmail for single-user mode, it is
55 recommended that you use Novice mode. Expert mode provides
56 complete control of fetchmail configuration, including the
57 multidrop features. In either case, the `Autoprobe' button
58 will tell you the most capable protocol a given mailserver
59 supports, and warn you of potential problems with that server.
64 is controlled by command-line options and a run control file,
65 .IR ~/.fetchmailrc\fR ,
66 the syntax of which we describe in a later section (this file is what
67 the \fIfetchmailconf\fR program edits). Command-line options override
71 Each server name that you specify following the options on the
72 command line will be queried. If you don't specify any servers
73 on the command line, each `poll' entry in your
77 To facilitate the use of
79 in scripts and pipelines, it returns an appropriate exit code upon
80 termination -- see EXIT CODES below.
82 The following options modify the behavior of \fIfetchmail\fR. It is
83 seldom necessary to specify any of these once you have a
84 working \fI.fetchmailrc\fR file set up.
86 Almost all options have a corresponding keyword which can be used to
91 Some special options are not covered here, but are documented instead
92 in sections on AUTHENTICATION and DAEMON MODE which follow.
96 Displays the version information for your copy of
98 No mail fetch is performed.
99 Instead, for each server specified, all the option information
100 that would be computed if
102 were connecting to that server is displayed. Any non-printables in
103 passwords or other string names are shown as backslashed C-like
104 escape sequences. This option is useful for verifying that your
105 options are set the way you want them.
108 Return a status code to indicate whether there is mail waiting,
109 without actually fetching or deleting mail (see EXIT CODES below).
110 This option turns off daemon mode (in which it would be useless). It
111 doesn't play well with queries to multiple sites, and doesn't work
112 with ETRN. It will return a false positive if you leave read but
113 undeleted mail in your server mailbox and your fetch protocol can't
114 tell kept messages from new ones. This means it will work with IMAP,
115 not work with POP2, and may occasionally flake out under POP3.
118 Silent mode. Suppresses all progress/status messages that are
119 normally echoed to standard error during a fetch (but does not
120 suppress actual error messages). The --verbose option overrides this.
123 Verbose mode. All control messages passed between
125 and the mailserver are echoed to stderr. Overrides --silent.
126 Doubling this option (-v -v) causes extra diagnostic information
132 Retrieve both old (seen) and new messages from the mailserver. The
133 default is to fetch only messages the server has not marked seen.
134 Under POP3, this option also forces the use of RETR rather than TOP.
135 Note that POP2 retrieval behaves as though --all is always on (see
136 RETRIEVAL FAILURE MODES below) and this option does not work with ETRN.
140 Keep retrieved messages on the remote mailserver. Normally, messages
141 are deleted from the folder on the mailserver after they have been retrieved.
144 option causes retrieved messages to remain in your folder on the
145 mailserver. This option does not work with ETRN.
149 Delete retrieved messages from the remote mailserver. This
150 option forces retrieved mail to be deleted. It may be useful if
151 you have specified a default of \fBkeep\fR in your
152 \&\fI.fetchmailrc\fR. This option is forced on with ETRN.
155 POP3/IMAP only. Delete old (previously retrieved) messages from the mailserver
156 before retrieving new messages. This option does not work with ETRN.
157 Warning: if your local MTA hangs and fetchmail is aborted, the next
158 time you run fetchmail, it will delete mail that was never delivered to you.
159 What you probably want is the default setting: if you don't specify `-k', then
160 fetchmail will automatically delete messages after successful delivery.
161 .SS Protocol and Query Options
163 .B \-p, \--protocol <proto>
164 (Keyword: proto[col])
165 Specify the protocol to use when communicating with the remote
166 mailserver. If no protocol is specified, the default is AUTO.
168 may be one of the following:
171 Tries IMAP, POP3, and POP2 (skipping any of these for which support
172 has not been compiled in).
174 Post Office Protocol 2
176 Post Office Protocol 3
178 Use POP3 with MD5 authentication.
180 Use POP3 with RPOP authentication.
182 Use POP3 with Kerberos V4 preauthentication on port 1109.
184 Use POP3 with Demon Internet's SDPS extensions.
186 IMAP2bis, IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities).
188 IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities)
189 with RFC 1731 Kerberos v4 preauthentication.
191 IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities)
192 with RFC 1731 GSSAPI preauthentication.
194 IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities)
195 with RFC 2195 CRAM-MD5 authentication.
197 IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities)
198 with plain LOGIN authentication only, even if the server supports
201 Use the ESMTP ETRN option.
204 All these alternatives work in basically the same way (communicating
205 with standard server daemons to fetch mail already delivered to a
206 mailbox on the server) except ETRN. The ETRN mode allows you to ask a
207 compliant ESMTP server (such as BSD sendmail at release 8.8.0 or
208 higher) to immediately open a sender-SMTP connection to your
209 client machine and begin forwarding any items addressed to your client
210 machine in the server's queue of undelivered mail.
214 Force UIDL use (effective only with POP3). Force client-side tracking
215 of `newness' of messages (UIDL stands for ``unique ID listing'' and is
216 described in RFC1725). Use with `keep' to use a mailbox as a baby
217 news drop for a group of users.
219 .B \-P, --port <portnumber>
221 The port option permits you to specify a TCP/IP port to connect on.
222 This option will seldom be necessary as all the supported protocols have
223 well-established default port numbers.
225 .B \-t, --timeout <seconds>
227 The timeout option allows you to set a server-nonresponse
228 timeout in seconds. If a mailserver does not send a greeting message
229 or respond to commands for the given number of seconds,
230 \fIfetchmail\fR will hang up on it. Without such a timeout
231 \fIfetchmail\fR might hang up indefinitely trying to fetch mail from a
232 down host. This would be particularly annoying for a \fIfetchmail\fR
233 running in background. There is a default timeout which fetchmail -V
234 will report. If a given connection receives too many timeouts in
235 succession, fetchmail will consider it wedged and stop retrying,
236 the calkling user will be notified by email if this happens.
238 .B \--plugin <command>
240 The plugin option allows you to use an external program to establish the
241 TCP connection. This is useful if you want to use socks or need some
242 special firewalling setup. The program will be looked up in $PATH and
243 it will be passed two arguments: the name of the server and the name of
244 the port. Fetchmail will write to the plugin's stdin and read from
247 .B \--plugout <command>
249 Identical to the plugin option above, but this one is used for the SMTP
250 connections (which will probably not need it, so it has been separated
253 .B \-r <name>, --folder <name>
255 Causes a specified non-default mail folder on the mailserver (or
256 comma-separated list of folders) to be retrieved. The syntax of the
257 folder name is server-dependent. This option is not available under
262 Causes the connection to the mail server to be encrypted via SSL. Connect
263 to the server using the specified base protocol over a connection secured
264 by SSL. SSL support must be present at the server. If no port is
265 specified, the connection is attempted to the well known port of the SSL
266 version of the base protocol. This is generally a different port than the
267 port used by the base protocol. For imap, this is port 143 for the clear
268 protocol and port 993 for the SSL secured protocol.
272 Specifies the file name of the client side public SSL certificate. Some
273 SSL encrypted servers may require client side keys and certificates for
274 authentication. In most cases, this is optional. This specifies
275 the location of the public key certificate to be presented to the server
276 at the time the SSL session is established. It is not required (but may
277 be provided) if the server does not require it. Some servers may
278 require it, some servers may request it but not require it, and some
279 servers may not request it at all. It may be the same file
280 as the private key (combined key and certificate file) but this is not
285 Specifies the file name of the client side private SSL key. Some SSL
286 encrypted servers may require client side keys and certificates for
287 authentication. In most cases, this is optional. This specifies
288 the location of the private key used to sign transactions with the server
289 at the time the SSL session is established. It is not required (but may
290 be provided) if the server does not require it. Some servers may
291 require it, some servers may request it but not require it, and some
292 servers may not request it at all. It may be the same file
293 as the public key (combined key and certificate file) but this is not
294 recommended. If a password is required to unlock the key, it will be
295 prompted for at the time just prior to establishing the session to the
296 server. This can cause some complications in daemon mode.
297 .SS Delivery Control Options
299 .B \-S <hosts>, --smtphost <hosts>
300 (Keyword: smtp[host])
301 Specify a hunt list of hosts to forward mail to (one or more
302 hostnames, comma-separated). In ETRN mode, set the host that the
303 mailserver is asked to ship mail to. Hosts are tried in list order;
304 the first one that is up becomes the forwarding or ETRN target for the
305 current run. Normally, `localhost' is added to the end of the list as
306 an invisible default. However, when using ETRN mode or Kerberos
307 preauthentication, the FQDN of the machine running fetchmail is added to
308 the end of the list as an invisible default. Each hostname may have a
309 port number following the host name. The port number is separated from
310 the host name by a slash; the default port is 25 (or ``smtp'' under IPv6).
313 --smtphost server1,server2/2525,server3
316 .B \-D <domain>, --smtpaddress <domain>
317 (Keyword: smtpaddress)
318 Specify the domain to be put in RCPT TO lines shipped to SMTP. The
319 name of the SMTP server (as specified by --smtphost, or defaulted to
320 "localhost") is used when this is not specified.
322 .B --smtpname <user@domain>
324 Specify the domain and user to be put in RCPT TO lines shipped to SMTP.
325 The default user is the current local user.
327 .B \-Z <nnn>, --antispam <nnn[, nnn]...>
329 Specifies the list of numeric SMTP errors that are to be interpreted
330 as a spam-block response from the listener. A value of -1 disables
331 this option. For the command-line option, the list values should
334 .B \-m <command>, \--mda <command>
336 You can force mail to be passed to an MDA directly (rather than
337 forwarded to port 25) with the -mda or -m option. Be aware that this
338 disables some valuable resource-exhaustion checks and error handling
339 provided by SMTP listeners; it's not a good idea unless running an
340 SMTP listener is impossible. If \fIfetchmail\fR is running as root,
341 it sets its userid to that of the target user while delivering mail
342 through an MDA. Some possible MDAs are "/usr/sbin/sendmail -oem -f %F
343 %T", "/usr/bin/deliver" and "/usr/bin/procmail -d %T" (but the latter
344 is usually redundant as it's what SMTP listeners usually forward
345 to). Local delivery addresses will be inserted into the MDA command
346 wherever you place a %T; the mail message's From address will be
347 inserted where you place an %F. Do \fInot\fR use an MDA invocation
348 like "sendmail -oem -t" that dispatches on the contents of To/Cc/Bcc,
349 it will create mail loops and bring the just wrath of many postmasters
354 Cause delivery via LMTP (Local Mail Transfer Protocol). A service
355 port \fImust\fR be explicitly specified (with a slash suffix) on each
356 host in the smtphost hunt list) if this option is selected; the
357 default port 25 will (in accordance with RFC 2033) not be accepted.
359 .B \--bsmtp <filename>
361 Append fetched mail to a BSMTP file. This simply contains the SMTP
362 commands that would normally be generated by fetchmail when passing
363 mail to an SMTP listener daemon. An argument of `-' causes the mail
364 to be written to standard output. Note that fetchmail's
365 reconstruction of MAIL FROM and RCPT TO lines is not guaranteed
366 correct; the caveats discussed under THE USE AND ABUSE OF MULTIDROP
367 MAILBOXES below apply.
368 .SS Resource Limit Control Options
370 .B \-l <maxbytes>, --limit <maxbytes>
372 Takes a maximum octet size argument. Messages larger than this size
373 will not be fetched, not be marked seen, and will be left on the
374 server (in foreground sessions, the progress messages will note that
375 they are "oversized"). An explicit --limit of 0 overrides any limits
376 set in your run control file. This option is intended for those
377 needing to strictly control fetch time due to expensive and variable
378 phone rates. In daemon mode, oversize notifications are mailed to the
379 calling user (see the --warnings option). This option does not work
382 .B \-w <interval>, --warnings <interval>
384 Takes an interval in seconds. When you call
386 with a `limit' option in daemon mode, this controls the interval at
387 which warnings about oversized messages are mailed to the calling user
388 (or the user specified by the `postmaster' option). One such
389 notification is always mailed at the end of the the first poll that
390 the oversized message is detected. Thereafter, renotification is
391 suppressed until after the warning interval elapses (it will take
392 place at the end of the first following poll).
394 .B -b <count>, --batchlimit <count>
395 (Keyword: batchlimit)
396 Specify the maximum number of messages that will be shipped to an SMTP
397 listener before the connection is deliberately torn down and rebuilt
398 (defaults to 0, meaning no limit). An explicit --batchlimit of 0
399 overrides any limits set in your run control file. While
400 \fBsendmail\fR(8) normally initiates delivery of a message immediately
401 after receiving the message terminator, some SMTP listeners are not so
402 prompt. MTAs like \fIqmail\fR(8) and \fIsmail\fR(8) may wait till the
403 delivery socket is shut down to deliver. This may produce annoying
406 is processing very large batches. Setting the batch limit to some
407 nonzero size will prevent these delays.
408 This option does not work with ETRN.
410 .B -B <number>, --fetchlimit <number>
411 (Keyword: fetchlimit)
412 Limit the number of messages accepted from a given server in a single
413 poll. By default there is no limit. An explicit --fetchlimit of 0
414 overrides any limits set in your run control file.
415 This option does not work with ETRN.
417 .B -e <count>, --expunge <count>
419 Arrange for deletions to be made final after a given number of
420 messages. Under POP2 or POP3, fetchmail cannot make deletions final
421 without sending QUIT and ending the session -- with this option on,
422 fetchmail will break a long mail retrieval session into multiple
423 subsessions, sending QUIT after each sub-session. This is a good
424 defense against line drops on POP3 servers that do not do the
425 equivalent of a QUIT on hangup. Under IMAP,
427 normally issues an EXPUNGE command after each deletion in order to
428 force the deletion to be done immediately. This is safest when your
429 connection to the server is flaky and expensive, as it avoids
430 resending duplicate mail after a line hit. However, on large
431 mailboxes the overhead of re-indexing after every message can slam the
432 server pretty hard, so if your connection is reliable it is good to do
433 expunges less frequently. If you specify this option to an integer N,
436 to only issue expunges on every Nth delete. An argument of zero
437 suppresses expunges entirely (so no expunges at all will be done until
438 the end of run). This option does not work with ETRN.
439 .SS Authentication Options
441 .B \-u <name>, --username <name>
442 (Keyword: user[name])
443 Specifies the user identification to be used when logging in to the mailserver.
444 The appropriate user identification is both server and user-dependent.
445 The default is your login name on the client machine that is running
447 See USER AUTHENTICATION below for a complete description.
449 .B \-I <specification>, --interface <specification>
451 Require that a specific interface device be up and have a specific local
452 IP address (or range) before polling. Frequently
454 is used over a transient point-to-point TCP/IP link established directly
455 to a mailserver via SLIP or PPP. That is a relatively secure channel.
456 But when other TCP/IP routes to the mailserver exist (e.g. when the link
457 is connected to an alternate ISP), your username and password may be
458 vulnerable to snooping (especially when daemon mode automatically polls
459 for mail, shipping a clear password over the net at predictable
460 intervals). The --interface option may be used to prevent this. When
461 the specified link is not up or is not connected to a matching IP
462 address, polling will be skipped. The format is:
464 interface/iii.iii.iii.iii/mmm.mmm.mmm.mmm
466 The field before the first slash is the interface name (i.e. sl0, ppp0
467 etc.). The field before the second slash is the acceptable IP address.
468 The field after the second slash is a mask which specifies a range of
469 IP addresses to accept. If no mask is present 255.255.255.255 is
470 assumed (i.e. an exact match). This option is currently only supported
471 under Linux and FreeBSD. Please see the
473 section for below for FreeBSD specific information.
475 .B \-M <interface>, --monitor <interface>
477 Daemon mode can cause transient links which are automatically taken down
478 after a period of inactivity (e.g. PPP links) to remain up
479 indefinitely. This option identifies a system TCP/IP interface to be
480 monitored for activity. After each poll interval, if the link is up but
481 no other activity has occurred on the link, then the poll will be
482 skipped. However, when fetchmail is woken up by a signal, the
483 monitor check is skipped and the poll goes through unconditionally.
484 This option is currently only supported under Linux and FreeBSD.
489 options to work for non root users under FreeBSD, the fetchmail binary
490 must be installed SGID kmem. This would be a security hole, but
491 fetchmail runs with the effective GID set to that of the kmem group
493 when interface data is being collected.
496 (Keyword: preauth[enticate])
497 This option permits you to specify a preauthentication type (see USER
498 AUTHENTICATION below for details). The possible values are
499 \&`\fBpassword\fR', `\fBkerberos_v5\fR' and `\fBkerberos\fR' (or, for
500 excruciating exactness, `\fBkerberos_v4\fR'), and \fBssh\fR. Use
501 \fBssh\fR to suppress fetchmail's normal inquiry for a password when
502 you are using an end-to-end secure connection such as an ssh tunnel.
503 Other values of this option are provided primarily for developers;
504 choosing KPOP protocol automatically selects Kerberos
505 preauthentication, and all other alternatives use password
506 authentication (though APOP uses a generated one-time key as the
507 password and IMAP-K4 uses RFC1731 Kerberos v4 authentication). This
508 option does not work with ETRN.
509 .SS Miscellaneous Options
511 .B \-f <pathname>, --fetchmailrc <pathname>
512 Specify a non-default name for the
514 run control file. The pathname argument must be either "-" (a single
515 dash, meaning to read the configuration from standard input) or a
516 filename. Unless the --version option is also on, a named file
517 argument must have permissions no more open than 0600 (u=rw,g=,o=) or
520 .B \-i <pathname>, --idfile <pathname>
522 Specify an alternate name for the .fetchids file used to save POP3
526 (Keyword: no rewrite)
529 edits RFC-822 address headers (To, From, Cc, Bcc, and Reply-To) in
530 fetched mail so that any mail IDs local to the server are expanded to
531 full addresses (@ and the mailserver hostname are appended). This enables
532 replies on the client to get addressed correctly (otherwise your
533 mailer might think they should be addressed to local users on the
534 client machine!). This option disables the rewrite. (This option is
535 provided to pacify people who are paranoid about having an MTA edit
536 mail headers and want to know they can prevent it, but it is generally
537 not a good idea to actually turn off rewrite.)
538 When using ETRN, the rewrite option is ineffective.
540 .B -E <line>, --envelope <line>
542 This option changes the header
544 assumes will carry a copy of the mail's envelope address. Normally
545 this is `X-Envelope-To' but as this header is not standard, practice
546 varies. See the discussion of multidrop address handling below. As a
547 special case, `envelope "Received"' enables parsing of sendmail-style
548 Received lines. This is the default, and it should not be necessary
549 unless you have globally disabled Received parsing with `no envelope'
550 in the \fI.fetchmailrc\fR file.
552 .B -Q <prefix>, --qvirtual <prefix>
554 The string prefix assigned to this option will be removed from the user
555 name found in the header specified with the \fIenvelope\fR option
556 (\fIbefore\fR doing multidrop name mapping or localdomain checking,
557 if either is applicable). This option is useful if you are using
559 to collect the mail for an entire domain and your ISP (or your mail
560 redirection provider) is using qmail.
561 One of the basic features of qmail is the
565 message header. Whenever qmail delivers a message to a local mailbox
566 it puts the username and hostname of the envelope recipient on this
567 line. The major reason for this is to prevent mail loops. To set up
568 qmail to batch mail for a disconnected site the ISP-mailhost will have
569 normally put that site in its `Virtualhosts' control file so it will
570 add a prefix to all mail addresses for this site. This results in mail
571 sent to 'username@userhost.userdom.dom.com' having a
572 \&`Delivered-To:' line of the form:
574 Delivered-To: mbox-userstr-username@userhost.userdom.dom.com
576 The ISP can make the 'mbox-userstr-' prefix anything they choose
577 but a string matching the user host name is likely.
578 By using the option `envelope Delivered-To:' you can make fetchmail reliably
579 identify the original envelope recipient, but you have to strip the
580 `mbox-userstr-' prefix to deliver to the correct user.
581 This is what this option is for.
586 file, interpret any command-line options specified, and dump a
587 configuration report to standard output. The configuration report is
588 a data structure assignment in the language Python. This option
589 is meant to be used with an interactive
595 .SH USER AUTHENTICATION AND ENCRYPTION
596 Every mode except ETRN requires authentication of the client.
597 Normal user authentication in
599 is very much like the authentication mechanism of
601 The correct user-id and password depend upon the underlying security
602 system at the mailserver.
604 If the mailserver is a Unix machine on which you have an ordinary user
605 account, your regular login name and password are used with
607 If you use the same login name on both the server and the client machines,
608 you needn't worry about specifying a user-id with the
611 the default behavior is to use your login name on the client machine as the
612 user-id on the server machine. If you use a different login name
613 on the server machine, specify that login name with the
615 option. e.g. if your login name is 'jsmith' on a machine named 'mailgrunt',
620 fetchmail -u jsmith mailgrunt
622 The default behavior of
624 is to prompt you for your mailserver password before the connection is
625 established. This is the safest way to use
627 and ensures that your password will not be compromised. You may also specify
628 your password in your
630 file. This is convenient when using
632 in daemon mode or with scripts.
634 If you do not specify a password, and
636 cannot extract one from your
638 file, it will look for a
640 file in your home directory before requesting one interactively; if an
641 entry matching the mailserver is found in that file, the password will
642 be used. Fetchmail first looks for a match on poll name; if it finds none,
643 it checks for a match on via name. See the
645 man page for details of the syntax of the
647 file. (This feature may allow you to avoid duplicating password
648 information in more than one file.)
650 On mailservers that do not provide ordinary user accounts, your user-id and
651 password are usually assigned by the server administrator when you apply for
652 a mailbox on the server. Contact your server administrator if you don't know
653 the correct user-id and password for your mailbox account.
655 Early versions of POP3 (RFC1081, RFC1225) supported a crude form of
656 independent authentication using the
658 file on the mailserver side. Under this RPOP variant, a fixed
659 per-user ID equivalent to a password was sent in clear over a link to
660 a reserved port, with the command RPOP rather than PASS to alert the
661 server that it should do special checking. RPOP is supported
664 (you can specify `protocol RPOP' to have the program send `RPOP'
665 rather than `PASS') but its use is strongly discouraged. This
666 facility was vulnerable to spoofing and was withdrawn in RFC1460.
668 RFC1460 introduced APOP authentication. In this variant of POP3,
669 you register an APOP password on your server host (the program
670 to do this with on the server is probably called \fIpopauth\fR(8)). You
671 put the same password in your
675 logs in, it sends a cryptographically secure hash of your password and
676 the server greeting time to the server, which can verify it by
677 checking its authorization database.
679 If your \fIfetchmail\fR was built with Kerberos support and you specify
680 Kerberos preauthentication (either with --auth or the \fI.fetchmailrc\fR
681 option \fBauthenticate kerberos_v4\fR) it will try to get a Kerberos
682 ticket from the mailserver at the start of each query. Note: if
683 either the pollnane or via name is `hesiod', fetchmail will try to use
684 Hesiod to look up the mailserver.
686 If you use IMAP-K4, \fIfetchmail\fR will expect the IMAP server to have
687 RFC1731-conformant AUTHENTICATE KERBEROS_V4 capability, and will use it.
689 If you use IMAP-GSS, \fIfetchmail\fR will expect the IMAP server to have
690 RFC1731-conformant AUTHENTICATE GSSAPI capability, and will use it.
691 Currently this has only been tested over Kerberos V, so you're expected
692 to already have a ticket-granting ticket. You may pass a username different
693 from your principal name using the standard \fB--user\fR command or by
694 the \fI.fetchmailrc\fR option \fBuser\fR.
696 If your IMAP daemon returns the PREAUTH response in its greeting line,
697 fetchmail will notice this and skip the normal authentication step.
698 This could be useful, e.g. if you start imapd explicitly using ssh.
699 In this case you can declare the preauthentication value `ssh' on that
700 site entry to stop \fI.fetchmail\fR from asking you for a password
703 If you are using POP3, and the server issues a one-time-password
704 challenge conforming to RFC1938, \fIfetchmail\fR will use your
705 password as a pass phrase to generate the required response. This
706 avoids sending secrets over the net unencrypted.
708 Compuserve's RPA authentication (similar to APOP) is supported. If you
709 compile in the support, \fIfetchmail\fR will try to perform an RPA pass-phrase
710 authentication instead of sending over the password en clair if it
711 detects "@compuserve.com" in the hostname.
713 Microsoft's NTLM authentication (used by Microsoft Exchange) is
714 supported. If you compile in the support, \fIfetchmail\fR will try to
715 perform an NTLM authentication (instead of sending over the
716 password en clair) whenever the server returns AUTH=NTLM in its
717 capability response. Note: if you specify a user option value
718 that looks like `user@domain', the part to the left of the @ will
719 be passed as the username and the part to the right as the NTLM domain.
721 If you are using IPsec, the -T (--netsec) option can be used to pass
722 an IP security request to be used when outgoing IP connections are
723 initialized. You can also do this using the `netsec' server option
724 in the .fetchmailrc file. In either case, the option value is a
725 string in the format accepted by the net_security_strtorequest()
726 function of the inet6_apps library.
728 You can access SSL encrypted services by specifying the --ssl option.
729 You can also do this using the "ssl" server option in the .fetchmailrc
730 file. With SSL encryption enabled, queries are initiated over a connection
731 after negotiating an SSL session. Some services, such as POP3 and IMAP,
732 have different well known ports defined for the SSL encrypted services.
733 The encrypted ports will be selected automatically when SSL is enabled and
734 no explicit port is specified.
736 When connecting to an SSL encrypted server, the server presents a certificate
737 to the client for validation. The certificate is checked to verify that
738 the common name in the certificate matches the name of the server being
739 contacted and that the effective and expiration dates in the certificate
740 indicate that it is currently valid. If any of these checks fail, a warning
741 message is printed, but the connection continues. The server certificate
742 does not need to be signed by any specific Certifying Authority and may
743 be a "self-signed" certificate.
745 Some SSL encrypted servers may request a client side certificate. A client
746 side public SSL certificate and private SSL key may be specified. If
747 requested by the server, the client certificate is sent to the server for
748 validation. Some servers may require a valid client certificate and may
749 refuse connections if a certificate is not provided or if the certificate
750 is not valid. Some servers may require client side certificates be signed
751 by a recognized Certifying Authority. The format for the key files and
752 the certificate files is that required by the underlying SSL libraries
753 (OpenSSL in the general case).
757 .B --daemon <interval>
762 in daemon mode. You must specify a numeric argument which is a
763 polling interval in seconds.
767 puts itself in background and runs forever, querying each specified
768 host and then sleeping for the given polling interval.
774 will, therefore, poll all the hosts described in your
776 file (except those explicitly excluded with the `skip' verb) once
777 every fifteen minutes.
779 It is possible to set a polling interval
782 file by saying `set daemon <interval>', where <interval> is an
783 integer number of seconds. If you do this, fetchmail will always
784 start in daemon mode unless you override it with the command-line
785 option --daemon 0 or -d0.
787 Only one daemon process is permitted per user; in daemon mode,
789 makes a per-user lockfile to guarantee this.
791 Normally, calling fetchmail with a daemon in the background sends a
792 wakeup signal to the daemon, forcing it to poll mailservers
793 immediately. (The wakeup signal is SIGHUP if fetchmail is running as
794 root, SIGUSR1 otherwise.) The wakeup action also clears any `wedged'
795 flags indicating that connections have wedged due to failed
796 authentication or multiple timeouts.
800 will kill a running daemon process instead of waking it up (if there
803 notifies you). If the --quit option is the only command-line option,
804 that's all there is to it.
806 The quit option may also be mixed with other command-line options; its
807 effect is to kill any running daemon before doing what the other
808 options specify in combination with the rc file.
813 .B --logfile <filename>
814 option (keyword: set logfile) allows you to redirect status messages
815 emitted while detached into a specified logfile (follow the
816 option with the logfile name). The logfile is opened for append, so
817 previous messages aren't deleted. This is primarily useful for
818 debugging configurations.
822 option (keyword: set syslog) allows you to redirect status and error
823 messages emitted to the
825 system daemon if available.
826 Messages are logged with an id of \fBfetchmail\fR, the facility \fBLOG_MAIL\fR,
827 and priorities \fBLOG_ERR\fR, \fBLOG_ALERT\fR or \fBLOG_INFO\fR.
828 This option is intended for logging status and error messages which
829 indicate the status of the daemon and the results while fetching mail
831 Error messages for command line options and parsing the \fI.fetchmailrc\fR
832 file are still written to stderr, or to the specified log file.
835 option turns off use of
837 assuming it's turned on in the
847 or --nodetach option suppresses backgrounding and detachment of the
848 daemon process from its control terminal. This is primarily useful
849 for debugging. Note that this also causes the logfile option to be
850 ignored (though perhaps it shouldn't).
852 Note that while running in daemon mode polling a POP2 or IMAP2bis server,
853 transient errors (such as DNS failures or sendmail delivery refusals)
854 may force the fetchall option on for the duration of the next polling
855 cycle. This is a robustness feature. It means that if a message is
856 fetched (and thus marked seen by the mailserver) but not delivered
857 locally due to some transient error, it will be re-fetched during the
858 next poll cycle. (The IMAP logic doesn't delete messages until
859 they're delivered, so this problem does not arise.)
861 If you touch or change the
863 file while fetchmail is running in daemon mode, this will be detected
864 at the beginning of the next poll cycle. When a changed
866 is detected, fetchmail rereads it and restarts from scratch (using
867 exec(2); no state information is retained in the new instance). Note also
868 that if you break the
870 file's syntax, the new instance will softly and silently vanish away
873 .SH ADMINISTRATIVE OPTIONS
876 .B --postmaster <name>
877 option (keyword: set postmaster) specifies the last-resort username to
878 which multidrop mail is to be forwarded if no matching local recipient
879 can be found. Normally this is just the user who invoked fetchmail.
880 If the invoking user is root, then the default of this option is
881 the user `postmaster'.
885 option suppresses the normal action of bouncing errors back to the
886 sender in an RFC1894-conformant error message. If nobounce is on, the
887 message will go to the postmaster instead.
891 option (keyword: set invisible) tries to make fetchmail invisible.
892 Normally, fetchmail behaves like any other MTA would -- it generates a
893 Received header into each message describing its place in the chain of
894 transmission, and tells the MTA it forwards to that the mail came from
895 the machine fetchmail itself is running on. If the invisible option
896 is on, the Received header is suppressed and fetchmail tries to spoof
897 the MTA it forwards to into thinking it came directly from the
900 .SH RETRIEVAL FAILURE MODES
901 The protocols \fIfetchmail\fR uses to talk to mailservers are next to
902 bulletproof. In normal operation forwarding to port 25, no message is
903 ever deleted (or even marked for deletion) on the host until the SMTP
904 listener on the client has acknowledged to \fIfetchmail\fR that the
905 message has been accepted for delivery or rejected due to a apam
906 block. When forwarding to an MDA, however, there is more possibility
907 of error (because there's no way for fetchmail to get a reliable
908 positive acknowledgement from the MDA).
910 The normal mode of \fIfetchmail\fR is to try to download only `new'
911 messages, leaving untouched (and undeleted) messages you have already
912 read directly on the server (or fetched with a previous \fIfetchmail
913 --keep\fR). But you may find that messages you've already read on the
914 server are being fetched (and deleted) even when you don't specify
915 --all. There are several reasons this can happen.
917 One could be that you're using POP2. The POP2 protocol includes no
918 representation of `new' or `old' state in messages, so \fIfetchmail\fR
919 must treat all messages as new all the time. But POP2 is obsolete, so
922 Under POP3, blame RFC1725. That version of the POP3 protocol
923 specification removed the LAST command, and some POP servers follow it
924 (you can verify this by invoking \fIfetchmail -v\fR to the mailserver
925 and watching the response to LAST early in the query). The
926 \fIfetchmail\fR code tries to compensate by using POP3's UID feature,
927 storing the identifiers of messages seen in each session until the
928 next session, in the \fI.fetchids\fR file. But this doesn't track
929 messages seen with other clients, or read directly with a mailer on
930 the host but not deleted afterward. A better solution would be to
933 Another potential POP3 problem might be servers that insert messages
934 in the middle of mailboxes (some VMS implementations of mail are
935 rumored to do this). The \fIfetchmail\fR code assumes that new
936 messages are appended to the end of the mailbox; when this is not true
937 it may treat some old messages as new and vice versa. The only
938 real fix for this problem is to switch to IMAP.
940 Yet another POP3 problem is that if they can't make tempfiles in the
941 user's home directory, some POP3 servers will hand back an
942 undocumented response that causes fetchmail to spuriously report "No
945 The IMAP code uses the presence or absence of the server flag \eSeen
946 to decide whether or not a message is new. Under Unix, it counts on
947 your IMAP server to notice the BSD-style Status flags set by mail user
948 agents and set the \eSeen flag from them when appropriate. All Unix
949 IMAP servers we know of do this, though it's not specified by the IMAP
950 RFCs. If you ever trip over a server that doesn't, the symptom will
951 be that messages you have already read on your host will look new to
952 the server. In this (unlikely) case, only messages you fetched with
953 \fIfetchmail --keep\fR will be both undeleted and marked old.
955 In ETRN mode, \fIfetchmail\fR does not actually retrieve messages;
956 instead, it asks the server's SMTP listener to start a queue flush
957 to the client via SMTP. Therefore it sends only undelivered messages.
960 Many SMTP listeners allow administrators to set up `spam filters' that
961 block unsolicited email from specified domains. A MAIL FROM or DATA line that
962 triggers this feature will elicit an SMTP response which
963 (unfortunately) varies according to the listener.
967 return an error code of 571. This return value
968 is blessed by RFC1893 as "Delivery not authorized, message refused".
970 According to current drafts of the replacement for RFC821, the correct
971 thing to return in this situation is 550 "Requested action not taken:
972 mailbox unavailable" (the draft adds "[E.g., mailbox not found, no
973 access, or command rejected for policy reasons].").
977 MTA returns 501 "Syntax error in parameters or arguments", but will
982 MTA runs 554 as an antispam response.
986 code recognizes and discards the message on any of a list of responses
987 that defaults to [571, 550, 501, 554] but can be set with the `antispam'
988 option. This is one of the
990 three circumstance under which fetchmail ever discards mail (the others
991 are the 552 and 553 errors described below, and the suppression of
992 multidropped messages with a message-ID already seen).
996 is fetching from an IMAP server, the antispam response will be detected and
997 the message rejected immediately after the headers have been fetched,
998 without reading the message body. Thus, you won't pay for downloading
1001 Mail that is spam-blocked triggers an RFC1892 bounce message informing
1002 the originator that we do not accept mail from it.
1004 .SH SMTP/ESMTP ERROR HANDLING
1005 Besides the spam-blocking described above,fetchmail takes special
1006 actions on the following SMTP/ESMTP error responses
1008 452 (insufficient system storage)
1009 Leave the message in the server mailbox for later retrieval.
1011 552 (message exceeds fixed maximum message size)
1012 Delete the message from the server. Send bounce-mail to the originator.
1014 553 (invalid sending domain)
1015 Delete the message from the server. Send bounce-mail to the originator.
1017 Other errors trigger bounce mail back to the originator.
1019 .SH THE RUN CONTROL FILE
1020 The preferred way to set up fetchmail is to write a
1021 \&\fI.fetchmailrc\fR file in your home directory (you may do this
1022 directly, with a text editor, or indirectly via \fIfetchmailconf\fR).
1023 When there is a conflict between the command-line arguments and the
1024 arguments in this file, the command-line arguments take precedence.
1026 To protect the security of your passwords, when --version is not on
1027 your \fI~/.fetchmailrc\fR may not have more than 0600 (u=rw,g=,o=) permissions;
1029 will complain and exit otherwise.
1031 You may read the \fI.fetchmailrc\fR file as a list of commands to
1034 is called with no arguments.
1035 .SS Run Control Syntax
1037 Comments begin with a '#' and extend through the end of the line.
1038 Otherwise the file consists of a series of server entries or global
1039 option statements in a free-format, token-oriented syntax.
1041 There are four kinds of tokens: grammar keywords, numbers
1042 (i.e. decimal digit sequences), unquoted strings, and quoted strings.
1043 A quoted string is bounded by double quotes and may contain
1044 whitespace (and quoted digits are treated as a string). An unquoted
1045 string is any whitespace-delimited token that is neither numeric, string
1046 quoted nor contains the special characters `,', `;', `:', or `='.
1048 Any amount of whitespace separates tokens in server entries, but is
1049 otherwise ignored. You may use standard C-style escapes (\en, \et,
1050 \eb, octal, and hex) to embed non-printable characters or string
1051 delimiters in strings.
1053 Each server entry consists of one of the keywords `poll' or `skip',
1054 followed by a server name, followed by server options, followed by any
1055 number of user descriptions. Note: the most common cause of syntax
1056 errors is mixing up user and server options.
1058 For backward compatibility, the word `server' is a synonym for `poll'.
1060 You can use the noise keywords `and', `with',
1061 \&`has', `wants', and `options' anywhere in an entry to make
1062 it resemble English. They're ignored, but but can make entries much
1063 easier to read at a glance. The punctuation characters ':', ';' and
1064 \&',' are also ignored.
1067 The `poll' verb tells fetchmail to query this host when it is run with
1068 no arguments. The `skip' verb tells
1070 not to poll this host unless it is explicitly named on the command
1071 line. (The `skip' verb allows you to experiment with test entries
1072 safely, or easily disable entries for hosts that are temporarily down.)
1074 .SS Keyword/Option Summary
1075 Here are the legal options. Keyword suffixes enclosed in
1076 square brackets are optional. Those corresponding to command-line
1077 options are followed by `-' and the appropriate option letter.
1079 Here are the legal global options:
1083 Keyword Opt Function
1086 Set a background poll interval in seconds
1088 set postmaster \& T{
1089 Give the name of the last-resort mail recipient
1091 set no bouncemail \& T{
1092 Direct error mail to postmaster rather than sender
1095 Name of a file to dump error and status messages to
1098 Name of the file to store UID lists in
1101 Do error logging through syslog(3).
1104 Turn off error logging through syslog(3).
1106 set properties \& T{
1107 String value is ignored by fetchmail (may be used by extension scripts)
1111 Here are the legal server options:
1115 Keyword Opt Function
1118 Specify DNS name of mailserver, overriding poll name
1121 Specify protocol (case insensitive):
1122 POP2, POP3, IMAP, IMAP-K4, IMAP-GSS, APOP, KPOP
1125 Specify TCP/IP service port
1127 auth[enticate] -A T{
1128 Set preauthentication type (default `password')
1131 Server inactivity timeout in seconds (default 300)
1134 Specify envelope-address header name
1137 Disable looking for envelope address
1140 Qmail virtual domain prefix to remove from user name
1143 Specify alternate DNS names of mailserver
1146 specify IP interface(s) that must be up for server poll to take place
1149 Specify IP address to monitor for activity
1152 Specify command through which to make server connections.
1155 Specify command through which to make listener connections.
1158 Enable DNS lookup for multidrop (default)
1161 Disable DNS lookup for multidrop
1164 Do comparison by IP address for multidrop
1167 Do comparison by name for multidrop (default)
1170 Force POP3 to use client-side UIDLs
1173 Turn off POP3 use of client-side UIDLs (default)
1176 Only check this site every N poll cycles; N is a numeric argument.
1180 Here are the legal user options:
1184 Keyword Opt Function
1187 Set remote user name
1188 (local user name if name followed by `here')
1191 Connect local and remote user names
1194 Connect local and remote user names
1197 Specify remote account password
1200 Connect to server over the specified base protocol using SSL encryption
1203 Specify file for client side public SSL certificate
1206 Specify file for client side private SSL key
1209 Specify remote folder to query
1212 Specify smtp host(s) to forward to
1215 Specify the domain to be put in RCPT TO lines
1218 Specify the user and domain to be put in RCPT TO lines
1221 Specify what SMTP returns are interpreted as spam-policy blocks
1224 Specify MDA for local delivery
1227 Specify BSMTP batch file to append to
1230 Command to be executed before each connection
1233 Command to be executed after each connection
1236 Don't delete seen messages from server
1239 Flush all seen messages before querying
1242 Fetch all messages whether seen or not
1245 Rewrite destination addresses for reply (default)
1248 Strip carriage returns from ends of lines
1251 Force carriage returns at ends of lines
1254 Force BODY=8BITMIME to ESMTP listener
1257 Strip Status and X-Mozilla-Status lines out of incoming mail
1260 Convert quoted-printable to 8-bit in MIME messages
1263 Idle waiting for new messages after each poll (IMAP only)
1266 Delete seen messages from server (default)
1269 Don't flush all seen messages before querying (default)
1272 Retrieve only new messages (default)
1275 Don't rewrite headers
1278 Don't strip carriage returns (default)
1281 Don't force carriage returns at EOL (default)
1284 Don't force BODY=8BITMIME to ESMTP listener (default)
1287 Don't drop Status headers (default)
1290 Don't convert quoted-printable to 8-bit in MIME messages (default)
1293 Don't idle waiting for new messages after each poll (IMAP only)
1296 Set message size limit
1299 Set message size warning interval
1302 Max # messages to forward in single connect
1305 Max # messages to fetch in single connect
1308 Perform an expunge on every #th message (IMAP only)
1311 String value is ignored by fetchmail (may be used by extension scripts)
1315 Remember that all user options must \fIfollow\fR all server options.
1317 In the .fetchmailrc file, the `envelope' string argument may be
1318 preceded by a whitespace-separated number. This number, if specified,
1319 is the number of such headers to skip (that is, an argument of 1
1320 selects the second header of the given type). This is sometime useful
1321 for ignoring bogus Received headers created by an ISP's local delivery
1323 .SS Keywords Not Corresponding To Option Switches
1325 The `folder' and `smtphost' options (unlike their command-line
1326 equivalents) can take a space- or comma-separated list of names
1329 All options correspond to the obvious command-line arguments, except
1330 the following: `via', `interval', `aka', `is', `to', `dns'/`no dns',
1331 `checkalias'/`no checkalias', `password', `preconnect', `postconnect',
1332 `localdomains', `stripcr'/`no stripcr', `forcecr'/`no forcecr',
1333 `pass8bits'/`no pass8bits' `dropstatus/no dropstatus', `mimedecode/no
1334 mimedecode', `idle/no idle', and `no envelope'.
1336 The `via' option is for use with ssh, or if you want to have more
1337 than one configuration pointing at the same site. If it is present,
1338 the string argument will be taken as the actual DNS name of the
1339 mailserver host to query.
1340 This will override the argument of poll, which can then simply be a
1341 distinct label for the configuration (e.g. what you would give on the
1342 command line to explicitly query this host).
1343 If the `via' name is `localhost', the poll name will also still be
1344 used as a possible match in multidrop mode; otherwise the `via' name
1345 will be used instead and the poll name will be purely a label.
1347 The `interval' option (which takes a numeric argument) allows you to poll a
1348 server less frequently than the basic poll interval. If you say
1349 \&`interval N' the server this option is attached to will only be
1350 queried every N poll intervals.
1352 The `is' or `to' keywords associate the following local (client)
1353 name(s) (or server-name to client-name mappings separated by =) with
1354 the mailserver user name in the entry. If an is/to list has `*' as
1355 its last name, unrecognized names are simply passed through.
1357 A single local name can be used to support redirecting your mail when
1358 your username on the client machine is different from your name on the
1359 mailserver. When there is only a single local name, mail is forwarded
1360 to that local username regardless of the message's Received, To, Cc,
1361 and Bcc headers. In this case
1363 never does DNS lookups.
1365 When there is more than one local name (or name mapping) the
1366 \fIfetchmail\fR code does look at the Received, To, Cc, and Bcc
1367 headers of retrieved mail (this is `multidrop mode'). It looks for
1368 addresses with hostname parts that match your poll name or your `via',
1369 `aka' or `localdomains' options, and usually also for hostname parts
1370 which DNS tells it are aliases of the mailserver. See the discussion
1371 of `dns', `checkalias', `localdomains', and `aka' for details on how
1372 matching addresses are handled.
1374 If \fIfetchmail\fR cannot match any mailserver usernames or
1375 localdomain addresses, the mail will be bounced.
1376 Normally it will be bounced to the sender, but if `nobounce' is on
1377 it will go to the postmaster (which in turn defaults to being the
1380 The `dns' option (normally on) controls the way addresses from
1381 multidrop mailboxes are checked. On, it enables logic to check each
1382 host address that doesn't match an `aka' or `localdomains' declaration
1383 by looking it up with DNS. When a mailserver username is recognized
1384 attached to a matching hostname part, its local mapping is added to
1385 the list of local recipients.
1387 The `checkalias' option (normally off) extends the lookups performed
1388 by the `dns' keyword in multidrop mode, providing a way to cope with
1389 remote MTAs that identify themselves using their canonical name, while
1390 they're polled using an alias.
1391 When such a server is polled, checks to extract the envelope address
1394 reverts to delivery using the To/Cc/Bcc headers (See below
1395 `Header vs. Envelope addresses').
1396 Specifying this option instructs
1398 to retrieve all the IP addresses associated with both the poll name
1399 and the name used by the remote MTA and to do a comparison of the IP
1400 addresses. This comes in handy in situations where the remote server
1401 undergoes frequent canonical name changes, that would otherwise
1402 require modifications to the rcfile. `checkalias' has no effect if
1403 `no dns' is specified in the rcfile.
1405 The `aka' option is for use with multidrop mailboxes. It allows you
1406 to pre-declare a list of DNS aliases for a server. This is an
1407 optimization hack that allows you to trade space for speed. When
1409 while processing a multidrop mailbox, grovels through message headers
1410 looking for names of the mailserver, pre-declaring common ones can
1411 save it from having to do DNS lookups. Note: the names you give
1412 as arguments to `aka' are matched as suffixes -- if you specify
1413 (say) `aka netaxs.com', this will match not just a hostnamed
1414 netaxs.com, but any hostname that ends with `.netaxs.com'; such as
1415 (say) pop3.netaxs.com and mail.netaxs.com.
1417 The `localdomains' option allows you to declare a list of domains
1418 which fetchmail should consider local. When fetchmail is parsing
1419 address lines in multidrop modes, and a trailing segment of a host
1420 name matches a declared local domain, that address is passed through
1421 to the listener or MDA unaltered (local-name mappings are \fInot\fR
1424 If you are using `localdomains', you may also need to specify \&`no
1425 envelope', which disables \fIfetchmail\fR's normal attempt to deduce
1426 an envelope address from the Received line or X-Envelope-To header or
1427 whatever header has been previously set by `envelope'. If you set `no
1428 envelope' in the defaults entry it is possible to undo that in
1429 individual entries by using `envelope <string>'. As a special case,
1430 \&`envelope "Received"' restores the default parsing of
1433 The \fBpassword\fR option requires a string argument, which is the password
1434 to be used with the entry's server.
1436 The `preconnect' keyword allows you to specify a shell command to be
1437 executed just before each time
1439 establishes a mailserver connection. This may be useful if you are
1440 attempting to set up secure POP connections with the aid of
1442 If the command returns a nonzero status, the poll of that mailserver
1445 Similarly, the `postconnect' keyword similarly allows you to specify a
1446 shell command to be executed just after each time a mailserver
1447 connection is taken down.
1449 The `forcecr' option controls whether lines terminated by LF only are
1450 given CRLF termination before forwarding. Strictly speaking RFC821
1451 requires this, but few MTAs enforce the requirement it so this option
1452 is normally off (only one such MTA, qmail, is in significant use at
1455 The `stripcr' option controls whether carriage returns are stripped
1456 out of retrieved mail before it is forwarded. It is normally not
1457 necessary to set this, because it defaults to `on' (CR stripping
1458 enabled) when there is an MDA declared but `off' (CR stripping
1459 disabled) when forwarding is via SMTP. If `stripcr' and `forcecr' are
1460 both on, `stripcr' will override.
1462 The `pass8bits' option exists to cope with Microsoft mail programs that
1463 stupidly slap a "Content-Transfer-Encoding: 7bit" on everything. With
1464 this option off (the default) and such a header present,
1466 declares BODY=7BIT to an ESMTP-capable listener; this causes problems for
1467 messages actually using 8-bit ISO or KOI-8 character sets, which will
1468 be garbled by having the high bits of all characters stripped. If
1469 \&`pass8bits' is on,
1471 is forced to declare BODY=8BITMIME to any ESMTP-capable listener. If
1472 the listener is 8-bit-clean (as all the major ones now are) the right
1473 thing will probably result.
1475 The `dropstatus' option controls whether nonempty Status and
1476 X-Mozilla-Status lines are retained in fetched mail (the default) or
1477 discarded. Retaining them allows your MUA to see what messages (if
1478 any) were marked seen on the server. On the other hand, it can
1479 confuse some new-mail notifiers, which assume that anything with a
1480 Status line in it has been seen. (Note: the empty Status lines
1481 inserted by some buggy POP servers are unconditionally discarded.)
1483 The `mimedecode' option controls whether MIME messages using the
1484 quoted-printable encoding are automatically converted into pure 8-bit
1485 data. If you are delivering mail to an ESMTP-capable, 8-bit-clean
1486 listener (that includes all of the major MTAs like sendmail), then
1487 this will automatically convert quoted-printable message headers and
1488 data into 8-bit data, making it easier to understand when reading
1489 mail. If your e-mail programs know how to deal with MIME messages,
1490 then this option is not needed. The mimedecode option is off by
1491 default, because doing RFC2047 conversion on headers throws away
1492 character-set information and can lead to bad results if the encoding
1493 of the headers differs from the body encoding.
1495 The `idle' option is usable only with IMAP servers supporting the
1496 RFC2177 IDLE command extension. If it is enabled, and fetchmail
1497 detects that IDLE is supported, an IDLE will be issued at the end
1498 of each poll. This will tell the IMAP server to hold the connection
1499 open and notify the client when new mail is available. If you need to
1500 poll a link frequently, IDLE can save bandwidth by eliminating TCP/IP
1501 connects and LOGIN/LOGOUT sequences. On the other hand, an IDLE
1502 connection will eat almost akll of your fetchmail's time, because it
1503 will never drop the connection and allow other pools to occur unless
1504 the server times out the IDLE.
1506 The `properties' option is an extension mechanism. It takes a string
1507 argument, which is ignored by fetchmail itself. The string argument may be
1508 used to store configuration information for scripts which require it.
1509 In particular, the output of `--configdump' option will make properties
1510 associated with a user entry readily available to a Python script.
1512 .SS Miscellaneous Run Control Options
1513 The words `here' and `there' have useful English-like
1514 significance. Normally `user eric is esr' would mean that
1515 mail for the remote user `eric' is to be delivered to `esr',
1516 but you can make this clearer by saying `user eric there is esr here',
1517 or reverse it by saying `user esr here is eric there'
1519 Legal protocol identifiers for use with the `protocol' keyword are:
1526 imap-k4 (or IMAP-K4)
1527 imap-gss (or IMAP-GSS)
1528 imap-crammd5 (or IMAP-CRAMMD5)
1529 imap-login (or IMAP-LOGIN)
1534 Legal authentication types are `password' or `kerberos'. The former
1535 specifies authentication by normal transmission of a password (the
1536 password may be plaintext or subject to protocol-specific encryption
1537 as in APOP); the second tells \fIfetchmail\fR to try to get a Kerberos
1538 ticket at the start of each query instead, and send an arbitrary
1539 string as the password.
1541 Specifying `kpop' sets POP3 protocol over port 1109 with Kerberos V4
1542 preauthentication. These defaults may be overridden by later options.
1544 There are currently four global option statements; `set logfile'
1545 followed by a string sets the same global specified by --logfile. A
1546 command-line --logfile option will override this. Also, `set daemon'
1547 sets the poll interval as --daemon does. This can be overridden by a
1548 command-line --daemon option; in particular --daemon 0 can be used to
1549 force foreground operation. The `set postmaster' statement sets the
1550 address to which multidrop mail defaults if there are no local
1551 matches. Finally, `set syslog' sends log messages to syslogd(8).
1553 .SH INTERACTION WITH RFC 822
1554 When trying to determine the originating address of a message,
1555 fetchmail looks through headers in the following order:
1565 The originating address is used for logging, and to set the MAIL FROM
1566 address when forwarding to SMTP. This order is intended to cope
1567 gracefully with receiving mailing list messages in multidrop mode. The
1568 intent is that if a local address doesn't exist, the bounce message
1569 won't be returned blindly to the author or to the list itself, but
1570 rather to the list manager (which is less annoying).
1572 In multidrop mode, destination headers are processed as follows:
1573 First, fetchmail looks for the Received: header (or whichever one is
1574 specified by the `envelope' option) to determine the local
1575 recipient address. If the mail is addressed to more than one recipient,
1576 the Received line won't contain any information regarding recipient addresses.
1578 Then fetchmail looks for the Resent-To:, Resent-Cc:, and Resent-Bcc:
1579 lines. If they exists, they should contain the final recipients and
1580 have precedence over their To:/Cc:/Bcc: counterparts. If the Resent-*
1581 lines doesn't exist, the To:, Cc:, Bcc: and Apparently-To: lines are
1582 looked for. (The presence of a Resent-To: is taken to imply that the
1583 person referred by the To: address has already received the original
1586 .SH CONFIGURATION EXAMPLES
1590 poll SERVERNAME protocol PROTOCOL username NAME password PASSWORD
1596 poll pop.provider.net protocol pop3 username "jsmith" password "secret1"
1599 Or, using some abbreviations:
1602 poll pop.provider.net proto pop3 user "jsmith" password "secret1"
1605 Multiple servers may be listed:
1608 poll pop.provider.net proto pop3 user "jsmith" pass "secret1"
1609 poll other.provider.net proto pop2 user "John.Smith" pass "My^Hat"
1612 Here's a version of those two with more whitespace and some noise words:
1615 poll pop.provider.net proto pop3
1616 user "jsmith", with password secret1, is "jsmith" here;
1617 poll other.provider.net proto pop2:
1618 user "John.Smith", with password "My^Hat", is "John.Smith" here;
1621 This version is much easier to read and doesn't cost significantly
1622 more (parsing is done only once, at startup time).
1625 If you need to include whitespace in a parameter string, enclose the
1626 string in double quotes. Thus:
1629 poll mail.provider.net with proto pop3:
1630 user "jsmith" there has password "u can't krak this"
1631 is jws here and wants mda "/bin/mail"
1634 You may have an initial server description headed by the keyword
1635 `defaults' instead of `poll' followed by a name. Such a record
1636 is interpreted as defaults for all queries to use. It may be overwritten
1637 by individual server descriptions. So, you could write:
1642 poll pop.provider.net
1644 poll mail.provider.net
1645 user "jjsmith" there has password "secret2"
1648 It's possible to specify more than one user per server (this is only
1649 likely to be useful when running fetchmail in daemon mode as root).
1650 The `user' keyword leads off a user description, and every user specification
1651 in a multi-user entry must include it. Here's an example:
1654 poll pop.provider.net proto pop3 port 3111
1655 user "jsmith" with pass "secret1" is "smith" here
1656 user jones with pass "secret2" is "jjones" here
1659 This associates the local username `smith' with the pop.provider.net
1660 username `jsmith' and the local username `jjones' with the
1661 pop.provider.net username `jones'.
1663 Here's what a simple retrieval configuration for a multi-drop mailbox
1667 poll pop.provider.net:
1668 user maildrop with pass secret1 to golux hurkle=happy snark here
1671 This says that the mailbox of account `maildrop' on the server is a
1672 multi-drop box, and that messages in it should be parsed for the
1673 server user names `golux', `hurkle', and `snark'. It further
1674 specifies that `golux' and `snark' have the same name on the
1675 client as on the server, but mail for server user `hurkle' should be
1676 delivered to client user `happy'.
1678 Here's an example of another kind of multidrop connection:
1681 poll pop.provider.net localdomains loonytoons.org toons.org:
1682 user maildrop with pass secret1 to esr * here
1685 This also says that the mailbox of account `maildrop' on the server is
1686 a multi-drop box. It tells fetchmail that any address in the
1687 loonytoons.org or toons.org domains (including subdomain addresses like
1688 `joe@daffy.loonytoons.org') should be passed through to the local SMTP
1689 listener without modification. Be careful of mail loops if you do this!
1691 Here's an example configuration using ssh. The queries go through an
1692 ssh connecting local port 1234 to port 110 on mailhost.net; the
1693 preconnect command sets up the ssh.
1696 poll mailhost.net via localhost port 1234 with proto pop3:
1697 preconnect "ssh -f -L 1234:mailhost.net:110
1698 mailhost.net sleep 20 </dev/null >/dev/null";
1701 .SH THE USE AND ABUSE OF MULTIDROP MAILBOXES
1702 Use the multiple-local-recipients feature with caution -- it can bite.
1703 Also note that all multidrop features are ineffective in ETRN mode.
1705 Also, note that in multidrop mode duplicate mails are suppressed. A
1706 piece of mail is considered duplicate if it has the same message-ID as
1707 the message immediately preceding and more than one addressee. Such
1708 runs of messages may be generated when copies of a message addressed
1709 to multiple users are delivered to a multidrop box.
1711 .SS Header vs. Envelope addresses
1712 The fundamental problem is that by having your mailserver toss several
1713 peoples' mail in a single maildrop box, you may have thrown away
1714 potentially vital information about who each piece of mail was
1715 actually addressed to (the `envelope address', as opposed to the
1716 header addresses in the RFC822 To/Cc/Bcc headers). This `envelope
1717 address' is the address you need in order to reroute mail properly.
1721 can deduce the envelope address. If the mailserver MTA is
1723 and the item of mail had just one recipient, the MTA will have written
1724 a `by/for' clause that gives the envelope addressee into its Received
1725 header. But this doesn't work reliably for other MTAs, nor if there is
1726 more than one recipient. By default, \fIfetchmail\fR looks for
1727 envelope addresses in these lines; you can restore this default with
1728 -E "Received" or \&`envelope Received'.
1730 Alternatively, some SMTP listeners and/or mail servers insert a header
1731 in each message containing a copy of the envelope addresses. This
1732 header (when it exists) is often `X-Envelope-To'. Fetchmail's
1733 assumption about this can be changed with the -E or `envelope' option.
1734 Note that writing an envelope header of this kind exposes the names of
1735 recipients (including blind-copy recipients) to all receivers of the
1736 messages; it is therefore regarded by some administrators as a
1737 security/privacy problem.
1739 A slight variation of the `X-Envelope-To' header is the `Delivered-To' put
1740 by qmail to avoid mail loops. It will probably prefix the user name with a
1741 string that normally matches the user's domain. To remove this prefix you
1742 can use the -Q or `qvirtual' option.
1744 Sometimes, unfortunately, neither of these methods works. When they
1745 all fail, fetchmail must fall back on the contents of To/Cc/Bcc
1746 headers to try to determine recipient addressees -- and these are not
1747 reliable. In particular, mailing-list software often ships mail with
1748 only the list broadcast address in the To header.
1752 cannot deduce a recipient address that is local, and the intended
1753 recipient address was anyone other than fetchmail's invoking user,
1754 mail will get lost. This is what makes the multidrop feature risky.
1756 A related problem is that when you blind-copy a mail message, the Bcc
1757 information is carried \fIonly\fR as envelope address (it's not put
1758 in the headers fetchmail can see unless there is an X-Envelope
1759 header). Thus, blind-copying to someone who gets mail over a
1760 fetchmail link will fail unless the the mailserver host routinely
1761 writes X-Envelope or an equivalent header into messages in your maildrop.
1763 .SS Good Ways To Use Multidrop Mailboxes
1764 Multiple local names can be used to administer a mailing list from the
1765 client side of a \fIfetchmail\fR collection. Suppose your name is
1766 \&`esr', and you want to both pick up your own mail and maintain a mailing
1767 list called (say) "fetchmail-friends", and you want to keep the alias
1768 list on your client machine.
1770 On your server, you can alias \&`fetchmail-friends' to `esr'; then, in
1771 your \fI.fetchmailrc\fR, declare \&`to esr fetchmail-friends here'.
1772 Then, when mail including `fetchmail-friends' as a local address
1773 gets fetched, the list name will be appended to the list of
1774 recipients your SMTP listener sees. Therefore it will undergo alias
1775 expansion locally. Be sure to include `esr' in the local alias
1776 expansion of fetchmail-friends, or you'll never see mail sent only to
1777 the list. Also be sure that your listener has the "me-too" option set
1778 (sendmail's -oXm command-line option or OXm declaration) so your name
1779 isn't removed from alias expansions in messages you send.
1781 This trick is not without its problems, however. You'll begin to see
1782 this when a message comes in that is addressed only to a mailing list
1783 you do \fInot\fR have declared as a local name. Each such message
1784 will feature an `X-Fetchmail-Warning' header which is generated
1785 because fetchmail cannot find a valid local name in the recipient
1786 addresses. Such messages default (as was described above) to being
1787 sent to the local user running
1789 but the program has no way to know that that's actually the right thing.
1791 .SS Bad Ways To Abuse Multidrop Mailboxes
1792 Multidrop mailboxes and
1794 serving multiple users in daemon mode do not mix. The problem, again, is
1795 mail from mailing lists, which typically does not have an individual
1796 recipient address on it. Unless
1798 can deduce an envelope address, such mail will only go to the account
1799 running fetchmail (probably root). Also, blind-copied users are very
1800 likely never to see their mail at all.
1802 If you're tempted to use
1804 to retrieve mail for multiple users from a single mail drop via POP or
1805 IMAP, think again (and reread the section on header and envelope
1806 addresses above). It would be smarter to just let the mail sit in the
1807 mailserver's queue and use fetchmail's ETRN mode to trigger SMTP sends
1808 periodically (of course, this means you have to poll more frequently
1809 than the mailserver's expiry period). If you can't arrange this, try
1810 setting up a UUCP feed.
1812 If you absolutely \fImust\fR use multidrop for this purpose, make sure
1813 your mailserver writes an envelope-address header that fetchmail can
1814 see. Otherwise you \fIwill\fR lose mail and it \fIwill\fR come back
1817 .SS Speeding Up Multidrop Checking
1818 Normally, when multiple user are declared
1820 extracts recipient addresses as described above and checks each host
1821 part with DNS to see if it's an alias of the mailserver. If so, the
1822 name mappings described in the to ... here declaration are done and
1823 the mail locally delivered.
1825 This is the safest but also slowest method. To speed it up,
1826 pre-declare mailserver aliases with `aka'; these are checked before
1827 DNS lookups are done. If you're certain your aka list contains
1829 DNS aliases of the mailserver (and all MX names pointing at it)
1830 you can declare `no dns' to suppress DNS lookups entirely and
1831 \fIonly\fR match against the aka list.
1834 To facilitate the use of
1836 in shell scripts, an exit code is returned to give an indication
1837 of what occurred during a given connection.
1839 The exit codes returned by
1843 One or more messages were successfully retrieved (or, if the -c option
1844 was selected, were found waiting but not retrieved).
1846 There was no mail awaiting retrieval. (There may have been old mail still
1847 on the server but not selected for retrieval.)
1849 An error was encountered when attempting to open a socket to retrieve
1850 mail. If you don't know what a socket is, don't worry about it --
1851 just treat this as an 'unrecoverable error'.
1853 The user authentication step failed. This usually means that a bad
1854 user-id, password, or APOP id was specified. Or it may mean that you
1855 tried to run fetchmail under circumstances where it did not have
1856 standard input attached to a terminal and could not prompt for a
1859 Some sort of fatal protocol error was detected.
1861 There was a syntax error in the arguments to
1864 The run control file had bad permissions.
1866 There was an error condition reported by the server. Can also
1869 timed out while waiting for the server.
1871 Client-side exclusion error. This means
1873 either found another copy of itself already running, or failed in such
1874 a way that it isn't sure whether another copy is running.
1876 The user authentication step failed because the server responded "lock
1877 busy". Try again after a brief pause! This error is not implemented
1878 for all protocols, nor for all servers. If not implemented for your
1879 server, "3" will be returned instead, see above. May be returned when
1880 talking to qpopper or other servers that can respond with "lock busy"
1881 or some similar text containing the word "lock".
1885 run failed while trying to do an SMTP port open or transaction.
1887 Fatal DNS error. Fetchmail encountered an error while performing
1888 a DNS lookup at startup and could not proceed.
1890 BSMTP batch file could not be opened.
1892 Poll terminated by a fetch limit (see the --fetchlimit option).
1894 Internal error. You should see a message on standard error with
1899 queries more than one host, return status is 0 if \fIany\fR query
1900 successfully retrieved mail. Otherwise the returned error status is
1901 that of the last host queried.
1904 Eric S. Raymond <esr@snark.thyrsus.com>. Too many other people to
1905 name here have contributed code and patches.
1906 This program is descended from and replaces
1908 by Carl Harris <ceharris@mal.com>; the internals have become quite different,
1909 but some of its interface design is directly traceable to that
1915 default run control file
1918 default location of file associating hosts with last message IDs seen
1919 (used only with newer RFC1725-compliant POP3 servers supporting the
1923 lock file to help prevent concurrent runs (non-root mode).
1926 your FTP run control file, which (if present) will be searched for
1927 passwords as a last resort before prompting for one interactively.
1929 /var/run/fetchmail.pid
1930 lock file to help prevent concurrent runs (root mode, Linux systems).
1933 lock file to help prevent concurrent runs (root mode, systems without /var/run).
1936 If either the LOGNAME or USER variable is correctly set
1937 (e.g. the corresponding UID matches the session user ID) then that
1938 name is used as the default local name. Otherwise \fBgetpwuid\fR(3)
1939 must be able to retrieve a password entry for the session ID (this
1940 elaborate logic is designed to handle the case of multiple names per
1943 If the environment variable FETCHMAILHOME is set to a valid and
1944 existing directory name, the .fetchmailrc and .fetchids and
1945 \&.fetchmail.pid files are put there instead of in the invoking user's
1946 home directory (and lose the leading dots on theirt names). The
1947 \&.netrc file is looked for in the the invoking user's home directory
1948 regardless of FETCHMAILHOME's setting.
1953 daemon is running as root, SIGHUP wakes it up from its sleep phase and
1954 forces a poll of all non-skipped servers (this is in accordance with
1955 the usual conventions for system daemons).
1959 is running in daemon mode as non-root, use SIGUSR1 to wake it (this is
1960 so SIGHUP due to logout can retain the default action of killing it).
1964 in foreground while a background fetchmail is running will do
1965 whichever of these is appropriate to wake it up.
1967 .SH BUGS AND KNOWN PROBLEMS
1968 The RFC822 address parser used in multidrop mode chokes on some
1969 @-addresses that are technically legal but bizarre. Strange uses of
1970 quoting and embedded comments are likely to confuse it.
1972 In a message with multiple envelope headers, only the last one
1973 processed will be visible to fetchmail. To get around this, use a
1974 mailserver-side filter that consolidates the contents of all envelope
1975 headers into a single one (procmail, mailagent, or maildrop can be
1976 programmed to do this fairly easily).
1978 Use of any of the supported protocols other than POP3 with OTP or RPA,
1979 APOP, KPOP, IMAP-K4, IMAP-GSS, IMAP-CRAMMD5, or ETRN requires that the
1980 program send unencrypted passwords over the TCP/IP connection to the
1981 mailserver. This creates a risk that name/password pairs might be
1982 snaffled with a packet sniffer or more sophisticated monitoring
1983 software. Under Linux and FreeBSD, the --interface option can be used
1984 to restrict polling to availability of a specific interface device
1985 with a specific local IP address, but snooping is still possible if
1986 (a) either host has a network device that can be opened in promiscuous
1987 mode, or (b) the intervening network link can be tapped.
1989 Use of the %F or %T escapes in an mda option could open a security
1990 hole, because they pass text manipulable by an attacker to a shell
1991 command. Potential shell characters are replaced by `_' before
1992 execution. The hole is further reduced by the fact that fetchmail
1993 temporarily discards any suid privileges it may have while running the
1994 MDA. For maximum safety, however, don't use an mda command containing
1995 %F or %T when fetchmail is run from the root account itself.
1997 Fetchmail's method of sending bouncemail requires that port 25 of localhost
1998 be available for sending mail via SMTP.
2002 while a background instance is running and break the syntax, the
2003 background instance will die silently. Unfortunately, it can't
2004 die noisily because we don't yet know whether syslog should be enabled.
2006 The RFC 2177 IDLE support is flaky. It sort of works, but may generate
2007 spurious socket error messages or silently hang in the presence of
2008 various network or server errors.
2010 The combination of using a remote name with embedded spaces and POP3
2011 UIDs will not work; the UIDL-handling code will core-dump while trying
2012 to read in what it sees as malformed .fetchids lines, typically
2013 on the second poll after startup.
2015 The UIDL code is generally flaky and tends to lose its state on errors
2016 and line drops (so that old messages are re-seen). If this happens to
2017 you, switch to IMAP4.
2019 Send comments, bug reports, gripes, and the like to the
2020 fetchmail-friends list <fetchmail-friends@ccil.org>. An HTML FAQ is
2021 available at the fetchmail home page; surf to
2022 http://www.tuxedo.org/~esr/fetchmail or do a WWW search for pages with
2023 `fetchmail' in their titles.
2026 mutt(1), elm(1), mail(1), sendmail(8), popd(8), imapd(8)
2027 .SH APPLICABLE STANDARDS
2030 RFC 821, RFC 1869, RFC 1652, RFC 1870, RFC1983, RFC 1985
2033 RFC 822, RFC 1892, RFC 1894
2039 RFC 1081, RFC 1225, RFC 1460, RFC 1725, RFC 1939, RFC 1957, RFC2195, RFC 2449
2042 RFC 1460, RFC 1725, RFC 1939
2051 RFC 1730, RFC 1731, RFC 1732, RFC 2060, RFC 2061, RFC 2195, RFC 2177,