]> Pileus Git - ~andy/fetchmail/blob - fetchmail.man
Try to fix Pavel Rokin's bug.
[~andy/fetchmail] / fetchmail.man
1 '\" t
2 .\" ** The above line should force tbl to be used as a preprocessor **
3 .\"
4 .\" Man page for fetchmail
5 .\"
6 .\" For license terms, see the file COPYING in this directory.
7 .TH fetchmail 1
8 .SH NAME
9 fetchmail \- fetch mail from a POP, IMAP, or ETRN-capable server
10
11 .SH SYNOPSIS
12 \fBfetchmail\fR [\fIoptions\fR] [\fImailserver...\fR]
13 .br
14 \fBfetchmailconf\fR
15
16 .SH DESCRIPTION
17 .I fetchmail
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.
24 .PP
25 The
26 .I fetchmail
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.)
31 .PP
32 While
33 .I fetchmail
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.
38 .PP
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
47 therefore work.
48 .PP
49 If the program
50 .I fetchmailconf
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.
60
61 .SH GENERAL OPERATION
62 The behavior of
63 .I fetchmail
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
68 .I ~/.fetchmailrc
69 declarations.
70 .PP
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 
74 .I ~/.fetchmailrc
75 file will be queried.
76 .PP
77 To facilitate the use of
78 .I fetchmail
79 in scripts and pipelines, it returns an appropriate exit code upon 
80 termination -- see EXIT CODES below.
81 .PP
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.
85 .PP
86 Almost all options have a corresponding keyword which can be used to
87 declare them in a 
88 .I fetchmailrc
89 file.
90 .PP
91 Some special options are not covered here, but are documented instead
92 in sections on AUTHENTICATION and DAEMON MODE which follow.
93 .SS General Options
94 .TP
95 .B \-V, --version
96 Displays the version information for your copy of 
97 .I fetchmail.
98 No mail fetch is performed.
99 Instead, for each server specified, all the option information
100 that would be computed if
101 .I fetchmail
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.
106 .TP
107 .B \-c, --check
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.
116 .TP
117 .B \-s, --silent
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.
121 .TP
122 .B \-v, --verbose
123 Verbose mode.  All control messages passed between 
124 .I fetchmail
125 and the mailserver are echoed to stderr.  Overrides --silent.
126 Doubling this option (-v -v) causes extra diagnostic information
127 to be printed. 
128 .SS Disposal Options
129 .TP
130 .B \-a, --all
131 (Keyword: fetchall)
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.
137 .TP
138 .B \-k, --keep
139 (Keyword: keep)
140 Keep retrieved messages on the remote mailserver.  Normally, messages 
141 are deleted from the folder on the mailserver after they have been retrieved.
142 Specifying the 
143 .B keep 
144 option causes retrieved messages to remain in your folder on the
145 mailserver.  This option does not work with ETRN.
146 .TP
147 .B \-K, --nokeep
148 (Keyword: nokeep)
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.
153 .TP
154 .B \-F, --flush
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
162 .TP
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.
167 .I proto 
168 may be one of the following:
169 .RS
170 .IP AUTO
171 Tries IMAP, POP3, and POP2 (skipping any of these for which support
172 has not been compiled in).
173 .IP POP2
174 Post Office Protocol 2
175 .IP POP3
176 Post Office Protocol 3
177 .IP APOP
178 Use POP3 with MD5 authentication.
179 .IP RPOP
180 Use POP3 with RPOP authentication.
181 .IP KPOP
182 Use POP3 with Kerberos V4 preauthentication on port 1109.
183 .IP SDPS
184 Use POP3 with Demon Internet's SDPS extensions.
185 .IP IMAP
186 IMAP2bis, IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities).
187 .IP IMAP-K4
188 IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities)
189 with RFC 1731 Kerberos v4 preauthentication.
190 .IP IMAP-GSS
191 IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities)
192 with RFC 1731 GSSAPI preauthentication.
193 .IP IMAP-CRAMMD5
194 IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities)
195 with RFC 2195 CRAM-MD5 authentication.
196 .IP IMAP-LOGIN
197 IMAP4, or IMAP4rev1 (\fIfetchmail\fR autodetects their capabilities)
198 with plain LOGIN authentication only, even if the server supports
199 better methods.
200 .IP ETRN
201 Use the ESMTP ETRN option.
202 .RE
203 .P
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.
211 .TP
212 .B \-U, --uidl
213 (Keyword: uidl)
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.
218 .TP
219 .B \-P, --port <portnumber>
220 (Keyword: port)
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.
224 .TP 
225 .B \-t, --timeout <seconds>
226 (Keyword: timeout)
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.
237 .TP
238 .B \--plugin <command>
239 (Keyword: plugin)
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
245 the plugin's stdout.
246 .TP
247 .B \--plugout <command>
248 (Keyword: plugout)
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
251 from plugin).
252 .TP
253 .B \-r <name>, --folder <name>
254 (Keyword: folder[s])
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
258 POP3 or ETRN.
259 .TP
260 .B \--ssl
261 (Keyword: ssl)
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.
269 .TP
270 .B \--sslcert <name>
271 (Keyword: sslcert)
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
281 recommended.
282 .TP
283 .B \--sslkey <name>
284 (Keyword: sslkey)
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
298 .TP
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).
311 Example:
312
313         --smtphost server1,server2/2525,server3
314
315 .TP
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.
321 .TP
322 .B \-Z <nnn>, --antispam <nnn[, nnn]...>
323 (Keyword: antispam) 
324 Specifies the list of numeric SMTP errors that are to be interpreted
325 as a spam-block response from the listener.  A value of -1 disables
326 this option.  For the command-line option, the list values should
327 be comma-separated.
328 .TP
329 .B \-m <command>, \--mda <command>
330 (Keyword: mda)
331 You can force mail to be passed to an MDA directly (rather than
332 forwarded to port 25) with the -mda or -m option.  Be aware that this
333 disables some valuable resource-exhaustion checks and error handling
334 provided by SMTP listeners; it's not a good idea unless running an
335 SMTP listener is impossible.  If \fIfetchmail\fR is running as root,
336 it sets its userid to that of the target user while delivering mail
337 through an MDA.  Some possible MDAs are "/usr/sbin/sendmail -oem -f %F
338 %T", "/usr/bin/deliver" and "/usr/bin/procmail -d %T" (but the latter
339 is usually redundant as it's what SMTP listeners usually forward
340 to).  Local delivery addresses will be inserted into the MDA command
341 wherever you place a %T; the mail message's From address will be
342 inserted where you place an %F.  Do \fInot\fR use an MDA invocation
343 like "sendmail -oem -t" that dispatches on the contents of To/Cc/Bcc,
344 it will create mail loops and bring the just wrath of many postmasters
345 down upon your head.
346 .TP 
347 .B \--lmtp
348 (Keyword: lmtp)
349 Cause delivery via LMTP (Local Mail Transfer Protocol).  A service
350 port \fImust\fR be explicitly specified (with a slash suffix) on each
351 host in the smtphost hunt list) if this option is selected; the
352 default port 25 will (in accordance with RFC 2033) not be accepted.
353 .TP
354 .B \--bsmtp <filename>
355 (keyword: bsmtp)
356 Append fetched mail to a BSMTP file.  This simply contains the SMTP
357 commands that would normally be generated by fetchmail when passing
358 mail to an SMTP listener daemon.  An argument of `-' causes the mail
359 to be written to standard output.  Note that fetchmail's
360 reconstruction of MAIL FROM and RCPT TO lines is not guaranteed
361 correct; the caveats discussed under THE USE AND ABUSE OF MULTIDROP
362 MAILBOXES below apply.
363 .SS Resource Limit Control Options
364 .TP
365 .B \-l <maxbytes>, --limit <maxbytes>
366 (Keyword: limit)
367 Takes a maximum octet size argument.  Messages larger than this size
368 will not be fetched, not be marked seen, and will be left on the
369 server (in foreground sessions, the progress messages will note that
370 they are "oversized").  An explicit --limit of 0 overrides any limits
371 set in your run control file. This option is intended for those
372 needing to strictly control fetch time due to expensive and variable
373 phone rates.  In daemon mode, oversize notifications are mailed to the
374 calling user (see the --warnings option).  This option does not work
375 with ETRN.
376 .TP
377 .B \-w <interval>, --warnings <interval>
378 (Keyword: warnings)
379 Takes an interval in seconds.  When you call
380 .I fetchmail
381 with a `limit' option in daemon mode, this controls the interval at
382 which warnings about oversized messages are mailed to the calling user
383 (or the user specified by the `postmaster' option).  One such
384 notification is always mailed at the end of the the first poll that
385 the oversized message is detected.  Thereafter, renotification is
386 suppressed until after the warning interval elapses (it will take
387 place at the end of the first following poll).
388 .TP
389 .B -b <count>, --batchlimit <count>
390 (Keyword: batchlimit)
391 Specify the maximum number of messages that will be shipped to an SMTP
392 listener before the connection is deliberately torn down and rebuilt
393 (defaults to 0, meaning no limit).  An explicit --batchlimit of 0
394 overrides any limits set in your run control file.  While
395 \fBsendmail\fR(8) normally initiates delivery of a message immediately
396 after receiving the message terminator, some SMTP listeners are not so
397 prompt.  MTAs like \fIqmail\fR(8) and \fIsmail\fR(8) may wait till the
398 delivery socket is shut down to deliver.  This may produce annoying
399 delays when
400 .I fetchmail
401 is processing very large batches.  Setting the batch limit to some
402 nonzero size will prevent these delays.
403 This option does not work with ETRN.
404 .TP
405 .B -B <number>, --fetchlimit <number>
406 (Keyword: fetchlimit)
407 Limit the number of messages accepted from a given server in a single
408 poll.  By default there is no limit. An explicit --fetchlimit of 0
409 overrides any limits set in your run control file.
410 This option does not work with ETRN.
411 .TP
412 .B -e <count>, --expunge <count>
413 (keyword: expunge) 
414 Arrange for deletions to be made final after a given number of
415 messages.  Under POP2 or POP3, fetchmail cannot make deletions final
416 without sending QUIT and ending the session -- with this option on,
417 fetchmail will break a long mail retrieval session into multiple
418 subsessions, sending QUIT after each sub-session. This is a good
419 defense against line drops on POP3 servers that do not do the
420 equivalent of a QUIT on hangup.  Under IMAP,
421 .I fetchmail
422 normally issues an EXPUNGE command after each deletion in order to
423 force the deletion to be done immediately.  This is safest when your
424 connection to the server is flaky and expensive, as it avoids
425 resending duplicate mail after a line hit.  However, on large
426 mailboxes the overhead of re-indexing after every message can slam the
427 server pretty hard, so if your connection is reliable it is good to do
428 expunges less frequently.  If you specify this option to an integer N,
429 it tells
430 .I fetchmail
431 to only issue expunges on every Nth delete.  An argument of zero
432 suppresses expunges entirely (so no expunges at all will be done until
433 the end of run).  This option does not work with ETRN.
434 .SS Authentication Options
435 .TP
436 .B \-u <name>, --username <name>
437 (Keyword: user[name])
438 Specifies the user identification to be used when logging in to the mailserver.
439 The appropriate user identification is both server and user-dependent.  
440 The default is your login name on the client machine that is running 
441 .I fetchmail.
442 See USER AUTHENTICATION below for a complete description.
443 .TP
444 .B \-I <specification>, --interface <specification>
445 (Keyword: interface)
446 Require that a specific interface device be up and have a specific local
447 IP address (or range) before polling.  Frequently
448 .I fetchmail
449 is used over a transient point-to-point TCP/IP link established directly
450 to a mailserver via SLIP or PPP.  That is a relatively secure channel.
451 But when other TCP/IP routes to the mailserver exist (e.g. when the link
452 is connected to an alternate ISP), your username and password may be
453 vulnerable to snooping (especially when daemon mode automatically polls
454 for mail, shipping a clear password over the net at predictable
455 intervals).  The --interface option may be used to prevent this.  When
456 the specified link is not up or is not connected to a matching IP
457 address, polling will be skipped.  The format is:
458 .sp
459         interface/iii.iii.iii.iii/mmm.mmm.mmm.mmm
460 .sp
461 The field before the first slash is the interface name (i.e. sl0, ppp0
462 etc.).  The field before the second slash is the acceptable IP address.
463 The field after the second slash is a mask which specifies a range of
464 IP addresses to accept.  If no mask is present 255.255.255.255 is
465 assumed (i.e. an exact match).  This option is currently only supported
466 under Linux and FreeBSD. Please see the 
467 .B monitor 
468 section for below for FreeBSD specific information.
469 .TP
470 .B \-M <interface>, --monitor <interface>
471 (Keyword: monitor)
472 Daemon mode can cause transient links which are automatically taken down
473 after a period of inactivity (e.g. PPP links) to remain up
474 indefinitely.  This option identifies a system TCP/IP interface to be
475 monitored for activity.  After each poll interval, if the link is up but
476 no other activity has occurred on the link, then the poll will be
477 skipped.  This option is currently only supported under Linux and FreeBSD.
478 For the 
479 .B monitor 
480 and 
481 .B interface
482 options to work for non root users under FreeBSD, the fetchmail binary
483 must be installed SGID kmem. This would be a security hole, but
484 fetchmail runs with the effective GID set to that of the kmem group
485 .I only
486 when interface data is being collected.
487 .TP
488 .B --preauth <type>
489 (Keyword: preauth[enticate]) 
490 This option permits you to specify a preauthentication type (see USER
491 AUTHENTICATION below for details).  The possible values are
492 \&`\fBpassword\fR', `\fBkerberos_v5\fR' and `\fBkerberos\fR' (or, for
493 excruciating exactness, `\fBkerberos_v4\fR'), and \fBssh\fR.  Use
494 \fBssh\fR to suppress fetchmail's normal inquiry for a password when
495 you are using an end-to-end secure connection such as an ssh tunnel.
496 Other values of this option are provided primarily for developers;
497 choosing KPOP protocol automatically selects Kerberos
498 preauthentication, and all other alternatives use password
499 authentication (though APOP uses a generated one-time key as the
500 password and IMAP-K4 uses RFC1731 Kerberos v4 authentication).  This
501 option does not work with ETRN.
502 .SS Miscellaneous Options
503 .TP
504 .B \-f <pathname>, --fetchmailrc <pathname>
505 Specify a non-default name for the 
506 .I .fetchmailrc
507 run control file.  The pathname argument must be either "-" (a single
508 dash, meaning to read the configuration from standard input) or a
509 filename.  Unless the --version option is also on, a named file
510 argument must have permissions no more open than 0600 (u=rw,g=,o=) or
511 else be /dev/null.
512 .TP
513 .B \-i <pathname>, --idfile <pathname>
514 (Keyword: idfile)
515 Specify an alternate name for the .fetchids file used to save POP3
516 UIDs. 
517 .TP
518 .B \-n, --norewrite
519 (Keyword: no rewrite)
520 Normally,
521 .I fetchmail
522 edits RFC-822 address headers (To, From, Cc, Bcc, and Reply-To) in
523 fetched mail so that any mail IDs local to the server are expanded to
524 full addresses (@ and the mailserver hostname are appended).  This enables 
525 replies on the client to get addressed correctly (otherwise your
526 mailer might think they should be addressed to local users on the
527 client machine!).  This option disables the rewrite.  (This option is
528 provided to pacify people who are paranoid about having an MTA edit
529 mail headers and want to know they can prevent it, but it is generally
530 not a good idea to actually turn off rewrite.)
531 When using ETRN, the rewrite option is ineffective.
532 .TP
533 .B -E <line>, --envelope <line>
534 (Keyword: envelope)
535 This option changes the header 
536 .I fetchmail
537 assumes will carry a copy of the mail's envelope address.  Normally
538 this is `X-Envelope-To' but as this header is not standard, practice
539 varies. See the discussion of multidrop address handling below.  As a
540 special case, `envelope "Received"' enables parsing of sendmail-style
541 Received lines.  This is the default, and it should not be necessary
542 unless you have globally disabled Received parsing with `no envelope'
543 in the \fI.fetchmailrc\fR file.
544 .TP
545 .B -Q <prefix>, --qvirtual <prefix>
546 (Keyword: qvirtual)
547 The string prefix assigned to this option will be removed from the user
548 name found in the header specified with the \fIenvelope\fR option
549 (\fIbefore\fR doing multidrop name mapping or localdomain checking,
550 if either is applicable). This option is useful if you are using  
551 .I fetchmail
552 to collect the mail for an entire domain and your ISP (or your mail
553 redirection provider) is using qmail.
554 One of the basic features of qmail is the
555 .sp
556 \&`Delivered-To:'
557 .sp
558 message header.  Whenever qmail delivers a message to a local mailbox
559 it puts the username and hostname of the envelope recipient on this
560 line.  The major reason for this is to prevent mail loops.  To set up
561 qmail to batch mail for a disconnected site the ISP-mailhost will have
562 normally put that site in its `Virtualhosts' control file so it will
563 add a prefix to all mail addresses for this site. This results in mail
564 sent to 'username@userhost.userdom.dom.com' having a
565 \&`Delivered-To:' line of the form:
566 .sp
567 Delivered-To: mbox-userstr-username@userhost.userdom.dom.com
568 .sp
569 The ISP can make the 'mbox-userstr-' prefix anything they choose
570 but a string matching the user host name is likely.
571 By using the option `envelope Delivered-To:' you can make fetchmail reliably
572 identify the original envelope recipient, but you have to strip the
573 `mbox-userstr-' prefix to deliver to the correct user.
574 This is what this option is for.
575 .TP
576 .B --configdump
577 Parse the 
578 .I ~/.fetchmailrc
579 file, interpret any command-line options specified, and dump a
580 configuration report to standard output.  The configuration report is
581 a data structure assignment in the language Python.  This option
582 is meant to be used with an interactive 
583 .I ~/.fetchmailrc
584 editor like 
585 .IR fetchmailconf ,
586 written in Python.
587
588 .SH USER AUTHENTICATION AND ENCRYPTION
589 Every mode except ETRN requires authentication of the client.
590 Normal user authentication in 
591 .I fetchmail
592 is very much like the authentication mechanism of 
593 .IR ftp (1).
594 The correct user-id and password depend upon the underlying security
595 system at the mailserver.  
596 .PP
597 If the mailserver is a Unix machine on which you have an ordinary user 
598 account, your regular login name and password are used with 
599 .I fetchmail.
600 If you use the same login name on both the server and the client machines,
601 you needn't worry about specifying a user-id with the 
602 .B \-u
603 option \-\- 
604 the default behavior is to use your login name on the client machine as the 
605 user-id on the server machine.  If you use a different login name
606 on the server machine, specify that login name with the
607 .B \-u
608 option.  e.g. if your login name is 'jsmith' on a machine named 'mailgrunt',
609 you would start 
610 .I fetchmail 
611 as follows:
612 .IP
613 fetchmail -u jsmith mailgrunt
614 .PP
615 The default behavior of 
616 .I fetchmail
617 is to prompt you for your mailserver password before the connection is
618 established.  This is the safest way to use 
619 .I fetchmail
620 and ensures that your password will not be compromised.  You may also specify
621 your password in your
622 .I ~/.fetchmailrc
623 file.  This is convenient when using 
624 .I fetchmail
625 in daemon mode or with scripts.
626 .PP
627 If you do not specify a password, and
628 .I fetchmail
629 cannot extract one from your
630 .I .fetchmailrc
631 file, it will look for a 
632 .I .netrc
633 file in your home directory before requesting one interactively; if an
634 entry matching the mailserver is found in that file, the password will
635 be used.  Fetchmail first looks for a match on poll name; if it finds none,
636 it checks for a match on via name.  See the
637 .IR ftp (1)
638 man page for details of the syntax of the
639 .I .netrc
640 file.  (This feature may allow you to avoid duplicating password
641 information in more than one file.)
642 .PP
643 On mailservers that do not provide ordinary user accounts, your user-id and 
644 password are usually assigned by the server administrator when you apply for 
645 a mailbox on the server.  Contact your server administrator if you don't know 
646 the correct user-id and password for your mailbox account.
647 .PP
648 Early versions of POP3 (RFC1081, RFC1225) supported a crude form of
649 independent authentication using the
650 .I rhosts
651 file on the mailserver side.  Under this RPOP variant, a fixed
652 per-user ID equivalent to a password was sent in clear over a link to
653 a reserved port, with the command RPOP rather than PASS to alert the
654 server that it should do special checking.  RPOP is supported
655 by
656 .I fetchmail
657 (you can specify `protocol RPOP' to have the program send `RPOP'
658 rather than `PASS') but its use is strongly discouraged.  This
659 facility was vulnerable to spoofing and was withdrawn in RFC1460.
660 .PP
661 RFC1460 introduced APOP authentication.  In this variant of POP3,
662 you register an APOP password on your server host (the program
663 to do this with on the server is probably called \fIpopauth\fR(8)).  You
664 put the same password in your 
665 .I .fetchmailrc
666 file.  Each time 
667 .I fetchmail
668 logs in, it sends a cryptographically secure hash of your password and
669 the server greeting time to the server, which can verify it by
670 checking its authorization database. 
671 .PP
672 If your \fIfetchmail\fR was built with Kerberos support and you specify 
673 Kerberos preauthentication (either with --auth or the \fI.fetchmailrc\fR
674 option \fBauthenticate kerberos_v4\fR) it will try to get a Kerberos
675 ticket from the mailserver at the start of each query.  Note: if
676 either the pollnane or via name is `hesiod', fetchmail will try to use
677 Hesiod to look up the mailserver.
678 .PP
679 If you use IMAP-K4, \fIfetchmail\fR will expect the IMAP server to have
680 RFC1731-conformant AUTHENTICATE KERBEROS_V4 capability, and will use it.
681 .PP
682 If you use IMAP-GSS, \fIfetchmail\fR will expect the IMAP server to have
683 RFC1731-conformant AUTHENTICATE GSSAPI capability, and will use it. 
684 Currently this has only been tested over Kerberos V, so you're expected
685 to already have a ticket-granting ticket. You may pass a username different
686 from your principal name using the standard \fB--user\fR command or by
687 the \fI.fetchmailrc\fR option \fBuser\fR.
688 .PP
689 If your IMAP daemon returns the PREAUTH response in its greeting line, 
690 fetchmail will notice this and skip the normal authentication step.
691 This could be useful, e.g. if you start imapd explicitly using ssh.
692 In this case you can declare the preauthentication value `ssh' on that
693 site entry to stop \fI.fetchmail\fR from asking you for a password
694 when it starts up.
695 .PP
696 If you are using POP3, and the server issues a one-time-password
697 challenge conforming to RFC1938, \fIfetchmail\fR will use your
698 password as a pass phrase to generate the required response. This
699 avoids sending secrets over the net unencrypted.
700 .PP
701 Compuserve's RPA authentication (similar to APOP) is supported. If you
702 compile in the support, \fIfetchmail\fR will try to perform an RPA pass-phrase
703 authentication instead of sending over the password en clair if it
704 detects "@compuserve.com" in the hostname.
705 .PP
706 Microsoft's NTLM authentication (used by Microsoft Exchange) is
707 supported. If you compile in the support, \fIfetchmail\fR will try to
708 perform an NTLM authentication (instead of sending over the
709 password en clair) whenever the server returns AUTH=NTLM in its
710 capability response.  Note: if you specify a user option value
711 that looks like `user@domain', the part to the left of the @ will
712 be passed as the username and the part to the right as the NTLM domain.
713 .PP
714 If you are using IPsec, the -T (--netsec) option can be used to pass
715 an IP security request to be used when outgoing IP connections are
716 initialized.  You can also do this using the `netsec' server option
717 in the .fetchmailrc file.  In either case, the option value is a
718 string in the format accepted by the net_security_strtorequest() 
719 function of the inet6_apps library.
720 .PP
721 You can access SSL encrypted services by specifying the --ssl option.
722 You can also do this using the "ssl" server option in the .fetchmailrc
723 file.  With SSL encryption enabled, queries are initiated over a connection
724 after negotiating an SSL session.  Some services, such as POP3 and IMAP,
725 have different well known ports defined for the SSL encrypted services.
726 The encrypted ports will be selected automatically when SSL is enabled and
727 no explicit port is specified.
728 .PP
729 When connecting to an SSL encrypted server, the server presents a certificate
730 to the client for validation.  The certificate is checked to verify that
731 the common name in the certificate matches the name of the server being
732 contacted and that the effective and expiration dates in the certificate
733 indicate that it is currently valid.  If any of these checks fail, a warning
734 message is printed, but the connection continues.  The server certificate
735 does not need to be signed by any specific Certifying Authority and may
736 be a "self-signed" certificate.
737 .PP
738 Some SSL encrypted servers may request a client side certificate.  A client
739 side public SSL certificate and private SSL key may be specified.  If
740 requested by the server, the client certificate is sent to the server for
741 validation.  Some servers may require a valid client certificate and may
742 refuse connections if a certificate is not provided or if the certificate
743 is not valid.  Some servers may require client side certificates be signed
744 by a recognized Certifying Authority.  The format for the key files and
745 the certificate files is that required by the underlying SSL libraries
746 (OpenSSL in the general case).
747
748 .SH DAEMON MODE
749 The 
750 .B --daemon <interval>
751 or
752 .B -d <interval>
753 option runs 
754 .I fetchmail
755 in daemon mode.  You must specify a numeric argument which is a
756 polling interval in seconds.
757 .PP
758 In daemon mode, 
759 .I fetchmail
760 puts itself in background and runs forever, querying each specified
761 host and then sleeping for the given polling interval.
762 .PP
763 Simply invoking
764 .IP
765 fetchmail -d 900
766 .PP
767 will, therefore, poll all the hosts described in your 
768 .I ~/.fetchmailrc
769 file (except those explicitly excluded with the `skip' verb) once
770 every fifteen minutes.
771 .PP
772 It is possible to set a polling interval 
773 in your
774 .I ~/.fetchmailrc
775 file by saying `set daemon <interval>', where <interval> is an
776 integer number of seconds.  If you do this, fetchmail will always
777 start in daemon mode unless you override it with the command-line
778 option --daemon 0 or -d0.
779 .PP
780 Only one daemon process is permitted per user; in daemon mode,
781 .I fetchmail
782 makes a per-user lockfile to guarantee this.
783 .PP
784 Normally, calling fetchmail with a daemon in the background sends a
785 wakeup signal to the daemon, forcing it to poll mailservers
786 immediately.  (The wakeup signal is SIGHUP if fetchmail is running as
787 root, SIGUSR1 otherwise.)  The wakeup action also clears any `wedged'
788 flags indicating that connections have wedged due to failed 
789 authentication or multiple timeouts.
790 .PP
791 The option
792 .B --quit
793 will kill a running daemon process instead of waking it up (if there
794 is no such option, 
795 .I fetchmail
796 notifies you).  If the --quit option is the only command-line option,
797 that's all there is to it.
798 .PP
799 The quit option may also be mixed with other command-line options; its
800 effect is to kill any running daemon before doing what the other
801 options specify in combination with the rc file.
802 .PP
803 The
804 .B -L <filename>
805 or
806 .B --logfile <filename>
807 option (keyword: set logfile) allows you to redirect status messages
808 emitted while detached into a specified logfile (follow the
809 option with the logfile name).  The logfile is opened for append, so
810 previous messages aren't deleted.  This is primarily useful for
811 debugging configurations.
812 .PP
813 The
814 .B --syslog
815 option (keyword: set syslog) allows you to redirect status and error
816 messages emitted to the
817 .IR syslog (3)
818 system daemon if available.
819 Messages are logged with an id of \fBfetchmail\fR, the facility \fBLOG_MAIL\fR,
820 and priorities \fBLOG_ERR\fR, \fBLOG_ALERT\fR or \fBLOG_INFO\fR.
821 This option is intended for logging status and error messages which
822 indicate the status of the daemon and the results while fetching mail
823 from the server(s).
824 Error messages for command line options and parsing the \fI.fetchmailrc\fR
825 file are still written to stderr, or to the specified log file.
826 The
827 .B --nosyslog
828 option turns off use of 
829 .IR syslog (3),
830 assuming it's turned on in the 
831 .I .fetchmailrc 
832 file, or that the
833 .B -L
834 or
835 .B --logfile <file>
836 option was used.
837 .PP
838 The 
839 .B \-N
840 or --nodetach option suppresses backgrounding and detachment of the
841 daemon process from its control terminal.  This is primarily useful
842 for debugging.  Note that this also causes the logfile option to be
843 ignored (though perhaps it shouldn't).
844 .PP
845 Note that while running in daemon mode polling a POP2 or IMAP2bis server,
846 transient errors (such as DNS failures or sendmail delivery refusals)
847 may force the fetchall option on for the duration of the next polling
848 cycle.  This is a robustness feature.  It means that if a message is
849 fetched (and thus marked seen by the mailserver) but not delivered
850 locally due to some transient error, it will be re-fetched during the
851 next poll cycle.  (The IMAP logic doesn't delete messages until
852 they're delivered, so this problem does not arise.)
853 .PP
854 If you touch or change the 
855 .I .fetchmailrc 
856 file while fetchmail is running in daemon mode, this will be detected 
857 at the beginning of the next poll cycle.  When a changed
858 .I .fetchmailrc 
859 is detected, fetchmail rereads it and restarts from scratch (using
860 exec(2); no state information is retained in the new instance).  Note also
861 that if you break the
862 .I .fetchmailrc 
863 file's syntax, the new instance will softly and silently vanish away
864 on startup.
865
866 .SH ADMINISTRATIVE OPTIONS
867 .PP
868 The 
869 .B --postmaster <name>
870 option (keyword: set postmaster) specifies the last-resort username to
871 which multidrop mail is to be forwarded if no matching local recipient
872 can be found.  Normally this is just the user who invoked fetchmail.
873 If the invoking user is root, then the default of this option is
874 the user `postmaster'.
875 .PP
876 The
877 .B --nobounce
878 option suppresses the normal action of bouncing errors back to the 
879 sender in an RFC1894-conformant error message.  If nobounce is on, the
880 message will go to the postmaster instead.
881 .PP
882 The 
883 .B --invisible
884 option (keyword: set invisible) tries to make fetchmail invisible.
885 Normally, fetchmail behaves like any other MTA would -- it generates a
886 Received header into each message describing its place in the chain of
887 transmission, and tells the MTA it forwards to that the mail came from
888 the machine fetchmail itself is running on.  If the invisible option
889 is on, the Received header is suppressed and fetchmail tries to spoof
890 the MTA it forwards to into thinking it came directly from the
891 mailserver host.
892
893 .SH RETRIEVAL FAILURE MODES
894 The protocols \fIfetchmail\fR uses to talk to mailservers are next to
895 bulletproof.  In normal operation forwarding to port 25, no message is
896 ever deleted (or even marked for deletion) on the host until the SMTP
897 listener on the client has acknowledged to \fIfetchmail\fR that the
898 message has been accepted for delivery or rejected due to a apam
899 block.  When forwarding to an MDA, however, there is more possibility
900 of error (because there's no way for fetchmail to get a reliable
901 positive acknowledgement from the MDA).
902 .PP
903 The normal mode of \fIfetchmail\fR is to try to download only `new'
904 messages, leaving untouched (and undeleted) messages you have already
905 read directly on the server (or fetched with a previous \fIfetchmail
906 --keep\fR).  But you may find that messages you've already read on the
907 server are being fetched (and deleted) even when you don't specify
908 --all.  There are several reasons this can happen.
909 .PP
910 One could be that you're using POP2.  The POP2 protocol includes no
911 representation of `new' or `old' state in messages, so \fIfetchmail\fR
912 must treat all messages as new all the time.  But POP2 is obsolete, so
913 this is unlikely.
914 .PP
915 Under POP3, blame RFC1725.  That version of the POP3 protocol
916 specification removed the LAST command, and some POP servers follow it
917 (you can verify this by invoking \fIfetchmail -v\fR to the mailserver
918 and watching the response to LAST early in the query).  The
919 \fIfetchmail\fR code tries to compensate by using POP3's UID feature,
920 storing the identifiers of messages seen in each session until the
921 next session, in the \fI.fetchids\fR file.  But this doesn't track
922 messages seen with other clients, or read directly with a mailer on
923 the host but not deleted afterward.  A better solution would be to
924 switch to IMAP.
925 .PP
926 Another potential POP3 problem might be servers that insert messages
927 in the middle of mailboxes (some VMS implementations of mail are
928 rumored to do this).  The \fIfetchmail\fR code assumes that new
929 messages are appended to the end of the mailbox; when this is not true
930 it may treat some old messages as new and vice versa.  The only 
931 real fix for this problem is to  switch to IMAP.
932 .PP
933 Yet another POP3 problem is that if they can't make tempfiles in the
934 user's home directory, some POP3 servers will hand back an
935 undocumented response that causes fetchmail to spuriously report "No
936 mail".
937 .PP
938 The IMAP code uses the presence or absence of the server flag \eSeen
939 to decide whether or not a message is new.  Under Unix, it counts on
940 your IMAP server to notice the BSD-style Status flags set by mail user
941 agents and set the \eSeen flag from them when appropriate.  All Unix
942 IMAP servers we know of do this, though it's not specified by the IMAP
943 RFCs.  If you ever trip over a server that doesn't, the symptom will
944 be that messages you have already read on your host will look new to
945 the server.  In this (unlikely) case, only messages you fetched with
946 \fIfetchmail --keep\fR will be both undeleted and marked old.
947 .PP
948 In ETRN mode, \fIfetchmail\fR does not actually retrieve messages;
949 instead, it asks the server's SMTP listener to start a queue flush
950 to the client via SMTP.  Therefore it sends only undelivered messages.
951
952 .SH SPAM FILTERING
953 Many SMTP listeners allow administrators to set up `spam filters' that
954 block unsolicited email from specified domains.  A MAIL FROM or DATA line that
955 triggers this feature will elicit an SMTP response which
956 (unfortunately) varies according to the listener.
957 .PP
958 Newer versions of 
959 .I sendmail
960 return an error code of 571.  This return value
961 is blessed by RFC1893 as "Delivery not authorized, message refused".
962 .PP
963 According to current drafts of the replacement for RFC821, the correct
964 thing to return in this situation is 550 "Requested action not taken:
965 mailbox unavailable" (the draft adds "[E.g., mailbox not found, no
966 access, or command rejected for policy reasons].").
967 .PP
968 The
969 .I exim
970 MTA returns 501 "Syntax error in parameters or arguments", but will
971 move to 550 soon.
972 .PP
973 The
974 .I postfix
975 MTA runs 554 as an antispam response.
976 .PP
977 The
978 .I fetchmail
979 code recognizes and discards the message on any of a list of responses
980 that defaults to [571, 550, 501, 554] but can be set with the `antispam'
981 option.  This is one of the
982 .I only
983 three circumstance under which fetchmail ever discards mail (the others
984 are the 552 and 553 errors described below, and the suppression of
985 multidropped messages with a message-ID already seen).
986 .PP
987 If
988 .I fetchmail
989 is fetching from an IMAP server, the antispam response will be detected and
990 the message rejected immediately after the headers have been fetched,
991 without reading the message body.  Thus, you won't pay for downloading 
992 spam message bodies.
993 .PP
994 Mail that is spam-blocked triggers an RFC1892 bounce message informing
995 the originator that we do not accept mail from it.
996
997 .SH SMTP/ESMTP ERROR HANDLING
998 Besides the spam-blocking described above,fetchmail takes special
999 actions on the following SMTP/ESMTP error responses
1000 .TP 5
1001 452 (insufficient system storage)
1002 Leave the message in the server mailbox for later retrieval.
1003 .TP 5
1004 552 (message exceeds fixed maximum message size)
1005 Delete the message from the server.  Send bounce-mail to the originator.
1006 .TP 5
1007 553 (invalid sending domain)
1008 Delete the message from the server.  Send bounce-mail to the originator.
1009 .PP
1010 Other errors trigger bounce mail back to the originator.
1011
1012 .SH THE RUN CONTROL FILE
1013 The preferred way to set up fetchmail is to write a
1014 \&\fI.fetchmailrc\fR file in your home directory (you may do this
1015 directly, with a text editor, or indirectly via \fIfetchmailconf\fR).
1016 When there is a conflict between the command-line arguments and the
1017 arguments in this file, the command-line arguments take precedence.
1018 .PP
1019 To protect the security of your passwords, when --version is not on
1020 your \fI~/.fetchmailrc\fR may not have more than 0600 (u=rw,g=,o=) permissions;
1021 .I fetchmail
1022 will complain and exit otherwise.
1023 .PP
1024 You may read the \fI.fetchmailrc\fR file as a list of commands to 
1025 be executed when 
1026 .I fetchmail
1027 is called with no arguments.
1028 .SS Run Control Syntax
1029 .PP
1030 Comments begin with a '#' and extend through the end of the line.
1031 Otherwise the file consists of a series of server entries or global
1032 option statements in a free-format, token-oriented syntax.
1033 .PP
1034 There are four kinds of tokens: grammar keywords, numbers
1035 (i.e. decimal digit sequences), unquoted strings, and quoted strings.
1036 A quoted string is bounded by double quotes and may contain
1037 whitespace (and quoted digits are treated as a string).  An unquoted
1038 string is any whitespace-delimited token that is neither numeric, string
1039 quoted nor contains the special characters `,', `;', `:', or `='.
1040 .PP
1041 Any amount of whitespace separates tokens in server entries, but is
1042 otherwise ignored. You may use standard C-style escapes (\en, \et,
1043 \eb, octal, and hex) to embed non-printable characters or string
1044 delimiters in strings.
1045 .PP
1046 Each server entry consists of one of the keywords `poll' or `skip',
1047 followed by a server name, followed by server options, followed by any
1048 number of user descriptions.  Note: the most common cause of syntax
1049 errors is mixing up user and server options.
1050 .PP
1051 For backward compatibility, the word `server' is a synonym for `poll'.
1052 .PP
1053 You can use the noise keywords `and', `with',
1054 \&`has', `wants', and `options' anywhere in an entry to make
1055 it resemble English.  They're ignored, but but can make entries much
1056 easier to read at a glance.  The punctuation characters ':', ';' and
1057 \&',' are also ignored.
1058 .PP
1059 .SS Poll vs. Skip
1060 The `poll' verb tells fetchmail to query this host when it is run with
1061 no arguments.  The `skip' verb tells
1062 .I fetchmail 
1063 not to poll this host unless it is explicitly named on the command
1064 line.  (The `skip' verb allows you to experiment with test entries
1065 safely, or easily disable entries for hosts that are temporarily down.)
1066 .PP
1067 .SS Keyword/Option Summary
1068 Here are the legal options.  Keyword suffixes enclosed in
1069 square brackets are optional.  Those corresponding to command-line
1070 options are followed by `-' and the appropriate option letter.
1071
1072 Here are the legal global options:
1073
1074 .TS
1075 l l lw34.
1076 Keyword         Opt     Function
1077 _
1078 set daemon      \&      T{
1079 Set a background poll interval in seconds
1080 T}
1081 set postmaster          \&      T{
1082 Give the name of the last-resort mail recipient
1083 T}
1084 set no bouncemail       \&      T{
1085 Direct error mail to postmaster rather than sender
1086 T}
1087 set logfile     \&      T{
1088 Name of a file to dump error and status messages to
1089 T}
1090 set idfile      \&      T{
1091 Name of the file to store UID lists in
1092 T}
1093 set syslog      \&      T{
1094 Do error logging through syslog(3).
1095 T}
1096 set nosyslog    \&      T{
1097 Turn off error logging through syslog(3).
1098 T}
1099 set properties  \&      T{
1100 String value is ignored by fetchmail (may be used by extension scripts)
1101 T}
1102 .TE
1103
1104 Here are the legal server options:
1105
1106 .TS
1107 l l lw34.
1108 Keyword         Opt     Function
1109 _
1110 via             \&      T{
1111 Specify DNS name of mailserver, overriding poll name
1112 T}
1113 proto[col]      -p      T{
1114 Specify protocol (case insensitive):
1115 POP2, POP3, IMAP, IMAP-K4, IMAP-GSS, APOP, KPOP
1116 T}
1117 port            -P      T{
1118 Specify TCP/IP service port
1119 T}
1120 auth[enticate]  -A      T{
1121 Set preauthentication type (default `password')
1122 T}
1123 timeout         -t      T{
1124 Server inactivity timeout in seconds (default 300)
1125 T}
1126 envelope        -E      T{
1127 Specify envelope-address header name
1128 T}
1129 no envelope     \&      T{
1130 Disable looking for envelope address
1131 T}
1132 qvirtual        -Q      T{
1133 Qmail virtual domain prefix to remove from user name
1134 T}
1135 aka             \&      T{
1136 Specify alternate DNS names of mailserver
1137 T}
1138 interface       -I      T{
1139 specify IP interface(s) that must be up for server poll to take place
1140 T}
1141 monitor         -M      T{
1142 Specify IP address to monitor for activity
1143 T}
1144 plugin          \&      T{
1145 Specify command through which to make server connections.
1146 T}
1147 plugout         \&      T{
1148 Specify command through which to make listener connections.
1149 T}
1150 dns             \&      T{
1151 Enable DNS lookup for multidrop (default)
1152 T}
1153 no dns          \&      T{
1154 Disable DNS lookup for multidrop
1155 T}
1156 checkalias      \&      T{
1157 Do comparison by IP address for multidrop
1158 T}
1159 no checkalias   \&      T{
1160 Do comparison by name for multidrop (default)
1161 T}
1162 uidl            -U      T{
1163 Force POP3 to use client-side UIDLs
1164 T}
1165 no uidl         \&      T{
1166 Turn off POP3 use of client-side UIDLs (default)
1167 T}
1168 interval        \&      T{
1169 Only check this site every N poll cycles; N is a numeric argument.
1170 T}
1171 .TE
1172
1173 Here are the legal user options:
1174
1175 .TS
1176 l l lw34.
1177 Keyword         Opt     Function
1178 _
1179 user[name]      -u      T{
1180 Set remote user name 
1181 (local user name if name followed by `here') 
1182 T}
1183 is              \&      T{
1184 Connect local and remote user names
1185 T}
1186 to              \&      T{
1187 Connect local and remote user names
1188 T}
1189 pass[word]      \&      T{
1190 Specify remote account password
1191 T}
1192 ssl             T{
1193 Connect to server over the specified base protocol using SSL encryption
1194 T}
1195 sslcert                 T{
1196 Specify file for client side public SSL certificate
1197 T}
1198 sslkey                  T{
1199 Specify file for client side private SSL key
1200 T}
1201 folder          -r      T{
1202 Specify remote folder to query
1203 T}
1204 smtphost        -S      T{
1205 Specify smtp host(s) to forward to
1206 T}
1207 smtpaddress     -D      T{
1208 Specify the domain to be put in RCPT TO lines
1209 T}
1210 antispam        -Z      T{
1211 Specify what SMTP returns are interpreted as spam-policy blocks
1212 T}
1213 mda             -m      T{
1214 Specify MDA for local delivery
1215 T}
1216 bsmtp           -o      T{
1217 Specify BSMTP batch file to append to
1218 T}
1219 preconnect      \&      T{
1220 Command to be executed before each connection
1221 T}
1222 postconnect     \&      T{
1223 Command to be executed after each connection
1224 T}
1225 keep            -k      T{
1226 Don't delete seen messages from server
1227 T}
1228 flush           -F      T{
1229 Flush all seen messages before querying
1230 T}
1231 fetchall        -a      T{
1232 Fetch all messages whether seen or not
1233 T}
1234 rewrite         \&      T{
1235 Rewrite destination addresses for reply (default)
1236 T}
1237 stripcr         \&      T{
1238 Strip carriage returns from ends of lines
1239 T}
1240 forcecr         \&      T{
1241 Force carriage returns at ends of lines
1242 T}
1243 pass8bits       \&      T{
1244 Force BODY=8BITMIME to ESMTP listener
1245 T}
1246 dropstatus      \&      T{
1247 Strip Status and X-Mozilla-Status lines out of incoming mail
1248 T}
1249 mimedecode      \&      T{
1250 Convert quoted-printable to 8-bit in MIME messages
1251 T}
1252 idle            \&      T{
1253 Idle waiting for new messages after each poll (IMAP only)
1254 T}
1255 no keep         -K      T{
1256 Delete seen messages from server (default)
1257 T}
1258 no flush        \&      T{
1259 Don't flush all seen messages before querying (default)
1260 T}
1261 no fetchall     \&      T{
1262 Retrieve only new messages (default)
1263 T}
1264 no rewrite      \&      T{
1265 Don't rewrite headers
1266 T}
1267 no stripcr      \&      T{
1268 Don't strip carriage returns (default)
1269 T}
1270 no forcecr      \&      T{
1271 Don't force carriage returns at EOL (default)
1272 T}
1273 no pass8bits    \&      T{
1274 Don't force BODY=8BITMIME to ESMTP listener (default)
1275 T}
1276 no dropstatus   \&      T{
1277 Don't drop Status headers (default)
1278 T}
1279 no mimedecode   \&      T{
1280 Don't convert quoted-printable to 8-bit in MIME messages (default)
1281 T}
1282 no idle         \&      T{
1283 Don't idle waiting for new messages after each poll (IMAP only)
1284 T}
1285 limit           -l      T{
1286 Set message size limit
1287 T}
1288 warnings        -w      T{
1289 Set message size warning interval
1290 T}
1291 batchlimit      -b      T{
1292 Max # messages to forward in single connect
1293 T}
1294 fetchlimit      -B      T{
1295 Max # messages to fetch in single connect
1296 T}
1297 expunge         -e      T{
1298 Perform an expunge on every #th message (IMAP only)
1299 T}
1300 properties      \&      T{
1301 String value is ignored by fetchmail (may be used by extension scripts)
1302 T}
1303 .TE
1304 .PP
1305 Remember that all user options must \fIfollow\fR all server options.
1306 .PP
1307 In the .fetchmailrc file, the `envelope' string argument may be
1308 preceded by a whitespace-separated number.  This number, if specified,
1309 is the number of such headers to skip (that is, an argument of 1
1310 selects the second header of the given type).  This is sometime useful
1311 for ignoring bogus Received headers created by an ISP's local delivery
1312 agent.
1313 .SS Keywords Not Corresponding To Option Switches
1314 .PP
1315 The `folder' and `smtphost' options (unlike their command-line
1316 equivalents) can take a space- or comma-separated list of names
1317 following them.
1318 .PP
1319 All options correspond to the obvious command-line arguments, except
1320 the following: `via', `interval', `aka', `is', `to', `dns'/`no dns',
1321 `checkalias'/`no checkalias', `password', `preconnect', `postconnect',
1322 `localdomains', `stripcr'/`no stripcr', `forcecr'/`no forcecr',
1323 `pass8bits'/`no pass8bits' `dropstatus/no dropstatus', `mimedecode/no
1324 mimedecode', `idle/no idle', and `no envelope'.
1325 .PP
1326 The `via' option is for use with ssh, or if you want to have more
1327 than one configuration pointing at the same site.  If it is present,
1328 the string argument will be taken as the actual DNS name of the 
1329 mailserver host to query.
1330 This will override the argument of poll, which can then simply be a
1331 distinct label for the configuration (e.g. what you would give on the
1332 command line to explicitly query this host).
1333 If the `via' name is `localhost', the poll name will also still be
1334 used as a possible match in multidrop mode; otherwise the `via' name
1335 will be used instead and the poll name will be purely a label.
1336 .PP
1337 The `interval' option (which takes a numeric argument) allows you to poll a
1338 server less frequently than the basic poll interval.  If you say
1339 \&`interval N' the server this option is attached to will only be
1340 queried every N poll intervals. 
1341 .PP
1342 The `is' or `to' keywords associate the following local (client)
1343 name(s) (or server-name to client-name mappings separated by =) with
1344 the mailserver user name in the entry.  If an is/to list has `*' as
1345 its last name, unrecognized names are simply passed through.
1346 .PP
1347 A single local name can be used to support redirecting your mail when
1348 your username on the client machine is different from your name on the
1349 mailserver.  When there is only a single local name, mail is forwarded
1350 to that local username regardless of the message's Received, To, Cc,
1351 and Bcc headers.  In this case 
1352 .I fetchmail
1353 never does DNS lookups.
1354 .PP
1355 When there is more than one local name (or name mapping) the
1356 \fIfetchmail\fR code does look at the Received, To, Cc, and Bcc
1357 headers of retrieved mail (this is `multidrop mode').  It looks for
1358 addresses with hostname parts that match your poll name or your `via',
1359 `aka' or `localdomains' options, and usually also for hostname parts
1360 which DNS tells it are aliases of the mailserver.  See the discussion
1361 of `dns', `checkalias', `localdomains', and `aka' for details on how
1362 matching addresses are handled.
1363 .PP
1364 If \fIfetchmail\fR cannot match any mailserver usernames or
1365 localdomain addresses, the mail will be bounced.
1366 Normally it will be bounced to the sender, but if `nobounce' is on
1367 it will go to the postmaster (which in turn defaults to being the
1368 calling user).
1369 .PP
1370 The `dns' option (normally on) controls the way addresses from
1371 multidrop mailboxes are checked.  On, it enables logic to check each
1372 host address that doesn't match an `aka' or `localdomains' declaration
1373 by looking it up with DNS.  When a mailserver username is recognized
1374 attached to a matching hostname part, its local mapping is added to
1375 the list of local recipients.
1376 .PP
1377 The `checkalias' option (normally off) extends the lookups performed
1378 by the `dns' keyword in multidrop mode, providing a way to cope with
1379 remote MTAs that identify themselves using their canonical name, while
1380 they're polled using an alias.
1381 When such a server is polled, checks to extract the envelope address
1382 fail, and
1383 .IR fetchmail 
1384 reverts to delivery using the To/Cc/Bcc headers (See below 
1385 `Header vs. Envelope addresses'). 
1386 Specifying this option instructs
1387 .IR fetchmail 
1388 to retrieve all the IP addresses associated with both the poll name
1389 and the name used by the remote MTA and to do a comparison of the IP
1390 addresses.  This comes in handy in situations where the remote server
1391 undergoes frequent canonical name changes, that would otherwise
1392 require modifications to the rcfile.  `checkalias' has no effect if
1393 `no dns' is specified in the rcfile.
1394 .PP
1395 The `aka' option is for use with multidrop mailboxes.  It allows you
1396 to pre-declare a list of DNS aliases for a server.  This is an
1397 optimization hack that allows you to trade space for speed.  When
1398 .IR fetchmail ,
1399 while processing a multidrop mailbox, grovels through message headers
1400 looking for names of the mailserver, pre-declaring common ones can
1401 save it from having to do DNS lookups.
1402 .PP
1403 The `localdomains' option allows you to declare a list of domains
1404 which fetchmail should consider local.  When fetchmail is parsing
1405 address lines in multidrop modes, and a trailing segment of a host
1406 name matches a declared local domain, that address is passed through
1407 to the listener or MDA unaltered (local-name mappings are \fInot\fR
1408 applied).
1409 .PP
1410 If you are using `localdomains', you may also need to specify \&`no
1411 envelope', which disables \fIfetchmail\fR's normal attempt to deduce
1412 an envelope address from the Received line or X-Envelope-To header or
1413 whatever header has been previously set by `envelope'.  If you set `no
1414 envelope' in the defaults entry it is possible to undo that in
1415 individual entries by using `envelope <string>'.  As a special case,
1416 \&`envelope "Received"' restores the default parsing of
1417 Received lines.
1418 .PP
1419 The \fBpassword\fR option requires a string argument, which is the password
1420 to be used with the entry's server.
1421 .PP
1422 The `preconnect' keyword allows you to specify a shell command to be
1423 executed just before each time
1424 .I fetchmail
1425 establishes a mailserver connection.  This may be useful if you are 
1426 attempting to set up secure POP connections with the aid of
1427 .IR ssh (1).
1428 If the command returns a nonzero status, the poll of that mailserver
1429 will be aborted.
1430 .PP
1431 Similarly, the `postconnect' keyword similarly allows you to specify a
1432 shell command to be executed just after each time a mailserver
1433 connection is taken down.
1434 .PP
1435 The `forcecr' option controls whether lines terminated by LF only are
1436 given CRLF termination before forwarding.  Strictly speaking RFC821
1437 requires this, but few MTAs enforce the requirement it so this option
1438 is normally off (only one such MTA, qmail, is in significant use at
1439 time of writing).  
1440 .PP
1441 The `stripcr' option controls whether carriage returns are stripped
1442 out of retrieved mail before it is forwarded.  It is normally not
1443 necessary to set this, because it defaults to `on' (CR stripping
1444 enabled) when there is an MDA declared but `off' (CR stripping
1445 disabled) when forwarding is via SMTP.  If `stripcr' and `forcecr' are
1446 both on, `stripcr' will override.
1447 .PP
1448 The `pass8bits' option exists to cope with Microsoft mail programs that
1449 stupidly slap a "Content-Transfer-Encoding: 7bit" on everything.  With
1450 this option off (the default) and such a header present, 
1451 .I fetchmail
1452 declares BODY=7BIT to an ESMTP-capable listener; this causes problems for
1453 messages actually using 8-bit ISO or KOI-8 character sets, which will
1454 be garbled by having the high bits of all characters stripped.  If
1455 \&`pass8bits' is on, 
1456 .I fetchmail
1457 is forced to declare BODY=8BITMIME to any ESMTP-capable listener.  If
1458 the listener is 8-bit-clean (as all the major ones now are) the right
1459 thing will probably result.
1460 .PP
1461 The `dropstatus' option controls whether nonempty Status and
1462 X-Mozilla-Status lines are retained in fetched mail (the default) or
1463 discarded.  Retaining them allows your MUA to see what messages (if
1464 any) were marked seen on the server.  On the other hand, it can
1465 confuse some new-mail notifiers, which assume that anything with a
1466 Status line in it has been seen.  (Note: the empty Status lines
1467 inserted by some buggy POP servers are unconditionally discarded.)
1468 .PP
1469 The `mimedecode' option controls whether MIME messages using the
1470 quoted-printable encoding are automatically converted into pure 8-bit
1471 data. If you are delivering mail to an ESMTP-capable, 8-bit-clean
1472 listener (that includes all of the major MTAs like sendmail), then
1473 this will automatically convert quoted-printable message headers and
1474 data into 8-bit data, making it easier to understand when reading
1475 mail. If your e-mail programs know how to deal with MIME messages,
1476 then this option is not needed.  The mimedecode option is off by
1477 default, because doing RFC2047 conversion on headers throws away
1478 character-set information and can lead to bad results if the encoding
1479 of the headers differs from the body encoding.
1480 .PP
1481 The `idle' option is usable only with IMAP servers supporting the
1482 RFC2177 IDLE command extension.  If it is enabled, and fetchmail
1483 detects that IDLE is supported, an IDLE will be issued at the end
1484 of each poll.  This will tell the IMAP server to hold the connection
1485 open and notify the client when new mail is available.  If you need to
1486 poll a link frequently, IDLE can save bandwidth by eliminating TCP/IP
1487 connects and LOGIN/LOGOUT sequences. On the other hand, an IDLE 
1488 connection will eat almost akll of your fetchmail's time, because it
1489 will never drop the connection and allow other pools to occur unless
1490 the server times out the IDLE.
1491 .PP
1492 The `properties' option is an extension mechanism.  It takes a string
1493 argument, which is ignored by fetchmail itself.  The string argument may be
1494 used to store configuration information for scripts which require it.
1495 In particular, the output of `--configdump' option will make properties
1496 associated with a user entry readily available to a Python script.
1497 .PP
1498 .SS Miscellaneous Run Control Options
1499 The words `here' and `there' have useful English-like
1500 significance.  Normally `user eric is esr' would mean that 
1501 mail for the remote user `eric' is to be delivered to `esr',
1502 but you can make this clearer by saying `user eric there is esr here',
1503 or reverse it by saying `user esr here is eric there'
1504 .PP
1505 Legal protocol identifiers for use with the `protocol' keyword are:
1506
1507     auto (or AUTO)
1508     pop2 (or POP2)
1509     pop3 (or POP3)
1510     sdps (or SDPS)
1511     imap (or IMAP)
1512     imap-k4 (or IMAP-K4)
1513     imap-gss (or IMAP-GSS)
1514     imap-crammd5 (or IMAP-CRAMMD5)
1515     imap-login (or IMAP-LOGIN)
1516     apop (or APOP)
1517     kpop (or KPOP)
1518
1519 .PP
1520 Legal authentication types are `password' or `kerberos'.  The former
1521 specifies authentication by normal transmission of a password (the
1522 password may be plaintext or subject to protocol-specific encryption
1523 as in APOP); the second tells \fIfetchmail\fR to try to get a Kerberos
1524 ticket at the start of each query instead, and send an arbitrary
1525 string as the password.
1526 .PP
1527 Specifying `kpop' sets POP3 protocol over port 1109 with Kerberos V4
1528 preauthentication.  These defaults may be overridden by later options.
1529 .PP
1530 There are currently four global option statements; `set logfile'
1531 followed by a string sets the same global specified by --logfile.  A
1532 command-line --logfile option will override this.  Also, `set daemon'
1533 sets the poll interval as --daemon does.  This can be overridden by a
1534 command-line --daemon option; in particular --daemon 0 can be used to
1535 force foreground operation. The `set postmater' statement sets the
1536 address to which multidrop mail defaults if there are no local
1537 matches.  Finally, `set syslog' sends log messages to syslogd(8).
1538
1539 .SH INTERACTION WITH RFC 822
1540 When trying to determine the originating address of a message,
1541 fetchmail looks through headers in the following order: 
1542
1543         Return-Path:
1544         Resent-Sender:
1545         Sender:
1546         Resent-From:
1547         From:
1548         Reply-To:
1549         Apparently-From:
1550
1551 The originating address is used for logging, and to set the MAIL FROM
1552 address when forwarding to SMTP.  This order is intended to cope
1553 gracefully with receiving mailing list messages in multidrop mode. The
1554 intent is that if a local address doesn't exist, the bounce message
1555 won't be returned blindly to the author or to the list itself, but
1556 rather to the list manager (which is less annoying).
1557
1558 In multidrop mode, destination headers are processed as follows:
1559 First, fetchmail looks for the Received: header (or whichever one is
1560 specified by the `envelope' option) to determine the local
1561 recipient address. If the mail is addressed to more than one recipient,
1562 the Received line won't contain any information regarding recipient addresses.
1563
1564 Then fetchmail looks for the Resent-To:, Resent-Cc:, and Resent-Bcc:
1565 lines.  If they exists, they should contain the final recipients and
1566 have precedence over their To:/Cc:/Bcc: counterparts.  If the Resent-*
1567 lines doesn't exist, the To:, Cc:, Bcc: and Apparently-To: lines are
1568 looked for. (The presence of a Resent-To: is taken to imply that the
1569 person referred by the To: address has already received the original
1570 copy of the mail).
1571
1572 .SH CONFIGURATION EXAMPLES
1573 Basic format is:
1574
1575 .nf
1576   poll SERVERNAME protocol PROTOCOL username NAME password PASSWORD 
1577 .fi
1578 .PP
1579 Example:
1580
1581 .nf
1582   poll pop.provider.net protocol pop3 username "jsmith" password "secret1"
1583 .fi
1584 .PP
1585 Or, using some abbreviations:
1586
1587 .nf
1588   poll pop.provider.net proto pop3 user "jsmith" password "secret1"
1589 .fi
1590 .PP
1591 Multiple servers may be listed:
1592
1593 .nf
1594   poll pop.provider.net proto pop3 user "jsmith" pass "secret1"
1595   poll other.provider.net proto pop2 user "John.Smith" pass "My^Hat"
1596 .fi
1597
1598 Here's a version of those two with more whitespace and some noise words: 
1599
1600 .nf
1601   poll pop.provider.net proto pop3
1602       user "jsmith", with password secret1, is "jsmith" here;
1603   poll other.provider.net proto pop2:
1604       user "John.Smith", with password "My^Hat", is "John.Smith" here;
1605 .fi
1606
1607 This version is much easier to read and doesn't cost significantly
1608 more (parsing is done only once, at startup time).
1609
1610 .PP
1611 If you need to include whitespace in a parameter string, enclose the
1612 string in double quotes.  Thus:
1613
1614 .nf
1615   poll mail.provider.net with proto pop3:
1616         user "jsmith" there has password "u can't krak this"
1617                     is jws here and wants mda "/bin/mail"
1618 .fi
1619
1620 You may have an initial server description headed by the keyword
1621 `defaults' instead of `poll' followed by a name.  Such a record
1622 is interpreted as defaults for all queries to use. It may be overwritten
1623 by individual server descriptions.  So, you could write:
1624
1625 .nf
1626   defaults proto pop3
1627         user "jsmith"
1628   poll pop.provider.net
1629         pass "secret1"
1630   poll mail.provider.net
1631         user "jjsmith" there has password "secret2"
1632 .fi
1633
1634 It's possible to specify more than one user per server (this is only
1635 likely to be useful when running fetchmail in daemon mode as root).
1636 The `user' keyword leads off a user description, and every user specification
1637 in a multi-user entry must include it.  Here's an example:
1638
1639 .nf
1640   poll pop.provider.net proto pop3 port 3111
1641         user "jsmith" with pass "secret1" is "smith" here
1642         user jones with pass "secret2" is "jjones" here
1643 .fi
1644
1645 This associates the local username `smith' with the pop.provider.net
1646 username `jsmith' and the local username `jjones' with the
1647 pop.provider.net username `jones'.
1648 .PP
1649 Here's what a simple retrieval configuration for a multi-drop mailbox
1650 looks like:
1651
1652 .nf
1653   poll pop.provider.net:
1654         user maildrop with pass secret1 to golux hurkle=happy snark here
1655 .fi
1656
1657 This says that the mailbox of account `maildrop' on the server is a
1658 multi-drop box, and that messages in it should be parsed for the
1659 server user names `golux', `hurkle', and `snark'.  It further
1660 specifies that `golux' and `snark' have the same name on the
1661 client as on the server, but mail for server user `hurkle' should be
1662 delivered to client user `happy'.
1663 .PP
1664 Here's an example of another kind of multidrop connection:
1665
1666 .nf
1667   poll pop.provider.net localdomains loonytoons.org toons.org:
1668         user maildrop with pass secret1 to esr * here
1669 .fi
1670
1671 This also says that the mailbox of account `maildrop' on the server is
1672 a multi-drop box.  It tells fetchmail that any address in the
1673 loonytoons.org or toons.org domains (including subdomain addresses like
1674 `joe@daffy.loonytoons.org') should be passed through to the local SMTP
1675 listener without modification.  Be careful of mail loops if you do this!
1676 .PP
1677 Here's an example configuration using ssh.  The queries go through an
1678 ssh connecting local port 1234 to port 110 on mailhost.net; the
1679 preconnect command sets up the ssh.
1680
1681 .nf
1682 poll mailhost.net via localhost port 1234 with proto pop3:
1683         preconnect "ssh -f -L 1234:mailhost.net:110
1684                 mailhost.net sleep 20 </dev/null >/dev/null";
1685 .fi
1686
1687 .SH THE USE AND ABUSE OF MULTIDROP MAILBOXES
1688 Use the multiple-local-recipients feature with caution -- it can bite.
1689 Also note that all multidrop features are ineffective in ETRN mode.
1690
1691 Also, note that in multidrop mode duplicate mails are suppressed.  A
1692 piece of mail is considered duplicate if it has the same message-ID as
1693 the message immediately preceding and more than one addressee.  Such
1694 runs of messages may be generated when copies of a message addressed
1695 to multiple users are delivered to a multidrop box.
1696
1697 .SS Header vs. Envelope addresses 
1698 The fundamental problem is that by having your mailserver toss several
1699 peoples' mail in a single maildrop box, you may have thrown away
1700 potentially vital information about who each piece of mail was
1701 actually addressed to (the `envelope address', as opposed to the
1702 header addresses in the RFC822 To/Cc/Bcc headers).  This `envelope
1703 address' is the address you need in order to reroute mail properly.
1704 .PP
1705 Sometimes 
1706 .I fetchmail
1707 can deduce the envelope address.  If the mailserver MTA is
1708 .I sendmail
1709 and the item of mail had just one recipient, the MTA will have written
1710 a `by/for' clause that gives the envelope addressee into its Received
1711 header. But this doesn't work reliably for other MTAs, nor if there is
1712 more than one recipient.  By default, \fIfetchmail\fR looks for
1713 envelope addresses in these lines; you can restore this default with
1714 -E "Received" or \&`envelope Received'.
1715 .PP
1716 Alternatively, some SMTP listeners and/or mail servers insert a header
1717 in each message containing a copy of the envelope addresses.  This
1718 header (when it exists) is often `X-Envelope-To'.  Fetchmail's
1719 assumption about this can be changed with the -E or `envelope' option.
1720 Note that writing an envelope header of this kind exposes the names of
1721 recipients (including blind-copy recipients) to all receivers of the
1722 messages; it is therefore regarded by some administrators as a
1723 security/privacy problem.
1724 .PP
1725 A slight variation of the `X-Envelope-To' header is the `Delivered-To' put
1726 by qmail to avoid mail loops. It will probably prefix the user name with a
1727 string that normally matches the user's domain. To remove this prefix you
1728 can use the -Q or `qvirtual' option.
1729 .PP
1730 Sometimes, unfortunately, neither of these methods works.  When they
1731 all fail, fetchmail must fall back on the contents of To/Cc/Bcc
1732 headers to try to determine recipient addressees -- and these are not
1733 reliable.  In particular, mailing-list software often ships mail with
1734 only the list broadcast address in the To header.
1735 .PP
1736 When
1737 .I fetchmail
1738 cannot deduce a recipient address that is local, and the intended
1739 recipient address was anyone other than fetchmail's invoking user,
1740 mail will get lost.  This is what makes the multidrop feature risky.
1741 .PP
1742 A related problem is that when you blind-copy a mail message, the Bcc
1743 information is carried \fIonly\fR as envelope address (it's not put
1744 in the headers fetchmail can see unless there is an X-Envelope
1745 header).  Thus, blind-copying to someone who gets mail over a
1746 fetchmail link will fail unless the the mailserver host routinely
1747 writes X-Envelope or an equivalent header into messages in your maildrop.
1748
1749 .SS Good Ways To Use Multidrop Mailboxes
1750 Multiple local names can be used to administer a mailing list from the
1751 client side of a \fIfetchmail\fR collection.  Suppose your name is
1752 \&`esr', and you want to both pick up your own mail and maintain a mailing
1753 list called (say) "fetchmail-friends", and you want to keep the alias
1754 list on your client machine.
1755 .PP
1756 On your server, you can alias \&`fetchmail-friends' to `esr'; then, in
1757 your \fI.fetchmailrc\fR, declare \&`to esr fetchmail-friends here'.
1758 Then, when mail including `fetchmail-friends' as a local address
1759 gets fetched, the list name will be appended to the list of
1760 recipients your SMTP listener sees.  Therefore it will undergo alias
1761 expansion locally.  Be sure to include `esr' in the local alias
1762 expansion of fetchmail-friends, or you'll never see mail sent only to
1763 the list.  Also be sure that your listener has the "me-too" option set
1764 (sendmail's -oXm command-line option or OXm declaration) so your name
1765 isn't removed from alias expansions in messages you send.
1766 .PP
1767 This trick is not without its problems, however.  You'll begin to see
1768 this when a message comes in that is addressed only to a mailing list
1769 you do \fInot\fR have declared as a local name.  Each such message
1770 will feature an `X-Fetchmail-Warning' header which is generated
1771 because fetchmail cannot find a valid local name in the recipient
1772 addresses.  Such messages default (as was described above) to being
1773 sent to the local user running
1774 .IR fetchmail ,
1775 but the program has no way to know that that's actually the right thing.
1776
1777 .SS Bad Ways To Abuse Multidrop Mailboxes
1778 Multidrop mailboxes and 
1779 .I fetchmail
1780 serving multiple users in daemon mode do not mix.  The problem, again, is
1781 mail from mailing lists, which typically does not have an individual
1782 recipient address on it.   Unless 
1783 .I fetchmail
1784 can deduce an envelope address, such mail will only go to the account
1785 running fetchmail (probably root).  Also, blind-copied users are very
1786 likely never to see their mail at all.
1787 .PP
1788 If you're tempted to use 
1789 .I fetchmail 
1790 to retrieve mail for multiple users from a single mail drop via POP or
1791 IMAP, think again (and reread the section on header and envelope
1792 addresses above).  It would be smarter to just let the mail sit in the
1793 mailserver's queue and use fetchmail's ETRN mode to trigger SMTP sends
1794 periodically (of course, this means you have to poll more frequently
1795 than the mailserver's expiry period).  If you can't arrange this, try
1796 setting up a UUCP feed.
1797 .PP
1798 If you absolutely \fImust\fR use multidrop for this purpose, make sure
1799 your mailserver writes an envelope-address header that fetchmail can
1800 see.  Otherwise you \fIwill\fR lose mail and it \fIwill\fR come back
1801 to haunt you.
1802
1803 .SS Speeding Up Multidrop Checking
1804 Normally, when multiple user are declared 
1805 .I fetchmail
1806 extracts recipient addresses as described above and checks each host
1807 part with DNS to see if it's an alias of the mailserver.  If so, the
1808 name mappings described in the to ... here declaration are done and
1809 the mail locally delivered.
1810 .PP
1811 This is the safest but also slowest method.  To speed it up,
1812 pre-declare mailserver aliases with `aka'; these are checked before
1813 DNS lookups are done.  If you're certain your aka list contains
1814 .B all
1815 DNS aliases of the mailserver (and all MX names pointing at it) 
1816 you can declare `no dns' to suppress DNS lookups entirely and
1817 \fIonly\fR match against the aka list.
1818
1819 .SH EXIT CODES
1820 To facilitate the use of 
1821 .I fetchmail
1822 in shell scripts, an exit code is returned to give an indication
1823 of what occurred during a given connection.
1824 .PP
1825 The exit codes returned by 
1826 .I fetchmail
1827 are as follows:
1828 .IP 0
1829 One or more messages were successfully retrieved (or, if the -c option
1830 was selected, were found waiting but not retrieved).
1831 .IP 1
1832 There was no mail awaiting retrieval.  (There may have been old mail still
1833 on the server but not selected for retrieval.)
1834 .IP 2
1835 An error was encountered when attempting to open a socket to retrieve
1836 mail.  If you don't know what a socket is, don't worry about it --
1837 just treat this as an 'unrecoverable error'.
1838 .IP 3
1839 The user authentication step failed.  This usually means that a bad 
1840 user-id, password, or APOP id was specified.  Or it may mean that you 
1841 tried to run fetchmail under circumstances where it did not have
1842 standard input attached to a terminal and could not prompt for a
1843 missing password.
1844 .IP 4
1845 Some sort of fatal protocol error was detected.
1846 .IP 5
1847 There was a syntax error in the arguments to 
1848 .I fetchmail.
1849 .IP 6
1850 The run control file had bad permissions.
1851 .IP 7
1852 There was an error condition reported by the server.  Can also
1853 fire if
1854 .I fetchmail
1855 timed out while waiting for the server.
1856 .IP 8
1857 Client-side exclusion error.  This means 
1858 .I fetchmail
1859 either found another copy of itself already running, or failed in such
1860 a way that it isn't sure whether another copy is running.
1861 .IP 9
1862 The user authentication step failed because the server responded "lock
1863 busy".  Try again after a brief pause!  This error is not implemented
1864 for all protocols, nor for all servers.  If not implemented for your
1865 server, "3" will be returned instead, see above.  May be returned when
1866 talking to qpopper or other servers that can respond with "lock busy"
1867 or some similar text containing the word "lock".
1868 .IP 10
1869 The 
1870 .I fetchmail
1871 run failed while trying to do an SMTP port open or transaction.
1872 .IP 11
1873 Fatal DNS error.  Fetchmail encountered an error while performing
1874 a DNS lookup at startup and could not proceed.
1875 .IP 12
1876 BSMTP batch file could not be opened.
1877 .IP 13
1878 Poll terminated by a fetch limit (see the --fetchlimit option).
1879 .IP 23
1880 Internal error.  You should see a message on standard error with
1881 details.
1882 .PP
1883 When
1884 .I fetchmail
1885 queries more than one host, return status is 0 if \fIany\fR query
1886 successfully retrieved mail. Otherwise the returned error status is
1887 that of the last host queried.
1888
1889 .SH AUTHOR
1890 Eric S. Raymond <esr@snark.thyrsus.com>.  Too many other people to
1891 name here have contributed code and patches. 
1892 This program is descended from and replaces 
1893 .IR popclient , 
1894 by Carl Harris <ceharris@mal.com>; the internals have become quite different, 
1895 but some of its interface design is directly traceable to that
1896 ancestral program.
1897
1898 .SH FILES
1899 .TP 5
1900 ~/.fetchmailrc
1901 default run control file
1902 .TP 5
1903 ~/.fetchids
1904 default location of file associating hosts with last message IDs seen
1905 (used only with newer RFC1725-compliant POP3 servers supporting the
1906 UIDL command).
1907 .TP 5
1908 ~/.netrc 
1909 your FTP run control file, which (if present) will be searched for
1910 passwords as a last resort before prompting for one interactively.
1911 .TP 5
1912 ~/.fetchmail.pid
1913 lock file to help prevent concurrent runs (non-root mode).
1914 .TP 5
1915 /var/run/fetchmail.pid
1916 lock file to help prevent concurrent runs (root mode, Linux systems).
1917 .TP 5
1918 /etc/fetchmail.pid
1919 lock file to help prevent concurrent runs (root mode, systems without /var/run).
1920
1921 .SH ENVIRONMENT
1922 If either the LOGNAME or USER and the variable is correctly set
1923 (e.g. the corresponding UID matches the session user ID) then that
1924 name is used as the default local name.  Otherwise \fBgetpwuid\fR(3)
1925 must be able to retrieve a password entry for the session ID (this
1926 elaborate logic is designed to handle the case of multiple names per
1927 userid gracefully).
1928
1929 .SH SIGNALS
1930 If a
1931 .I fetchmail
1932 daemon is running as root, SIGHUP wakes it up from its sleep phase and
1933 forces a poll of all non-skipped servers (this is in accordance with
1934 the usual conventions for system daemons).
1935 .PP
1936 If
1937 .I fetchmail
1938 is running in daemon mode as non-root, use SIGUSR1 to wake it (this is
1939 so SIGHUP due to logout can retain the default action of killing it).
1940 .PP
1941 Running
1942 .I fetchmail
1943 in foreground while a background fetchmail is running will do
1944 whichever of these is appropriate to wake it up.
1945
1946 .SH BUGS AND KNOWN PROBLEMS
1947 The RFC822 address parser used in multidrop mode chokes on some
1948 @-addresses that are technically legal but bizarre.  Strange uses of
1949 quoting and embedded comments are likely to confuse it.
1950 .PP
1951 In a message with multiple envelope headers, only the last one
1952 processed will be visible to fetchmail.  To get around this, use a
1953 mailserver-side filter that consolidates the contents of all envelope
1954 headers into a single one (procmail, mailagent, or maildrop can be
1955 programmed to do this fairly easily).
1956 .PP
1957 Use of any of the supported protocols other than POP3 with OTP or RPA,
1958 APOP, KPOP, IMAP-K4, IMAP-GSS, IMAP-CRAMMD5, or ETRN requires that the
1959 program send unencrypted passwords over the TCP/IP connection to the
1960 mailserver.  This creates a risk that name/password pairs might be
1961 snaffled with a packet sniffer or more sophisticated monitoring
1962 software.  Under Linux and FreeBSD, the --interface option can be used
1963 to restrict polling to availability of a specific interface device
1964 with a specific local IP address, but snooping is still possible if
1965 (a) either host has a network device that can be opened in promiscuous
1966 mode, or (b) the intervening network link can be tapped.
1967 .PP
1968 Use of the %F or %T escapes in an mda option could open a security
1969 hole, because they pass text manipulable by an attacker to a shell
1970 command.  Potential shell characters are replaced by `_' before
1971 execution.  The hole is further reduced by the fact that fetchmail
1972 temporarily discards any suid privileges it may have while running the
1973 MDA.  For maximum safety, however, don't use an mda command containing
1974 %F or %T when fetchmail is run from the root account itself.
1975 .PP
1976 Fetchmail's method of sending bouncemail requires that port 25 of localhost
1977 be available for sending mail via SMTP.
1978 .PP
1979 If you modify a
1980 .I .fetchmailrc
1981 while a background instance is running and break the syntax, the
1982 background instance will die silently.  Unfortunately, it can't 
1983 die noisily because we don't yet know whether syslog should be enabled.
1984 .PP
1985 Send comments, bug reports, gripes, and the like to the
1986 fetchmail-friends list <fetchmail-friends@ccil.org>.  An HTML FAQ is
1987 available at the fetchmail home page; surf to
1988 http://www.tuxedo.org/~esr/fetchmail or do a WWW search for pages with
1989 `fetchmail' in their titles.
1990
1991 .SH SEE ALSO
1992 mutt(1), elm(1), mail(1), sendmail(8), popd(8), imapd(8)
1993 .SH APPLICABLE STANDARDS
1994 .TP 5
1995 SMTP/ESMTP:
1996 RFC 821, RFC 1869, RFC 1652, RFC 1870, RFC1983, RFC 1985
1997 .TP 5
1998 mail:
1999 RFC 822, RFC 1892, RFC 1894
2000 .TP 5
2001 POP2:
2002 RFC 937
2003 .TP 5
2004 POP3:
2005 RFC 1081, RFC 1225, RFC 1460, RFC 1725, RFC 1939, RFC 1957, RFC2195, RFC 2449
2006 .TP 5
2007 APOP:
2008 RFC 1460, RFC 1725, RFC 1939
2009 .TP 5
2010 RPOP:
2011 RFC 1081, RFC 1225
2012 .TP 5
2013 IMAP2/IMAP2BIS:
2014 RFC 1176, RFC 1732
2015 .TP 5
2016 IMAP4/IMAP4rev1:
2017 RFC 1730, RFC 1731, RFC 1732, RFC 2060, RFC 2061, RFC 2195, RFC 2177
2018 .TP 5
2019 ETRN:
2020 RFC 1985
2021 .TP 5
2022 OTP:
2023 RFC 1938
2024 .TP 5
2025 LMTP:
2026 RFC 2033