1 .\" For license terms, see the file COPYING in this directory.
4 fetchmail \- fetch mail from a POP or IMAP server
7 \fBfetchmail\fR [\fIoptions\fR] [\fImailserver...\fR]
11 is a mail-retrieval and forwarding utility; it fetches
12 mail from remote mailservers and forwards it to your local (client)
13 machine's delivery system. You can then handle the retrieved mail
14 using normal mail user agents such as \fIelm\fR(1) or \fIMail\fR(1).
15 The \fBfetchmail\fR utility can be run in a daemon mode to repeatedly
16 poll one or more systems at a specified interval.
20 program can gather mail from servers supporting any of the common
21 mail-retrieval protocols: POP2 (as specified in RFC 937), POP3 (RFC
22 1939), IMAP2bis (as implemented by the 4.4BSD imapd program), and
23 IMAP4 (as specified by RFC 1730). It can use (but does not require)
24 the LAST facility removed from later POP3 versions.
28 is primarily intended to be used over on-demand TCP/IP links (such as
29 SLIP or PPP connections), it may also be useful as a message transfer
30 agent for sites which refuse for security reasons to permit
31 (sender-initiated) SMTP transactions with sendmail.
33 As each message is retrieved \fIfetchmail\fR normally delivers it via SMTP to
34 port 25 on the machine it is running on (localhost), just as though it
35 were being passed in over a normal TCP/IP link. The mail will then be
36 delivered locally via your system's MDA (Mail Delivery Agent, usually
37 \fIsendmail\fR(8) but your system may use a different one such
38 as \fIsmail\fR, \fImmdf\fR, or \fIqmail\fR). All the delivery-control
39 mechanisms (such as \fI.forward\fR files) normally available through
40 your system MDA will therefore work.
44 is controlled by command-line options and a run control file,
45 \fI~/.fetchmailrc\fR, the syntax of which we describe below. Command-line
50 Each server name that you specify following the options on the
51 command line will be queried. If you don't specify any servers
52 on the command line, each server in your
56 To facilitate the use of
58 In scripts, pipelines, etc., it returns an appropriate exit code upon
59 termination -- see EXIT CODES below.
62 The following options modify the behavior of \fIfetchmail\fR. It is
63 seldom necessary to specify any of these once you have a
64 working \fI.fetchmailrc\fR file set up.
66 Some special options are not covered here, but are documented insttead
67 in sections on AUTHENTICATION and DAEMON MODE which follows.
71 Displays the version information for your copy of
73 No mail fetch is performed.
74 Instead, for each server specified, all option information
75 that would be computed if
77 were connecting to that server is displayed. Any non-printables in
78 passwords or other string names are shown as backslashed C-like
79 escape sequences. This option is useful for verifying that your
80 options are set the way you want them.
83 Return a status code to indicate whether there is mail waiting,
84 without actually fetching or deleting mail (see EXIT CODES below).
85 This option doesn't play well with queries to multiple sites, and
86 is ignored in daemon mode. It's also prone to false positives if
87 you leave read but undeleted mail in your server mailbox.
90 Silent mode. Suppresses all progress/status messages that are normally
91 echoed to standard error during a fetch. The --verbose option
95 Verbose mode. All control messages passed between
97 and the mailserver are echoed to stderr. Overrides --silent.
100 Retrieve both old (seen) and new messages from the mailserver. The
101 default is to fetch only messages the server has not marked seen.
102 Note that POP2 retrieval behaves as though --all is always on (see
103 RETRIEVAL FAILURE MODES below).
106 Keep retrieved messages on the remote mailserver. Normally, messages
107 are deleted from the folder on the mailserver after they have been retrieved.
110 option causes retrieved messages to remain in your folder on the mailserver.
113 Delete retrieved messages from the remote mailserver. This
114 option forces retrieved mail to be deleted. It may be useful if
115 you have specified a default of \fBnokill\fR in your \fI.fetchmailrc\fR.
118 POP3/IMAP only. Delete old (previously retrieved) messages from the mailserver
119 before retrieving new messages.
120 .SS Protocol and Query Options
122 .B \-p, \--protocol proto
123 Specify the protocol to used when communicating with the remote
124 mailserver. If no protocol is specified,
126 will try each of the supported protocols in turn, terminating after
127 any successful attempt.
129 may be one of the following:
132 IMAP2bis, a compatible subset of IMAP4.
134 Post Office Protocol 2
136 Post Office Protocol 3
138 Use POP3 with MD5 authentication.
140 Use POP3 with RPOP authentication.
142 Use POP3 with Kerberos authentication on port 1109.
146 The option permits you to specify a TCP/IP port to connect on.
147 This option will seldom be necessary as all the supported protocols have
148 well-established default port numbers.
150 .B \-r folder, --remote folder
151 Causes a specified non-default mail folder on the mailserver to be retrieved.
152 The syntax of the folder name is server dependent, as is the default
153 behavior when no folder is specified. This option is not available
155 .SS Delivery Control Options
157 .B \-S host, --smtphost host
158 Specify a host to forward mail to (other than localhost).
161 You can force mail to be passed to an MDA directly (rather than
162 forwarded to port 25) with the -mda or -m option. If \fIfetchmail\fR
163 is running as root, it sets its userid to that of the target user
164 while delivering mail through an MDA. Some possible MDAs are
165 "/usr/sbin/sendmail -oem", "/usr/lib/sendmail -oem",
166 "/usr/bin/formail", and "/usr/bin/deliver". Local delivery addresses
167 will be inserted into the MDA command wherever you place a %s. Do
168 \fInot\fR use an MDA like
169 "sendmail -oem -t" that dispatches on the contents of To/Cc/Bcc, it
170 will create mail loops and bring the just wrath of many postmasters
172 .SS Resource Limit Control Options
175 Takes a maximum octet size argument. Messages larger than this size
176 will not be fetched, not be marked seen, and will be left on the
177 server (in foreground sessions, the progress messages will note that
178 they are "oversized"). The --all option overrides this one. This
179 option is intended for those needing to strictly control fetch time
180 in interactive mode. It may not be used with daemon mode,
181 as users would never receive a notification that messages were waiting.
184 Specify the maximum number of messages that will be shipped to an SMTP
185 listener before the connection is deliberately torn down and rebuilt
186 (defaults to 0, meaning no limit). While \fBsendmail\fR(8) normally
187 initiates delivery of a message immediately after receiving the
188 message terminator, some SMTP listeners are not so prompt. MTAs like
189 \fIqmail\fR(8) and \fIsmail\fR(8) will wait till the delivery socket is
190 shut down to deliver. This may produce annoying delays when
192 is processing very large batches. Setting the batch limit to some
193 nonzero size will prevent these delays.
196 Limit the number of messages accepted from a given server in a single
197 poll. By default there is no limit.
198 .SS Authentication Options
200 .B \-u name, --username name
201 Specifies the user identification to be used when logging in to the mailserver.
202 The appropriate user identification is both server and user-dependent.
203 The default is your login name on the client machine that is running
205 See USER AUTHENTICATION below for a complete description.
207 .B \-I specification, --interface specification
208 Require that a specific interface device be up and have a specific local
209 IP address (or range) before polling. Frequently
211 is used over a transient point-to-point TCP/IP link established directly
212 to a mailserver via SLIP or PPP. That is a relatively secure channel.
213 But when other TCP/IP routes to the mailserver exist (e.g. when the link
214 is connected to an alternate ISP), your username and password may be
215 vulnerable to snooping (especially when daemon mode automatically polls
216 for mail, shipping a clear password over the net at predictable
217 intervals). The --interface option may be used to prevent this. When
218 the specified link is not up or is not connected to a matching IP
219 address, polling will be skipped. The format is:
221 interface/iii.iii.iii.iii/mmm.mmm.mmm.mmm
223 The field before the first slash is the interface name (i.e. sl0, ppp0
224 etc.). The field before the second slash is the acceptable IP address.
225 The field after the second slash is a mask which specifies a range of
226 IP addresses to accept. If no mask is present 255.255.255.255 is
227 assumed (i.e. an exact match). This option is currently only supported
230 .B \-M interface, --monitor interface
231 Daemon mode can cause transient links which are automatically taken down
232 after a period of inactivity (e.g. PPP links) to remain up
233 indefinitely. This option identifies a system TCP/IP interface to be
234 monitored for activity. After each poll interval, if the link is up and
235 no other activity has occurred on the link then the poll will be
236 skipped. This option is currently only supported under Linux.
239 This option permits you to specify an authentication type (see USER
240 AUTHENTICATION below for details). The possible values are
241 \&`\fBpassword\fR' and `\fBkerberos\fR'. This option is provided
242 primarily for developers; choosing KPOP protocol automatically selects
243 Kerberos authentication, and all other alternatives use ordinary
244 password authentication (though APOP uses a generated one-time
245 key as the password).
246 .SS Miscellaneous Options
248 .B \-f pathname, --fetchmailrc pathname
249 Specify a non-default name for the
253 .B \-i pathname, --idfile pathname
254 Specify an alternate name for the .fetchids file used to save POP3
260 edits RFC-822 address headers (To, From, Cc, Bcc, and Reply-To) in
261 fetched mail so that any mail IDs local to the server are expanded to
262 full addresses (@ and the mailserver hostname are appended). This enables
263 replies on the client to get addressed correctly (otherwise your
264 mailer might think they should be addressed to local users on the
265 client machine!). This option disables the rewrite. (This option is
266 provided to pacify people who are paranoid about having an MTA edit
267 mail headers and want to know they can prevent it, but it is generally
268 not a good idea to actually turn off rewrite.)
271 This option changes the header
273 assumes will carry a copy of the mail's envelope address. Normally
274 this is `X-Envelope-To' but as this header is not standard, practice
275 varies. See the discussion of multidrop address handling below.
277 .SH USER AUTHENTICATION
278 Normal user authentication in
280 is very much like the authentication mechanism of
282 The correct user-id and password depend upon the underlying security
283 system at the mailserver.
285 If the mailserver is a Unix machine on which you have an ordinary user
286 account, your regular login name and password are used with
288 If you use the same login name on both the server and the client machines,
289 you needn't worry about specifying a user-id with the
292 the default behavior is to use your login name on the client machine as the
293 user-id on the server machine. If you use a different login name
294 on the server machine, specify that login name with the
296 option. e.g. if your login name is 'jsmith' on a machine named 'mailgrunt',
301 fetchmail -u jsmith mailgrunt
303 The default behavior of
305 is to prompt you for your mailserver password before the connection is
306 established. This is the safest way to use
308 and ensures that your password will not be compromised. You may also specify
309 your password in your
311 file. This is convenient when using
313 in daemon mode or with scripts.
315 If you do not specify a password, and
317 cannot extract one from your
319 file, it will look for a
321 file in your home directory before requesting one interactively; if an
322 entry matching the mailserver is found in that file, the password will
325 man page for details of the syntax of the
327 file. (This feature may allow you to avoid duplicating password
328 information in more than one file.)
330 On mailservers that do not provide ordinary user accounts, your user-id and
331 password are usually assigned by the server administrator when you apply for
332 a mailbox on the server. Contact your server administrator if you don't know
333 the correct user-id and password for your mailbox account.
335 Early versions of POP3 (RFC1081, RFC1225) supported a crude form of
336 independent authentication using the
338 file on the mailserver side. Under this RPOP variant, a fixed
339 per-user ID equivalent to a password was sent in clear over a link to
340 a reserved port, with the command RPOP rather than PASS to alert the
341 server that it should do special checking. RPOP is supported
344 (you can specify `protocol RPOP' to have the program send `RPOP'
345 rather than `PASS') but its use is strongly discouraged. This
346 facility was vulnerable to spoofing and was withdrawn in RFC1460.
348 RFC1460 introduced APOP authentication. In this variant of POP3,
349 you register an APOP password on your server host (the program
350 to do this with on the server is probably called \fIpopauth\fR(8)). You
351 put the same password in your
355 logs in, it sends a cryptographically secure hash of your password and
356 the server greeting time to the server, which can verify it by
357 checking its authorization database.
359 If your \fIfetchmail\fR was built with Kerberos support and you specify
360 Kerberos authentication (either with --auth or the \fI.fetchmailrc\fR
361 option \fBauthenticate kerberos\fR) it will try to get a Kerberos
362 ticket from the mailserver at the start of each query.
371 in daemon mode. You must specify a numeric argument which is a
372 polling interval in seconds.
376 puts itself in background and runs forever, querying each specified
377 host and then sleeping for the given polling interval.
383 will, therefore, poll all the hosts described in your
385 file (except those explicitly excluded with the `skip' verb) once
386 every fifteen minutes.
388 Only one daemon process is permitted per user; in daemon mode,
390 makes a per-user lockfile to guarantee this. The option
392 will kill a running daemon process. Otherwise, calling fetchmail with
393 a daemon in the background sends a wakeup signal to the daemon,
394 forcing it to poll mailservers immediately.
400 option allows you to set a server-nonresponse timeout in seconds. If
401 a mailserver does not send a greeting message or respond to commands for
402 the given number of seconds, \fIfetchmail\fR will hang up on it.
403 Without such a timeout \fIfetchmail\fR might hang up indefinitely
404 trying to fetch mail from a down host. This would be particularly
405 annoying for a \fIfetchmail\fR running in background.
411 option allows you to redirect status messages emitted while in daemon
412 mode into a specified logfile (follow the option with the logfile name).
413 The logfile is opened for append, so previous messages aren't deleted.
414 This is primarily useful for debugging configurations.
418 option allows you to redirect status and error messages emitted while in
421 system daemon if available.
422 Messages are logged with an id of \fBfetchmail\fR, the facility \fBLOG_MAIL\fR,
423 and priorities \fBLOG_ERR\fR, \fBLOG_ALERT\fR or \fBLOG_INFO\fR.
424 This option is intended for logging status and error messages which
425 indicate the status of the daemon and the results while fetching mail
427 Error messages for command line options and parsing the \fI.fetchmailrc\fR
428 file are still written to stderr, or the specified log file if the
434 The \fI/etc/syslog.conf\fR file might contain the following to log
435 all messages from \fIfetchmail\fR to a single file:
440 *.* /var/log/fetchmail
445 or --nodetach option suppresses detachment of the daemon process
446 from its control terminal. This is primarily useful for debugging.
448 Note that while running in daemon mode, transient errors (such as DNS
449 failures or sendmail delivery refusals) may force the fetchall
450 option on for the duration of the next polling cycle.
451 This is a robustness feature. It means that if a message is fetched
452 (and thus marked seen by the mailserver) but not delivered locally
453 due to some transient error, it will be re-fetched during the next
456 .SH RETRIEVAL FAILURE MODES
457 The protocols \fIfetchmail\fR uses to talk to mailservers are next to
458 bulletproof. In normal operation forwarding to port 25, no message is
459 ever deleted (or even marked for deletion) on the host until the SMTP
460 listener on the client has acknowledged to \fIfetchmail\fR that the
461 message has been accepted for delivery. When forwarding to an MDA,
462 however, there is more possibility of error (because there's no way
463 for fetchmail to get a reliable positive acknowledgement from the MDA).
465 The normal mode of \fIfetchmail\fR is to try to download only `new'
466 messages, leaving untouched (and undeleted) messages you have already
467 read directly on the server (or fetched with a previous \fIfetchmail
468 --keep\fR). But you may find that messages you've already read on the
469 server are being fetched (and deleted) even when you don't specify
470 --all. There are several reasons this can happen.
472 One could be that you're using POP2. The POP2 protocol includes no
473 representation of `new' or `old' state in messages, so \fIfetchmail\fR
474 must treat all messages as new all the time. But POP2 is obsolete, so
477 Under POP3, blame RFC1725. That version of the POP3 protocol
478 specification removed the LAST command, and some POP servers follow it
479 (you can verify this by invoking \fIfetchmail -v\fR to the mailserver
480 and watching the response to LAST early in the query). The
481 \fIfetchmail\fR code tries to compensate by using POP3's UID feature,
482 storing the identifiers of messages seen in each session until the
483 next session, in the \fI.fetchids\fR file. But this doesn't track
484 messages seen with other clients, or read directly with a mailer on
485 the host but not deleted afterward. A better solution would be to
488 Another potential POP3 problem might be servers that insert messages
489 in the middle of mailboxes (some VMS implementations of mail are
490 rumored to do this). The \fIfetchmail\fR code assumes that new
491 messages are appended to the end of the mailbox; when this is not true
492 it may treat some old messages as new and vice versa. The only
493 real fix for this problem is to switch to IMAP.
495 The IMAP code uses the presence or absence of the server flag \eSeen
496 to decide whether or not a message is new. Under Unix, it counts on
497 your IMAP server to notice the BSD-style Status flags set by mail user
498 agents and set the \eSeen flag from them when appropriate. All Unix
499 IMAP servers we know of do this, though it's not specified by the IMAP
500 RFCs. If you ever trip over a server that doesn't, the symptom will
501 be that messages you have already read on your host will look new to
502 the server. In this (unlikely) case, only messages you fetched with
503 \fIfetchmail --keep\fR will be both undeleted and marked old.
508 allow administrators to set up `spam filters' that block unsolicited email
509 from specified domains. A MAIL FROM line that triggers this feature
510 will elicit an SMTP response with an error code of 571. The
512 code recognizes this error and discards the message. This is the
514 circumstance under which fetchmail ever discards mail.
516 .SH THE RUN CONTROL FILE
517 The preferred way to set up fetchmail (and the only way if you want to
518 avoid specifying passwords each time it runs) is to write a
519 \&\fI.fetchmailrc\fR file in your home directory. To protect the security
520 of your passwords, your \fI~/.fetchmailrc\fR may not have more than
521 600 (u=rw,g=,o=) permissions;
523 will complain and exit otherwise.
525 You may read the \fI.fetchmailrc\fR file as a list of commands to
528 is called with no arguments.
530 Comments begin with a '#' and extend through the end of the line.
531 Otherwise the file consists of a series of free-format server entries
532 or global option statement.
534 Any amount of whitespace separates keywords, tokens, or strings in
535 server entries, but is otherwise ignored (except that whitespace
536 enclosed in double quotes is treated as part of the string). Keywords
537 and identifiers are case sensitive. You may use standard C-style
538 escapes (\en, \et, \eb, octal, and hex) to embed non-printable
539 characters or string delimiters in strings. When there is a conflict
540 between the command-line arguments and the arguments in this file, the
541 command-line arguments take precedence.
543 Each server entry consists of one of the keywords `poll' or `skip',
544 followed by a server name, followed by server options, followed by any
545 number of user descriptions.
547 The `poll' verb tells fetchmail to query this host when it is run with
548 no arguments. The `skip' verb tells
550 not to poll this host unless it is explicitly named on the command
551 line. (The `skip' verb allows you to experiment with test entries
552 safely, or easily disable entries for hosts that are temporarily down.)
554 Legal server options are:
558 authenticate (or auth)
567 Legal user options are
573 remotefolder (or remote)
589 All options correspond to the obvious command-line arguments except
590 the following: `aka', `is', `to', `dns'/`no dns', `password',
591 `preconnect', and `localdomains'.
593 The `is' or `to' keywords associate the following local (client)
594 name(s) (or server-name to client-name mappings separated by =) with
595 the mailserver user name in the entry. If an is/to list has `*' as
596 its last name, unrecognized names are simply passed through.
598 A single local name can be used to support redirecting your mail when
599 your username on the client machine is different from your name on the
600 mailserver. When there is only a single local name, mail is forwarded
601 to that local username regardless of the message's Received, To, Cc,
602 and Bcc headers. In this case
604 never does DNS lookups.
606 When there is more than one local name (or name mapping) the
607 \fIfetchmail\fR code does look at the Received, To, Cc, and Bcc
608 headers of retrieved mail (this is `multidrop mode'). It looks for
609 addresses with hostname parts that match your `aka' or `localdomains'
610 options, and usually also for hostname parts which DNS tells it are
611 aliases of the mailserver. See the discussion of `dns',
612 `localdomains', and `aka' for details on how matching addresses are
613 handled. If \fIfetchmail\fR cannot match any mailserver usernames or
614 localdomain addresses, the default recipient is the calling user.
616 The `dns' option (normally on) controls the way addresses from
617 multidrop mailboxes are checked. On, it enables logic to check each
618 host address that doesn't match an `aka' or `localdomains' declaration
619 by looking it up with DNS. When a mailserver username is recognized
620 attached to a matching hostname part, its local mapping is added to
621 the list of local recipients.
623 The `aka' option is for use with multidrop mailboxes. It allows you
624 to pre-declare a list of DNS aliases for a server. This is an
625 optimization hack that allows you to trade space for speed. When
627 while processing a multidrop mailbox, grovels through message headers
628 looking for names of the mailserver, pre-declaring common ones can
629 save it from having to do DNS lookups.
631 The `localdomains' option allows you to declare a list of domains
632 which fetchmail should consider local. When fetchmail is parsing
633 address lines in multidrop modes, and a trailing segment of a host
634 name matches a declared local doman, that address is passed through
635 to the listener or MDA unaltered (local-name mappings are \fInot\fR
638 The \fBpassword\fR option requires a string argument, which is the password
639 to be used with the entry's server.
641 The `preconnect' keyword allows you to specify a shell command to be
642 executed just before each time
644 establishes a mailserver connection. This may be useful if you are
645 attempting to set up secure POP connections with the aid of
648 Legal protocol identifiers are
658 Legal authentication types are `password' or `kerberos'. The former
659 specifies authentication by normal transmission of a password (the
660 password may be plaintext or subject to protocol-specific encryption
661 as in APOP); the second tells \fIfetchmail\fR to try to get a Kerberos
662 ticket at the start of each query instead, and send an arbitrary
663 string as the password.
665 Specifying `kpop' sets POP3 protocol over port 1109 with Kerberos
666 authentication. These defaults may be overridden by later options.
668 You can use the noise keywords `and', `with',
669 `has', `wants', and `options' anywhere in an entry to make
670 it resemble English. They're ignored, but but can make entries much
671 easier to read at a glance. The punctuation characters ':', ';' and
672 ',' are also ignored.
674 The words `here' and `there' have useful English-like
675 significance. Normally `user eric is esr' would mean that
676 mail for the remote user `eric' is to be delivered to `esr',
677 but you can make this clearer by saying `user eric there is esr here',
678 or reverse it by saying `user esr here is eric there'
680 For backward compatibility, the word `server' is a synonym for `poll'.
682 There is currently just one global option statement; `set logfile = '
683 followed by a string sets the same global specified by --logfile. A
684 command-line --logfile option will override this.
689 poll SERVERNAME protocol PROTOCOL username NAME password PASSWORD
695 poll pop.provider.net protocol pop3 username jsmith password secret1
698 Or, using some abbreviations:
701 poll pop.provider.net proto pop3 user jsmith password secret1
704 Multiple servers may be listed:
707 poll pop.provider.net proto pop3 user jsmith pass secret1
708 poll other.provider.net proto pop2 user John.Smith pass My^Hat
711 Here's a version of those two with more whitespace and some noise words:
714 poll pop.provider.net proto pop3
715 user jsmith, with password secret1, is jsmith here;
716 poll other.provider.net proto pop2:
717 user John.Smith, with password My^Hat, is John.Smith here;
720 This version is much easier to read and doesn't cost significantly
721 more (parsing is done only once, at startup time).
724 If you need to include whitespace in a parameter string, enclose the
725 string in double quotes. Thus:
728 poll mail.provider.net with proto pop3:
729 user jsmith there has password "u can't krak this"
730 is jws here and wants mda "/bin/mail"
733 You may have an initial server description headed by the keyword
734 `defaults' instead of `poll' followed by a name. Such a record
735 is interpreted as defaults for all queries to use. It may be overwritten
736 by individual server descriptions. So, you could write:
741 poll pop.provider.net
743 poll mail.provider.net
744 user jjsmith there has password secret2
747 It's possible to specify more than one user per server (this is only
748 likely to be useful when running fetchmail in daemon mode as root).
749 The `user' keyword leads off a user description, and every user
750 description except optionally the first one must include it. (If the
751 first description lacks the `user' keyword, the name of the
752 invoking user is used.) Here's a contrived example:
755 poll pop.provider.net proto pop3 port 3111
757 user jsmith with pass secret1 is smith here
758 user jones with pass secret2 is jjones here
761 This says that the user invoking \fIfetchmail\fR has the same username
762 on pop.provider.net, and password `gumshoe' there.
763 It also associates the local username `smith' with the pop.provider.net
764 username `jsmith' and the local username `jjones' with the pop.provider.net
767 This example is contrived because, in practice, you are very unlikely
768 to be specifying multiple users per server unless running it as root
769 (thus the `pass gumshoe' would try to fetch root's mail on
770 pop-provider.net, which is probably not what you want).
771 In any case, we strongly recommend always having an explicit
772 \&`user' clause when specifying multiple users per mailserver.
774 Here's what a simple retrieval configuration for a multi-drop mailbox
778 poll pop.provider.net:
779 user maildrop with pass secret1 to golux hurkle=happy snark here
782 This says that the mailbox of account `maildrop' on the server is a
783 multi-drop box, and that messages in it should be parsed for the
784 server user names `golux', `hurkle', and `snark'. It further
785 specifies that `golux' and `snark' have the same name on the
786 client as on the server, but mail for server user `hurkle' should be
787 delivered to client user `happy'.
789 Here's an example of another kind of multidrop connection:
792 poll pop.provider.net localdomains loonytoons.org:
793 user maildrop with pass secret1 to esr * here
796 This also says that the mailbox of account `maildrop' on the server is
797 a multi-drop box. It tells fetchmail that any address in the
798 loonytoons.org domain (including subdomain addresses like
799 `joe@daffy.loonytoons.org') should be passed through to the local SMTP
800 listener without modification. Be careful of mail loops if you do this!
802 .SH THE USE AND ABUSE OF MULTIDROP MAILBOXES
803 Use the multiple-local-recipients feature with caution -- it can bite.
805 .SS Header vs. Envelope addresses
806 The fundamental problem is that by having your mailserver toss several
807 peoples' mail in a box, you may have thrown away potentially vital
808 information about who each piece of mail was actually addressed to
809 (the `envelope address', as opposed to the addresses in the RFC822
810 To/Cc/Bcc headers). This `envelope address' is the address you need
811 in order to reroute mail properly.
815 can deduce the envelope address. If the mailserver MTA is
817 and the item of mail had just one recipient, the MTA will have written
818 a `for' clause that gives the envelope addressee into its Received
819 header. But this doesn't work reliably for other MTAs, nor if there is more
822 Alternatively, some SMTP listeners and/or mail servers insert a header
823 in each message containing a copy of the envelope addresses. This
824 header (when it exists) is often `X-Envelope-To'. Fetchmail's
825 assumption about this can be changed with the -E or `envelope' option.
827 Sometimes, unfortunately, neither of these methods works. When they
828 both fail, fetchmail must fall back on the contents of To/Cc/Bcc
829 headers to try to determine recipient addressees -- and these are not
830 reliable. In particular, mailing-list software often ships mail with
831 the list broadcast address in the To header.
835 cannot deduce a recipient address that is local, and the intended
836 recipient address was anyone other than fetchmail's invoking user,
837 mail will get lost. This is what makes the multidrop feature risky.
839 .SS Good Ways To Use Multidrop Mailboxes
840 Multiple local names can be used to administer a mailing list from the
841 client side of a \fIfetchmail\fR collection. Suppose your name is
842 \&`esr', and you want to both pick up your own mail and maintain a mailing
843 list called (say) "fetchmail-friends", and you want to keep the alias
844 list on your client machine.
846 On your server, you can alias \&`fetchmail-friends' to `esr'; then, in
847 your \fI.fetchmailrc\fR, declare \&`to esr fetchmail-friends here'.
848 Then, when mail including `fetchmail-friends' as a local address
849 gets fetched, the list name will be appended to the list of
850 recipients your SMTP listener sees. Therefore it will undergo alias
851 expansion locally. Be sure to include `esr' in the local alias
852 expansion of fetchmail-friends, or you'll never see mail sent only to
853 the list. Also be sure that your listener has the "me-too" option set
854 (sendmail's -oXm command-line option or OXm declaration) so your name
855 isn't removed from alias expansions in messages you send.
857 This trick is not without its problems, however. You'll begin to see
858 this when a message comes in that is addressed only to a mailing list
859 you do \fInot\fR have declared as a local name. Each such message
860 will feature an `X-Fetchmail-Warning' header which is generated
861 because fetchmail cannot find a valid local name in the recipient
862 addresses. Such messages default (as was described above) to being
863 sent to the local user running
865 but the program has no way to know that that's actually the right thing.
867 .SS Bad Ways To Abuse Multidrop Mailboxes
868 Multidrop mailboxes and
870 serving multiple users in daemon mode do not mix. The problem, again, is
871 mail from mailing lists, which typically does not have an individual
872 recipient address on it. Unless
874 can deduce an envelope address, such mail will only go to the account
875 running fetchmail (probably root).
877 .SS Speeding Up Multidrop Checking
878 Normally, when multiple user are declared
880 extracts recipient addresses as described above and checks each host
881 part with DNS to see if it's an alias of the mailserver. If so, the
882 name mappings described in the to ... here declaration are done and
883 the mail locally delivered.
885 This is the safest but also slowest method. To speed it up,
886 pre-declare mailserver aliases with `aka'; these are checked before
887 DNS lookups are done. If you're certain your aka list contains
889 DNS aliases of the mailserver (and all MX names pointing at it)
890 you can declare `no dns' to suppress DNS lookups entirely and
891 \fIonly\fR match against the aka list.
894 To facilitate the use of
896 in shell scripts, an exit code is returned to give an indication
897 of what occurred during a given connection.
899 The exit codes returned by
903 One or more messages were successfully retrieved.
905 There was no mail awaiting retrieval.
907 An error was encountered when attempting to open a socket for the POP
908 connection. If you don't know what a socket is, don't worry about it --
909 just treat this as an 'unrecoverable error'.
911 The user authentication step failed. This usually means that a bad
912 user-id, password, or APOP id was specified.
914 Some sort of fatal protocol error was detected.
916 There was a syntax error in the arguments to
919 The run control file had bad permissions.
921 There was an error condition reported by the server (POP3 only).
923 Exclusion error. This means
925 either found another copy of itself already running, or failed in such
926 a way that it isn't sure whether another copy is running.
930 run failed while trying to do an SMTP port open or transaction.
932 Internal error. You should see a message on standard error with
937 queries more than one host, the returned status is that of the last
941 Eric S. Raymond <esr@snark.thyrsus.com>.
943 .SH BACKWARD COMPATIBILITY
944 This program is descended from and replaces
946 by Carl Harris <ceharris@mal.com>; the internals are quite different,
947 but some of its interface design is directly traceable to that
948 ancestral program. Some effort has been made to preserve compatibility.
950 If called through a link named `popclient', \fIfetchmail\fR will look
951 in ~/.poprc for its run control file. As long as the file does not
952 use the removed `localfolder' option or `limit' (which now takes a
953 maximum byte size rather than a line count), this will often work.
954 (The new run control file syntax also has to be a little stricter
955 about the order of options than the old, in order to support multiple
956 user desriptions per server; thus you may have to rearrange things a
962 default run control file
965 default location of file associating hosts with last message IDs seen
966 (used only with newer RFC1725-compliant POP3 servers supporting the
969 ~/.netrc your FTP run control file, which (if present) will be
970 searched for passwords as a last resort before prompting for one
974 lock file to help prevent concurrent runs (non-root mode).
976 /var/run/fetchmail.pid
977 lock file to help prevent concurrent runs (root mode).
980 For correct initialization,
982 requires either that both the USER and HOME environment variables are
983 correctly set, or that \fBgetpwuid\fR(3) be able to retrieve a password
984 entry from your user ID.
986 .SH BUGS AND KNOWN PROBLEMS
987 Use of any of the supported protocols other than APOP or KPOP requires
988 that the program send unencrypted passwords over the TCP/IP connection
989 to the mailserver. This creates a risk that name/password pairs
990 might be snaffled with a packet sniffer or more sophisticated
991 monitoring software. Under Linux, the --interface option can be used
992 to restrict polling to availability of a specific interface device with
993 a specific local IP address, but snooping is still possible if (a)
994 either host has a network device that can be opened in promiscuous mode,
995 or (b) the intervening network link can be tapped.
997 Send comments, bug reports, gripes, and the like to Eric S. Raymond
1001 elm(1), mail(1), sendmail(8), popd(8), imapd(8)
1002 .SH APPLICABLE STANDARDS
1014 RFC 1081, RFC 1225, RFC 1460, RFC 1725, RFC 1939
1017 RFC 1460, RFC 1725, RFC 1939
1026 RFC 1730, RFC 1731, RFC 1732