]> Pileus Git - ~andy/fetchmail/blob - fetchmail.man
Drop POP2 support.
[~andy/fetchmail] / fetchmail.man
1 '\" t
2 .\" ** The above line should force tbl to be used as a preprocessor **
3 .\"
4 .\" Manual page in man(7) format with tbl(1) and groff_www(7)
5 .\" macros for fetchmail
6 .\"
7 .\" For license terms, see the file COPYING in this directory.
8 .\"
9 .\"
10 .\" Load www macros to process .URL requests, this requires groff:
11 .mso www.tmac
12 .\"
13 .TH fetchmail 1 "fetchmail 6.3.19" "fetchmail" "fetchmail reference manual"
14
15 .SH NAME
16 fetchmail \- fetch mail from a POP, IMAP, ETRN, or ODMR-capable server
17
18 .SH SYNOPSIS
19 \fBfetchmail\fP [\fIoption...\fP] [\fImailserver...\fP]
20 .br
21 \fBfetchmailconf\fP
22
23 .SH DESCRIPTION
24 \fBfetchmail\fP is a mail-retrieval and forwarding utility; it fetches
25 mail from remote mailservers and forwards it to your local (client)
26 machine's delivery system.  You can then handle the retrieved mail using
27 normal mail user agents such as \fBmutt\fP(1), \fBelm\fP(1) or
28 \fBMail\fP(1).  The \fBfetchmail\fP utility can be run in a daemon mode
29 to repeatedly poll one or more systems at a specified interval.
30 .PP
31 The \fBfetchmail\fP program can gather mail from servers supporting any
32 of the common mail-retrieval protocols: POP3, IMAP2bis, IMAP4, and IMAP4rev1.
33 It can also use the ESMTP ETRN extension and ODMR.  (The RFCs describing all
34 these protocols are listed at the end of this manual page.)
35 .PP
36 While \fBfetchmail\fP is primarily intended to be used over on-demand
37 TCP/IP links (such as SLIP or PPP connections), it may also be useful as
38 a message transfer agent for sites which refuse for security reasons to
39 permit (sender-initiated) SMTP transactions with sendmail.
40
41 .SS SUPPORT, TROUBLESHOOTING
42 .PP
43 For troubleshooting, tracing and debugging, you need to increase
44 fetchmail's verbosity to actually see what happens. To do that, please
45 run \fBboth of the two following commands,
46 adding all of the options you'd normally use.\fP
47
48 .IP
49 .nf
50 env LC_ALL=C fetchmail \-V \-v \-\-nodetach \-\-nosyslog
51 .fi
52 .IP
53 (This command line prints in English how fetchmail understands your
54 configuration.)
55
56 .IP
57 .nf
58 env LC_ALL=C fetchmail \-vvv  \-\-nodetach \-\-nosyslog
59 .fi
60 .IP
61 (This command line actually runs fetchmail with verbose English output.)
62 .PP
63 Also see 
64 .URL "http://fetchmail.berlios.de/fetchmail-FAQ.html#G3" "item #G3 in fetchmail's FAQ"
65 .PP
66 You can omit the LC_ALL=C part above if you want output in the local
67 language (if supported). However if you are posting to mailing lists,
68 please leave it in. The maintainers do not necessarily understand your
69 language, please use English.
70
71
72
73 .SS CONCEPTS
74 If \fBfetchmail\fP is used with a POP or an IMAP server (but not with
75 ETRN or ODMR), it has two fundamental modes of operation for each user
76 account from which it retrieves mail: \fIsingledrop\fP- and
77 \fImultidrop\fP-mode.
78 .IP "In singledrop-mode,"
79 \fBfetchmail\fP assumes that all messages in the user's account
80 (mailbox) are intended for a single recipient.  The identity of the
81 recipient will either default to the local user currently executing
82 \fBfetchmail\fP, or will need to be explicitly specified in the
83 configuration file.
84 .IP
85 \fBfetchmail\fP uses singledrop-mode when the fetchmailrc configuration
86 contains at most a single local user specification for a given server
87 account.
88 .IP "In multidrop-mode,"
89 \fBfetchmail\fP assumes that the mail server account actually contains
90 mail intended for any number of different recipients.  Therefore,
91 \fBfetchmail\fP must attempt to deduce the proper "envelope recipient"
92 from the mail headers of each message.  In this mode of operation,
93 \fBfetchmail\fP almost resembles a mail transfer agent (MTA).
94 .IP
95 Note that neither the POP nor IMAP protocols were intended for use in
96 this fashion, and hence envelope information is often not directly
97 available.  The ISP must stores the envelope information in some message
98 header \fBand\fP. The ISP must also store one copy of the message per
99 recipient. If either of the conditions is not fulfilled, this process is
100 unreliable, because \fBfetchmail\fP must then resort to guessing the
101 true envelope recipient(s) of a message. This usually fails for mailing
102 list messages and Bcc:d mail, or mail for multiple recipients in your
103 domain.
104 .IP
105 \fBfetchmail\fP uses multidrop-mode when more than one local user and/or
106 a wildcard is specified for a particular server account in the
107 configuration file.
108 .IP "In ETRN and ODMR modes,"
109 these considerations do not apply, as these protocols are based on SMTP,
110 which provides explicit envelope recipient information. These protocols
111 always support multiple recipients.
112 .PP
113 As each message is retrieved, \fBfetchmail\fP normally delivers it via
114 SMTP to port 25 on the machine it is running on (localhost), just as
115 though it were being passed in over a normal TCP/IP link.
116 \fBfetchmail\fP provides the SMTP server with an envelope recipient
117 derived in the manner described previously.  The mail will then be
118 delivered according to your MTA's rules (the Mail Transfer Agent is
119 usually \fBsendmail\fP(8), \fBexim\fP(8), or \fBpostfix\fP(8)).
120 Invoking your system's MDA (Mail Delivery Agent) is the duty of your
121 MTA.  All the delivery-control mechanisms (such as \fI.forward\fP files)
122 normally available through your system MTA and local delivery agents
123 will therefore be applied as usual.
124 .PP
125 If your fetchmail configuration sets a local MDA (see the \-\-mda
126 option), it will be used directly instead of talking SMTP to port 25.
127 .PP
128 If the program \fBfetchmailconf\fP is available, it will assist you in
129 setting up and editing a fetchmailrc configuration.  It runs under the X
130 window system and requires that the language Python and the Tk toolkit
131 (with Python bindings) be present on your system.  If you are first
132 setting up fetchmail for single-user mode, it is recommended that you
133 use Novice mode.  Expert mode provides complete control of fetchmail
134 configuration, including the multidrop features.  In either case,
135 the 'Autoprobe' button will tell you the most capable protocol a given
136 mailserver supports, and warn you of potential problems with that
137 server.
138
139 .SH GENERAL OPERATION
140 The behavior of \fBfetchmail\fP is controlled by command-line options and a
141 run control file, \fI~/.fetchmailrc\fP,
142 the syntax of which we describe in a later section (this file is what
143 the \fBfetchmailconf\fP program edits).  Command-line options override
144 \fI~/.fetchmailrc\fP declarations.
145 .PP
146 Each server name that you specify following the options on the command
147 line will be queried.  If you don't specify any servers on the command
148 line, each 'poll' entry in your \fI~/.fetchmailrc\fP file will be
149 queried.
150 .PP
151 To facilitate the use of \fBfetchmail\fP in scripts and pipelines, it
152 returns an appropriate exit code upon termination -- see EXIT CODES
153 below.
154 .PP
155 The following options modify the behavior of \fBfetchmail\fP.  It is
156 seldom necessary to specify any of these once you have a
157 working \fI.fetchmailrc\fP file set up.
158 .PP
159 Almost all options have a corresponding keyword which can be used to
160 declare them in a \fI.fetchmailrc\fP file.
161 .PP
162 Some special options are not covered here, but are documented instead
163 in sections on AUTHENTICATION and DAEMON MODE which follow.
164 .SS General Options
165 .TP
166 .B \-V | \-\-version
167 Displays the version information for your copy of \fBfetchmail\fP.  No mail
168 fetch is performed.  Instead, for each server specified, all the option
169 information that would be computed if \fBfetchmail\fP were connecting to that
170 server is displayed.  Any non-printables in passwords or other string names
171 are shown as backslashed C-like escape sequences.  This option is useful for
172 verifying that your options are set the way you want them.
173 .TP
174 .B \-c | \-\-check
175 Return a status code to indicate whether there is mail waiting,
176 without actually fetching or deleting mail (see EXIT CODES below).
177 This option turns off daemon mode (in which it would be useless).  It
178 doesn't play well with queries to multiple sites, and doesn't work
179 with ETRN or ODMR.  It will return a false positive if you leave read but
180 undeleted mail in your server mailbox and your fetch protocol can't
181 tell kept messages from new ones.  This means it will work with IMAP,
182 and may occasionally flake out under POP3.
183 .TP
184 .B \-s | \-\-silent
185 Silent mode.  Suppresses all progress/status messages that are
186 normally echoed to standard output during a fetch (but does not
187 suppress actual error messages).  The \-\-verbose option overrides this.
188 .TP
189 .B \-v | \-\-verbose
190 Verbose mode.  All control messages passed between \fBfetchmail\fP
191 and the mailserver are echoed to stdout.  Overrides \-\-silent.
192 Doubling this option (\-v \-v) causes extra diagnostic information
193 to be printed.
194 .TP
195 .B \-\-nosoftbounce
196 (since v6.3.10, Keyword: set no softbounce, since v6.3.10)
197 .br
198 Hard bounce mode. All permanent delivery errors cause messages to be
199 deleted from the upstream server, see "no softbounce" below.
200 .TP
201 .B \-\-softbounce
202 (since v6.3.10, Keyword: set softbounce, since v6.3.10)
203 .br
204 Soft bounce mode. All permanent delivery errors cause messages to be
205 left on the upstream server if the protocol supports that. Default to
206 match historic fetchmail documentation, to be changed to hard bounce
207 mode in the next fetchmail release.
208 .SS Disposal Options
209 .TP
210 .B \-a | \-\-all | (since v6.3.3) \-\-fetchall
211 (Keyword: fetchall, since v3.0)
212 .br
213 Retrieve both old (seen) and new messages from the mailserver.  The
214 default is to fetch only messages the server has not marked seen.
215 Under POP3, this option also forces the use of RETR rather than TOP.
216 While the \-a and \-\-all command-line and fetchall rcfile options have been
217 supported for a long time, the \-\-fetchall command-line option was added in
218 v6.3.3.
219 .TP
220 .B \-k | \-\-keep
221 (Keyword: keep)
222 .br
223 Keep retrieved messages on the remote mailserver.  Normally, messages
224 are deleted from the folder on the mailserver after they have been retrieved.
225 Specifying the \fBkeep\fP option causes retrieved messages to remain in
226 your folder on the mailserver.  This option does not work with ETRN or
227 ODMR. If used with POP3, it is recommended to also specify the \-\-uidl
228 option or uidl keyword.
229 .TP
230 .B \-K | \-\-nokeep
231 (Keyword: nokeep)
232 .br
233 Delete retrieved messages from the remote mailserver.  This
234 option forces retrieved mail to be deleted.  It may be useful if
235 you have specified a default of \fBkeep\fP in your
236 \&\fI.fetchmailrc\fP.  This option is forced on with ETRN and ODMR.
237 .TP
238 .B \-F | \-\-flush
239 (Keyword: flush)
240 .br
241 POP3/IMAP only.  This is a dangerous option and can cause mail loss when
242 used improperly. It deletes old (seen) messages from the mailserver
243 before retrieving new messages.  \fBWarning:\fP This can cause mail loss if
244 you check your mail with other clients than fetchmail, and cause
245 fetchmail to delete a message it had never fetched before.  It can also
246 cause mail loss if the mail server marks the message seen after
247 retrieval (IMAP2 servers). You should probably not use this option in your
248 configuration file. If you use it with POP3, you must use the 'uidl'
249 option. What you probably want is the default setting: if you don't
250 specify '\-k', then fetchmail will automatically delete messages after
251 successful delivery.
252 .TP
253 .B \-\-limitflush
254 POP3/IMAP only, since version 6.3.0.  Delete oversized messages from the
255 mailserver before retrieving new messages. The size limit should be
256 separately specified with the \-\-limit option.  This option does not
257 work with ETRN or ODMR.
258 .SS Protocol and Query Options
259 .TP
260 .B \-p <proto> | \-\-proto <proto> | \-\-protocol <proto>
261 (Keyword: proto[col])
262 .br
263 Specify the protocol to use when communicating with the remote
264 mailserver.  If no protocol is specified, the default is AUTO.
265 \fBproto\fP may be one of the following:
266 .RS
267 .IP AUTO
268 Tries IMAP and POP3 (skipping any of these for which support
269 has not been compiled in).
270 .IP POP3
271 Post Office Protocol 3
272 .IP APOP
273 Use POP3 with old-fashioned MD5-challenge authentication.
274 Considered not resistant to man-in-the-middle attacks.
275 .IP RPOP
276 Use POP3 with RPOP authentication.
277 .IP KPOP
278 Use POP3 with Kerberos V4 authentication on port 1109.
279 .IP SDPS
280 Use POP3 with Demon Internet's SDPS extensions.
281 .IP IMAP
282 IMAP2bis, IMAP4, or IMAP4rev1 (\fBfetchmail\fP automatically detects their capabilities).
283 .IP ETRN
284 Use the ESMTP ETRN option.
285 .IP ODMR
286 Use the the On-Demand Mail Relay ESMTP profile.
287 .RE
288 .PP
289 All these alternatives work in basically the same way (communicating
290 with standard server daemons to fetch mail already delivered to a
291 mailbox on the server) except ETRN and ODMR.  The ETRN mode
292 allows you to ask a compliant ESMTP server (such as BSD sendmail at
293 release 8.8.0 or higher) to immediately open a sender-SMTP connection
294 to your client machine and begin forwarding any items addressed to
295 your client machine in the server's queue of undelivered mail.   The
296 ODMR mode requires an ODMR-capable server and works similarly to
297 ETRN, except that it does not require the client machine to have
298 a static DNS.
299 .TP
300 .B \-U | \-\-uidl
301 (Keyword: uidl)
302 .br
303 Force UIDL use (effective only with POP3).  Force client-side tracking
304 of 'newness' of messages (UIDL stands for "unique ID listing" and is
305 described in RFC1939).  Use with 'keep' to use a mailbox as a baby
306 news drop for a group of users. The fact that seen messages are skipped
307 is logged, unless error logging is done through syslog while running in
308 daemon mode.  Note that fetchmail may automatically enable this option
309 depending on upstream server capabilities.  Note also that this option
310 may be removed and forced enabled in a future fetchmail version. See
311 also: \-\-idfile.
312 .TP
313 .B \-\-idle (since 6.3.3)
314 (Keyword: idle, since before 6.0.0)
315 .br
316 Enable IDLE use (effective only with IMAP). Note that this works with
317 only one folder at a given time.  While the idle rcfile keyword had been
318 supported for a long time, the \-\-idle command-line option was added in
319 version 6.3.3. IDLE use means that fetchmail tells the IMAP server to
320 send notice of new messages, so they can be retrieved sooner than would
321 be possible with regular polls.
322 .TP
323 .B \-P <portnumber> | \-\-service <servicename>
324 (Keyword: service) Since version 6.3.0.
325 .br
326 The service option permits you to specify a service name to connect to.
327 You can specify a decimal port number here, if your services database
328 lacks the required service-port assignments. See the FAQ item R12 and
329 the \-\-ssl documentation for details. This replaces the older \-\-port
330 option.
331 .TP
332 .B \-\-port <portnumber>
333 (Keyword: port)
334 .br
335 Obsolete version of \-\-service that does not take service names.
336 \fBNote:\fP this option may be removed from a future version.
337 .TP
338 .B \-\-principal <principal>
339 (Keyword: principal)
340 .br
341 The principal option permits you to specify a service principal for
342 mutual authentication.  This is applicable to POP3 or IMAP with Kerberos
343 4 authentication only.  It does not apply to Kerberos 5 or GSSAPI.  This
344 option may be removed in a future fetchmail version.
345 .TP
346 .B \-t <seconds> | \-\-timeout <seconds>
347 (Keyword: timeout)
348 .br
349 The timeout option allows you to set a server-nonresponse
350 timeout in seconds.  If a mailserver does not send a greeting message
351 or respond to commands for the given number of seconds,
352 \fBfetchmail\fP will drop the connection to it.  Without such a timeout
353 \fBfetchmail\fP might hang until the TCP connection times out, trying to fetch
354 mail from a down host, which may be very long.
355 This would be particularly annoying for a \fBfetchmail\fP running in the
356 background.  There is a default timeout which fetchmail\~\-V will report.  If a
357 given connection receives too many timeouts in succession, fetchmail will
358 consider it wedged and stop retrying.  The calling user will be notified by
359 email if this happens.
360 .IP
361 Beginning with fetchmail 6.3.10, the SMTP client uses the recommended minimum
362 timeouts from RFC-5321 while waiting for the SMTP/LMTP server it is talking to.
363 You can raise the timeouts even more, but you cannot shorten it. This is to
364 avoid a painful situation where fetchmail has been configured with a short
365 timeout (a minute or less), ships a long message (many MBytes) to the local
366 MTA, which then takes longer than timeout to respond "OK", which it eventually
367 will; that would mean the mail gets delivered properly, but fetchmail cannot
368 notice it and will thus refetch this big message over and over again.
369 .TP
370 .B \-\-plugin <command>
371 (Keyword: plugin)
372 .br
373 The plugin option allows you to use an external program to establish the TCP
374 connection.  This is useful if you want to use ssh, or need some special
375 firewalling setup.  The program will be looked up in $PATH and can optionally
376 be passed the hostname and port as arguments using "%h" and "%p" respectively
377 (note that the interpolation logic is rather primitive, and these tokens must
378 be bounded by whitespace or beginning of string or end of string).
379 Fetchmail will write to the plugin's stdin and read from the plugin's
380 stdout.
381 .TP
382 .B \-\-plugout <command>
383 (Keyword: plugout)
384 .br
385 Identical to the plugin option above, but this one is used for the SMTP
386 connections.
387 .TP
388 .B \-r <name> | \-\-folder <name>
389 (Keyword: folder[s])
390 .br
391 Causes a specified non-default mail folder on the mailserver (or
392 comma-separated list of folders) to be retrieved.  The syntax of the
393 folder name is server-dependent.  This option is not available under
394 POP3, ETRN, or ODMR.
395 .TP
396 .B \-\-tracepolls
397 (Keyword: tracepolls)
398 .br
399 Tell fetchmail to poll trace information in the form 'polling 
400 account %s' and 'folder %s' to the Received line it generates,
401 where the %s parts are replaced by the user's remote name, the poll
402 label, and the folder (mailbox) where available (the Received header
403 also normally includes the server's true name).  This can be used to
404 facilitate mail filtering based on the account it is being received
405 from. The folder information is written only since version 6.3.4.
406 .TP
407 .B \-\-ssl
408 (Keyword: ssl)
409 .br
410 Causes the connection to the mail server to be encrypted
411 via SSL.  Connect to the server using the specified base protocol over a
412 connection secured by SSL. This option defeats opportunistic starttls
413 negotiation. It is highly recommended to use \-\-sslproto 'SSL3'
414 \-\-sslcertck to validate the certificates presented by the server and
415 defeat the obsolete SSLv2 negotiation. More information is available in
416 the \fIREADME.SSL\fP file that ships with fetchmail.
417 .IP
418 Note that fetchmail may still try to negotiate SSL through starttls even
419 if this option is omitted. You can use the \-\-sslproto option to defeat
420 this behavior or tell fetchmail to negotiate a particular SSL protocol.
421 .IP
422 If no port is specified, the connection is attempted to the well known
423 port of the SSL version of the base protocol.  This is generally a
424 different port than the port used by the base protocol.  For IMAP, this
425 is port 143 for the clear protocol and port 993 for the SSL secured
426 protocol, for POP3, it is port 110 for the clear text and port 995 for
427 the encrypted variant.
428 .IP
429 If your system lacks the corresponding entries from /etc/services, see
430 the \-\-service option and specify the numeric port number as given in
431 the previous paragraph (unless your ISP had directed you to different
432 ports, which is uncommon however).
433 .TP
434 .B \-\-sslcert <name>
435 (Keyword: sslcert)
436 .br
437 For certificate-based client authentication.  Some SSL encrypted servers
438 require client side keys and certificates for authentication.  In most
439 cases, this is optional.  This specifies the location of the public key
440 certificate to be presented to the server at the time the SSL session is
441 established.  It is not required (but may be provided) if the server
442 does not require it.  It may be the same file as the private key
443 (combined key and certificate file) but this is not recommended. Also
444 see \-\-sslkey below.
445 .sp
446 \fBNOTE:\fP If you use client authentication, the user name is fetched
447 from the certificate's CommonName and overrides the name set with
448 \-\-user.
449 .TP
450 .B \-\-sslkey <name>
451 (Keyword: sslkey)
452 .br
453 Specifies the file name of the client side private SSL key.  Some SSL
454 encrypted servers require client side keys and certificates for
455 authentication.  In most cases, this is optional.  This specifies
456 the location of the private key used to sign transactions with the server
457 at the time the SSL session is established.  It is not required (but may
458 be provided) if the server does not require it. It may be the same file
459 as the public key (combined key and certificate file) but this is not
460 recommended.
461 .IP
462 If a password is required to unlock the key, it will be prompted for at
463 the time just prior to establishing the session to the server.  This can
464 cause some complications in daemon mode.
465 .IP
466 Also see \-\-sslcert above.
467 .TP
468 .B \-\-sslproto <name>
469 (Keyword: sslproto)
470 .br
471 Forces an SSL/TLS protocol. Possible values are \fB''\fP,
472 \&'\fBSSL2\fP', '\fBSSL23\fP', (use of these two values is discouraged
473 and should only be used as a last resort) \&'\fBSSL3\fP', and
474 \&'\fBTLS1\fP'.  The default behaviour if this option is unset is: for
475 connections without \-\-ssl, use \&'\fBTLS1\fP' so that fetchmail will
476 opportunistically try STARTTLS negotiation with TLS1. You can configure
477 this option explicitly if the default handshake (TLS1 if \-\-ssl is not
478 used) does not work for your server.
479 .IP
480 Use this option with '\fBTLS1\fP' value to enforce a STARTTLS
481 connection. In this mode, it is highly recommended to also use
482 \-\-sslcertck (see below).  Note that this will then cause fetchmail
483 v6.3.19 to force STARTTLS negotiation even if it is not advertised by
484 the server.
485 .IP
486 To defeat opportunistic TLSv1 negotiation when the server advertises
487 STARTTLS or STLS, and use a cleartext connection use \fB''\fP.  This
488 option, even if the argument is the empty string, will also suppress the
489 diagnostic 'SERVER: opportunistic upgrade to TLS.' message in verbose
490 mode. The default is to try appropriate protocols depending on context.
491 .TP
492 .B \-\-sslcertck
493 (Keyword: sslcertck)
494 .br
495 Causes fetchmail to strictly check the server certificate against a set of
496 local trusted certificates (see the \fBsslcertfile\fP and \fBsslcertpath\fP
497 options). If the server certificate cannot be obtained or is not signed by one
498 of the trusted ones (directly or indirectly), the SSL connection will fail,
499 regardless of the \fBsslfingerprint\fP option.
500 .IP
501 Note that CRL (certificate revocation lists) are only supported in
502 OpenSSL 0.9.7 and newer! Your system clock should also be reasonably
503 accurate when using this option.
504 .IP
505 Note that this optional behavior may become default behavior in future
506 fetchmail versions.
507 .TP
508 .B \-\-sslcertfile <file>
509 (Keyword: sslcertfile, since v6.3.17)
510 .br
511 Sets the file fetchmail uses to look up local certificates.  The default is
512 empty.  This can be given in addition to \fB\-\-sslcertpath\fP below, and
513 certificates specified in \fB\-\-sslcertfile\fP will be processed before those
514 in \fB\-\-sslcertpath\fP.  The option can be used in addition to
515 \fB\-\-sslcertpath\fP.
516 .IP
517 The file is a text file. It contains the concatenation of trusted CA
518 certificates in PEM format.
519 .IP
520 Note that using this option will suppress loading the default SSL trusted CA
521 certificates file unless you set the environment variable
522 \fBFETCHMAIL_INCLUDE_DEFAULT_X509_CA_CERTS\fP to a non-empty value.
523 .TP
524 .B \-\-sslcertpath <directory>
525 (Keyword: sslcertpath)
526 .br
527 Sets the directory fetchmail uses to look up local certificates. The default is
528 your OpenSSL default directory. The directory must be hashed the way OpenSSL
529 expects it - every time you add or modify a certificate in the directory, you
530 need to use the \fBc_rehash\fP tool (which comes with OpenSSL in the tools/
531 subdirectory). Also, after OpenSSL upgrades, you may need to run
532 \fBc_rehash\fP; particularly when upgrading from 0.9.X to 1.0.0.
533 .IP
534 This can be given in addition to \fB\-\-sslcertfile\fP above, which see for
535 precedence rules.
536 .IP
537 Note that using this option will suppress adding the default SSL trusted CA
538 certificates directory unless you set the environment variable
539 \fBFETCHMAIL_INCLUDE_DEFAULT_X509_CA_CERTS\fP to a non-empty value.
540 .TP
541 .B \-\-sslcommonname <common name>
542 (Keyword: sslcommonname; since v6.3.9)
543 .br
544 Use of this option is discouraged. Before using it, contact the
545 administrator of your upstream server and ask for a proper SSL
546 certificate to be used. If that cannot be attained, this option can be
547 used to specify the name (CommonName) that fetchmail expects on the
548 server certificate.  A correctly configured server will have this set to
549 the hostname by which it is reached, and by default fetchmail will
550 expect as much. Use this option when the CommonName is set to some other
551 value, to avoid the "Server CommonName mismatch" warning, and only if
552 the upstream server can't be made to use proper certificates.
553 .TP
554 .B \-\-sslfingerprint <fingerprint>
555 (Keyword: sslfingerprint)
556 .br
557 Specify the fingerprint of the server key (an MD5 hash of the key) in
558 hexadecimal notation with colons separating groups of two digits. The letter
559 hex digits must be in upper case. This is the default format OpenSSL uses,
560 and the one fetchmail uses to report the fingerprint when an SSL connection
561 is established. When this is specified, fetchmail will compare the server key
562 fingerprint with the given one, and the connection will fail if they do not
563 match regardless of the \fBsslcertck\fP setting. The connection will
564 also fail if fetchmail cannot obtain an SSL certificate from the server.
565 This can be used to prevent man-in-the-middle attacks, but the finger
566 print from the server needs to be obtained or verified over a secure
567 channel, and certainly not over the same Internet connection that
568 fetchmail would use.
569 .IP
570 Using this option will prevent printing certificate verification errors
571 as long as \-\-sslcertck is unset.
572 .IP
573 To obtain the fingerprint of a certificate stored in the file cert.pem,
574 try:
575 .sp
576 .nf
577         openssl x509 \-in cert.pem \-noout \-md5 \-fingerprint
578 .fi
579 .sp
580 For details, see
581 .BR x509 (1ssl).
582 .SS Delivery Control Options
583 .TP
584 .B \-S <hosts> | \-\-smtphost <hosts>
585 (Keyword: smtp[host])
586 .br
587 Specify a hunt list of hosts to forward mail to (one or more
588 hostnames, comma-separated). Hosts are tried in list order; the first
589 one that is up becomes the forwarding target for the current run.  If
590 this option is not specified, 'localhost' is used as the default.
591 Each hostname may have a port number following the host name.  The
592 port number is separated from the host name by a slash; the default
593 port is "smtp".  If you specify an absolute path name (beginning with
594 a /), it will be interpreted as the name of a UNIX socket accepting
595 LMTP connections (such as is supported by the Cyrus IMAP daemon)
596 Example:
597 .sp
598 .nf
599         \-\-smtphost server1,server2/2525,server3,/var/imap/socket/lmtp
600 .fi
601 .sp
602 This option can be used with ODMR, and will make fetchmail a relay
603 between the ODMR server and SMTP or LMTP receiver.
604 .TP
605 .B \-\-fetchdomains <hosts>
606 (Keyword: fetchdomains)
607 .br
608 In ETRN or ODMR mode, this option specifies the list of domains the
609 server should ship mail for once the connection is turned around.  The
610 default is the FQDN of the machine running \fBfetchmail\fP.
611 .TP
612 .B \-D <domain> | \-\-smtpaddress <domain>
613 (Keyword: smtpaddress)
614 .br
615 Specify the domain to be appended to addresses
616 in RCPT TO lines shipped to SMTP. When this is not specified, the name
617 of the SMTP server (as specified by \-\-smtphost) is used for SMTP/LMTP
618 and 'localhost' is used for UNIX socket/BSMTP.
619 .TP
620 .B \-\-smtpname <user@domain>
621 (Keyword: smtpname)
622 .br
623 Specify the domain and user to be put in RCPT TO lines shipped to SMTP.
624 The default user is the current local user.
625 .TP
626 .B \-Z <nnn> | \-\-antispam <nnn[, nnn]...>
627 (Keyword: antispam)
628 .br
629 Specifies the list of numeric SMTP errors that are to be interpreted
630 as a spam-block response from the listener.  A value of \-1 disables
631 this option.  For the command-line option, the list values should
632 be comma-separated.
633 .TP
634 .B \-m <command> | \-\-mda <command>
635 (Keyword: mda)
636 .br
637 This option lets \fBfetchmail\fP use a Message or Local Delivery Agent
638 (MDA or LDA) directly, rather than forward via SMTP or LMTP.
639
640 To avoid losing mail, use this option only with MDAs like maildrop or
641 MTAs like sendmail that exit with a nonzero status on disk-full and other
642 delivery errors; the nonzero status tells fetchmail that delivery failed
643 and prevents the message from being deleted on the server.
644
645 If \fBfetchmail\fP is running as root, it sets its user id while
646 delivering mail through an MDA as follows:  First, the FETCHMAILUSER,
647 LOGNAME, and USER environment variables are checked in this order. The
648 value of the first variable from his list that is defined (even if it is
649 empty!) is looked up in the system user database. If none of the
650 variables is defined, fetchmail will use the real user id it was started
651 with. If one of the variables was defined, but the user stated there
652 isn't found, fetchmail continues running as root, without checking
653 remaining variables on the list.  Practically, this means that if you
654 run fetchmail as root (not recommended), it is most useful to define the
655 FETCHMAILUSER environment variable to set the user that the MDA should
656 run as. Some MDAs (such as maildrop) are designed to be setuid root and
657 setuid to the recipient's user id, so you don't lose functionality this
658 way even when running fetchmail as unprivileged user.  Check the MDA's
659 manual for details.
660
661 Some possible MDAs are "/usr/sbin/sendmail \-i \-f %F \-\- %T"
662 (\fBNote:\fP
663 some several older or vendor sendmail versions mistake \-\- for an
664 address, rather than an indicator to mark the end of the option arguments),
665 "/usr/bin/deliver" and "/usr/bin/maildrop \-d %T".  Local delivery
666 addresses will be inserted into the MDA command wherever you place a
667 %T; the mail message's From address will be inserted where you place
668 an %F.
669
670 \fBDo NOT enclose the %F or %T string in single quotes!\fP
671 For both %T and %F, fetchmail encloses the addresses in single quotes 
672 ('), after removing any single quotes they may contain, before the MDA 
673 command is passed to the shell.
674
675 \fBDo NOT use an MDA invocation that dispatches on the contents of 
676 To/Cc/Bcc,\fP like "sendmail \-i \-t" or "qmail-inject", it will create 
677 mail loops and bring the just wrath of many postmasters down upon your 
678 head.  This is one of the most frequent configuration errors!
679
680 Also, do \fInot\fP try to combine multidrop mode with an MDA such 
681 as maildrop that can only accept one address, unless your upstream 
682 stores one copy of the message per recipient and transports the envelope 
683 recipient in a header; you will lose mail.
684
685 The well-known
686 .BR procmail (1)
687 package is very hard to configure properly, it has a very nasty "fall
688 through to the next rule" behavior on delivery errors (even temporary
689 ones, such as out of disk space if another user's mail daemon copies the
690 mailbox around to purge old messages), so your mail will end up in the
691 wrong mailbox sooner or later. The proper procmail configuration is
692 outside the scope of this document. Using
693 .BR maildrop (1)
694 is usually much easier, and many users find the filter syntax used by
695 maildrop easier to understand.
696
697 Finally, we strongly advise that you do \fBnot\fP use qmail-inject.  The
698 command line interface is non-standard without providing benefits for
699 typical use, and fetchmail makes no attempts to accommodate
700 qmail-inject's deviations from the standard. Some of qmail-inject's
701 command-line and environment options are actually dangerous and can
702 cause broken threads, non-detected duplicate messages and forwarding
703 loops.
704
705 .TP
706 .B \-\-lmtp
707 (Keyword: lmtp)
708 .br
709 Cause delivery via LMTP (Local Mail Transfer Protocol).  A service
710 host and port \fBmust\fP be explicitly specified on each host in the
711 smtphost hunt list (see above) if this option is selected; the default
712 port 25 will (in accordance with RFC 2033) not be accepted.
713 .TP
714 .B \-\-bsmtp <filename>
715 (Keyword: bsmtp)
716 .br
717 Append fetched mail to a BSMTP file.  This simply contains the SMTP
718 commands that would normally be generated by fetchmail when passing
719 mail to an SMTP listener daemon.
720
721 An argument of '\-' causes the SMTP batch to be written to standard
722 output, which is of limited use: this only makes sense for debugging,
723 because fetchmail's regular output is interspersed on the same channel,
724 so this isn't suitable for mail delivery. This special mode may be
725 removed in a later release.
726
727 Note that fetchmail's reconstruction of MAIL FROM and RCPT TO lines is
728 not guaranteed correct; the caveats discussed under THE USE AND ABUSE OF
729 MULTIDROP MAILBOXES below apply.  This mode has precedence before
730 \-\-mda and SMTP/LMTP.
731 .TP
732 .B \-\-bad\-header {reject|accept}
733 (Keyword: bad\-header; since v6.3.15)
734 .br
735 Specify how fetchmail is supposed to treat messages with bad headers,
736 i. e. headers with bad syntax. Traditionally, fetchmail has rejected such
737 messages, but some distributors modified fetchmail to accept them. You can now
738 configure fetchmail's behaviour per server.
739
740 .SS Resource Limit Control Options
741 .TP
742 .B \-l <maxbytes> | \-\-limit <maxbytes>
743 (Keyword: limit)
744 .br
745 Takes a maximum octet size argument, where 0 is the
746 default and also the special value designating "no limit".
747 If nonzero, messages larger than this size will not be fetched and will
748 be left on the server (in foreground sessions, the progress messages
749 will note that they are "oversized").  If the fetch protocol permits (in
750 particular, under IMAP or POP3 without the fetchall option) the message
751 will not be marked seen.
752 .sp
753 An explicit \-\-limit of 0 overrides any limits set in your
754 run control file. This option is intended for those needing to
755 strictly control fetch time due to expensive and variable phone rates.
756 .sp
757 Combined with \-\-limitflush, it can be used to delete oversized
758 messages waiting on a server.  In daemon mode, oversize notifications
759 are mailed to the calling user (see the \-\-warnings option). This
760 option does not work with ETRN or ODMR.
761 .TP
762 .B \-w <interval> | \-\-warnings <interval>
763 (Keyword: warnings)
764 .br
765 Takes an interval in seconds.  When you call \fBfetchmail\fP
766 with a 'limit' option in daemon mode, this controls the interval at
767 which warnings about oversized messages are mailed to the calling user
768 (or the user specified by the 'postmaster' option).  One such
769 notification is always mailed at the end of the the first poll that
770 the oversized message is detected.  Thereafter, re-notification is
771 suppressed until after the warning interval elapses (it will take
772 place at the end of the first following poll).
773 .TP
774 .B \-b <count> | \-\-batchlimit <count>
775 (Keyword: batchlimit)
776 .br
777 Specify the maximum number of messages that will be shipped to an SMTP
778 listener before the connection is deliberately torn down and rebuilt
779 (defaults to 0, meaning no limit).  An explicit \-\-batchlimit of 0
780 overrides any limits set in your run control file.  While
781 \fBsendmail\fP(8) normally initiates delivery of a message immediately
782 after receiving the message terminator, some SMTP listeners are not so
783 prompt.  MTAs like \fBsmail\fP(8) may wait till the
784 delivery socket is shut down to deliver.  This may produce annoying
785 delays when \fBfetchmail\fP is processing very large batches.  Setting
786 the batch limit to some nonzero size will prevent these delays.  This
787 option does not work with ETRN or ODMR.
788 .TP
789 .B \-B <number> | \-\-fetchlimit <number>
790 (Keyword: fetchlimit)
791 .br
792 Limit the number of messages accepted from a given server in a single
793 poll.  By default there is no limit. An explicit \-\-fetchlimit of 0
794 overrides any limits set in your run control file.
795 This option does not work with ETRN or ODMR.
796 .TP
797 .B \-\-fetchsizelimit <number>
798 (Keyword: fetchsizelimit)
799 .br
800 Limit the number of sizes of messages accepted from a given server in
801 a single transaction.  This option is useful in reducing the delay in
802 downloading the first mail when there are too many mails in the
803 mailbox.  By default, the limit is 100.  If set to 0, sizes of all
804 messages are downloaded at the start.
805 This option does not work with ETRN or ODMR.  For POP3, the only valid
806 non-zero value is 1.
807 .TP
808 .B \-\-fastuidl <number>
809 (Keyword: fastuidl)
810 .br
811 Do a binary instead of linear search for the first unseen UID. Binary
812 search avoids downloading the UIDs of all mails. This saves time
813 (especially in daemon mode) where downloading the same set of UIDs in
814 each poll is a waste of bandwidth. The number 'n' indicates how rarely
815 a linear search should be done. In daemon mode, linear search is used
816 once followed by binary searches in 'n-1' polls if 'n' is greater than
817 1; binary search is always used if 'n' is 1; linear search is always
818 used if 'n' is 0. In non-daemon mode, binary search is used if 'n' is
819 1; otherwise linear search is used. The default value of 'n' is 4.
820 This option works with POP3 only.
821 .TP
822 .B \-e <count> | \-\-expunge <count>
823 (Keyword: expunge)
824 .br
825 Arrange for deletions to be made final after a given number of
826 messages.  Under POP3, fetchmail cannot make deletions final
827 without sending QUIT and ending the session -- with this option on,
828 fetchmail will break a long mail retrieval session into multiple
829 sub-sessions, sending QUIT after each sub-session. This is a good
830 defense against line drops on POP3 servers.  Under IMAP,
831 \fBfetchmail\fP normally issues an EXPUNGE command after each deletion
832 in order to force the deletion to be done immediately.  This is safest
833 when your connection to the server is flaky and expensive, as it avoids
834 resending duplicate mail after a line hit.  However, on large
835 mailboxes the overhead of re-indexing after every message can slam the
836 server pretty hard, so if your connection is reliable it is good to do
837 expunges less frequently.  Also note that some servers enforce a delay
838 of a few seconds after each quit, so fetchmail may not be able to get
839 back in immediately after an expunge -- you may see "lock busy" errors
840 if this happens. If you specify this option to an integer N,
841 it tells \fBfetchmail\fP to only issue expunges on every Nth delete.  An
842 argument of zero suppresses expunges entirely (so no expunges at all
843 will be done until the end of run).  This option does not work with ETRN
844 or ODMR.
845
846 .SS Authentication Options
847 .TP
848 .B \-u <name> | \-\-user <name> | \-\-username <name>
849 (Keyword: user[name])
850 .br
851 Specifies the user identification to be used when logging in to the mailserver.
852 The appropriate user identification is both server and user-dependent.
853 The default is your login name on the client machine that is running
854 \fBfetchmail\fP.
855 See USER AUTHENTICATION below for a complete description.
856 .TP
857 .B \-I <specification> | \-\-interface <specification>
858 (Keyword: interface)
859 .br
860 Require that a specific interface device be up and have a specific local
861 or remote IPv4 (IPv6 is not supported by this option yet) address (or
862 range) before polling.  Frequently \fBfetchmail\fP
863 is used over a transient point-to-point TCP/IP link established directly
864 to a mailserver via SLIP or PPP.  That is a relatively secure channel.
865 But when other TCP/IP routes to the mailserver exist (e.g. when the link
866 is connected to an alternate ISP), your username and password may be
867 vulnerable to snooping (especially when daemon mode automatically polls
868 for mail, shipping a clear password over the net at predictable
869 intervals).  The \-\-interface option may be used to prevent this.  When
870 the specified link is not up or is not connected to a matching IP
871 address, polling will be skipped.  The format is:
872 .sp
873 .nf
874         interface/iii.iii.iii.iii[/mmm.mmm.mmm.mmm]
875 .fi
876 .sp
877 The field before the first slash is the interface name (i.e. sl0, ppp0
878 etc.).  The field before the second slash is the acceptable IP address.
879 The field after the second slash is a mask which specifies a range of
880 IP addresses to accept.  If no mask is present 255.255.255.255 is
881 assumed (i.e. an exact match).  This option is currently only supported
882 under Linux and FreeBSD. Please see the \fBmonitor\fP section for below
883 for FreeBSD specific information.
884 .sp
885 Note that this option may be removed from a future fetchmail version.
886 .TP
887 .B \-M <interface> | \-\-monitor <interface>
888 (Keyword: monitor)
889 .br
890 Daemon mode can cause transient links which are automatically taken down
891 after a period of inactivity (e.g. PPP links) to remain up
892 indefinitely.  This option identifies a system TCP/IP interface to be
893 monitored for activity.  After each poll interval, if the link is up but
894 no other activity has occurred on the link, then the poll will be
895 skipped.  However, when fetchmail is woken up by a signal, the
896 monitor check is skipped and the poll goes through unconditionally.
897 This option is currently only supported under Linux and FreeBSD.
898 For the \fBmonitor\fP and \fBinterface\fP options to work for non root
899 users under FreeBSD, the fetchmail binary must be installed SGID kmem.
900 This would be a security hole, but fetchmail runs with the effective GID
901 set to that of the kmem group \fIonly\fP when interface data is being
902 collected.
903 .sp
904 Note that this option may be removed from a future fetchmail version.
905 .TP
906 .B \-\-auth <type>
907 (Keyword: auth[enticate])
908 .br
909 This option permits you to specify an authentication type (see USER
910 AUTHENTICATION below for details).  The possible values are \fBany\fP,
911 \&\fBpassword\fP, \fBkerberos_v5\fP, \fBkerberos\fP (or, for
912 excruciating exactness, \fBkerberos_v4\fP), \fBgssapi\fP,
913 \fBcram\-md5\fP, \fBotp\fP, \fBntlm\fP, \fBmsn\fP (only for POP3),
914 \fBexternal\fP (only IMAP) and \fBssh\fP.
915 When \fBany\fP (the default) is specified, fetchmail tries
916 first methods that don't require a password (EXTERNAL, GSSAPI, KERBEROS\ IV,
917 KERBEROS\ 5); then it looks for methods that mask your password
918 (CRAM-MD5, NTLM, X\-OTP - note that MSN is only supported for POP3, but not
919 autoprobed); and only if the server doesn't
920 support any of those will it ship your password en clair.  Other values
921 may be used to force various authentication methods
922 (\fBssh\fP suppresses authentication and is thus useful for IMAP PREAUTH).
923 (\fBexternal\fP suppresses authentication and is thus useful for IMAP EXTERNAL).
924 Any value other than \fBpassword\fP, \fBcram\-md5\fP, \fBntlm\fP,
925 \&\fBmsn\fP or \fBotp\fP suppresses fetchmail's normal inquiry for a
926 password.  Specify \fBssh\fP when you are using an end-to-end secure
927 connection such as an ssh tunnel; specify \fBexternal\fP when you use
928 TLS with client authentication and specify \fBgssapi\fP or
929 \&\fBkerberos_v4\fP if you are using a protocol variant that employs
930 GSSAPI or K4.  Choosing KPOP protocol automatically selects Kerberos
931 authentication.  This option does not work with ETRN.  GSSAPI service names are
932 in line with RFC-2743 and IANA registrations, see
933 .URL http://www.iana.org/assignments/gssapi-service-names/ "Generic Security Service Application Program Interface (GSSAPI)/Kerberos/Simple Authentication and Security Layer (SASL) Service Names" . 
934 .SS Miscellaneous Options
935 .TP
936 .B \-f <pathname> | \-\-fetchmailrc <pathname>
937 Specify a non-default name for the \fI~/.fetchmailrc\fP
938 run control file.  The pathname argument must be either "-" (a single
939 dash, meaning to read the configuration from standard input) or a
940 filename.  Unless the \-\-version option is also on, a named file
941 argument must have permissions no more open than 0700 (u=rwx,g=,o=) or
942 else be /dev/null.
943 .TP
944 .B \-i <pathname> | \-\-idfile <pathname>
945 (Keyword: idfile)
946 .br
947 Specify an alternate name for the .fetchids file used to save message
948 UIDs. NOTE: since fetchmail 6.3.0, write access to the directory
949 containing the idfile is required, as fetchmail writes a temporary file
950 and renames it into the place of the real idfile only if the temporary
951 file has been written successfully. This avoids the truncation of
952 idfiles when running out of disk space.
953 .TP
954 .B \--pidfile <pathname>
955 (Keyword: pidfile; since fetchmail v6.3.4)
956 .br
957 Override the default location of the PID file. Default: see
958 "ENVIRONMENT" below.
959 .TP
960 .B \-n | \-\-norewrite
961 (Keyword: no rewrite)
962 .br
963 Normally, \fBfetchmail\fP edits RFC-822 address headers (To, From, Cc,
964 Bcc, and Reply\-To) in fetched mail so that any mail IDs local to the
965 server are expanded to full addresses (@ and the mailserver hostname are
966 appended).  This enables replies on the client to get addressed
967 correctly (otherwise your mailer might think they should be addressed to
968 local users on the client machine!).  This option disables the rewrite.
969 (This option is provided to pacify people who are paranoid about having
970 an MTA edit mail headers and want to know they can prevent it, but it is
971 generally not a good idea to actually turn off rewrite.)
972 When using ETRN or ODMR, the rewrite option is ineffective.
973 .TP
974 .B \-E <line> | \-\-envelope <line>
975 (Keyword: envelope; Multidrop only)
976 .br
977 In the configuration file, an enhanced syntax is used:
978 .br
979 \fBenvelope [<count>] <line>\fP
980 .sp
981 This option changes the header \fBfetchmail\fP assumes will carry a copy
982 of the mail's envelope address.  Normally this is 'X\-Envelope\-To'.
983 Other typically found headers to carry envelope information are
984 \&'X\-Original\-To' and 'Delivered\-To'.  Now, since these headers are
985 not standardized, practice varies. See the discussion of multidrop
986 address handling below.  As a special case, 'envelope "Received"'
987 enables parsing of sendmail-style Received lines.  This is the default,
988 but discouraged because it is not fully reliable.
989
990 Note that fetchmail expects the Received-line to be in a specific
991 format: It must contain "by \fIhost\fP for \fIaddress\fP", where
992 \fIhost\fP must match one of the mailserver names that fetchmail
993 recognizes for the account in question.
994 .sp
995 The optional count argument (only available in the configuration file)
996 determines how many header lines of this kind are skipped. A count of 1
997 means: skip the first, take the second. A count of 2 means: skip the
998 first and second, take the third, and so on.
999 .TP
1000 .B \-Q <prefix> | \-\-qvirtual <prefix>
1001 (Keyword: qvirtual; Multidrop only)
1002 .br
1003 The string prefix assigned to this option will be removed from the user
1004 name found in the header specified with the \fIenvelope\fP option
1005 (\fIbefore\fP doing multidrop name mapping or localdomain checking,
1006 if either is applicable). This option is useful if you are using
1007 \fBfetchmail\fP to collect the mail for an entire domain and your ISP
1008 (or your mail redirection provider) is using qmail.
1009 One of the basic features of qmail is the \fIDelivered\-To:\fP
1010 message header.  Whenever qmail delivers a message to a local mailbox
1011 it puts the username and hostname of the envelope recipient on this
1012 line.  The major reason for this is to prevent mail loops.  To set up
1013 qmail to batch mail for a disconnected site the ISP-mailhost will have
1014 normally put that site in its 'Virtualhosts' control file so it will
1015 add a prefix to all mail addresses for this site. This results in mail
1016 .\" The \&@\& tries to stop HTML converters from making a mailto URL here.
1017 sent to 'username\&@\&userhost.userdom.dom.com' having a
1018 \fIDelivered\-To:\fR line of the form:
1019 .IP
1020 Delivered\-To: mbox\-userstr\-username\&@\&userhost.example.com
1021 .PP
1022 The ISP can make the 'mbox\-userstr\-' prefix anything they choose
1023 but a string matching the user host name is likely.
1024 By using the option 'envelope Delivered\-To:' you can make fetchmail reliably
1025 identify the original envelope recipient, but you have to strip the
1026 \&'mbox\-userstr\-' prefix to deliver to the correct user.
1027 This is what this option is for.
1028 .TP
1029 .B \-\-configdump
1030 Parse the \fI~/.fetchmailrc\fP file, interpret any command-line options
1031 specified, and dump a configuration report to standard output.  The
1032 configuration report is a data structure assignment in the language
1033 Python.  This option is meant to be used with an interactive
1034 \fI~/.fetchmailrc\fP editor like \fBfetchmailconf\fP, written in Python.
1035
1036 .SS Removed Options
1037 .TP
1038 .B \-T | \-\-netsec
1039 Removed before version 6.3.0, the required underlying inet6_apps library
1040 had been discontinued and is no longer available.
1041
1042 .SH USER AUTHENTICATION AND ENCRYPTION
1043 All modes except ETRN require authentication of the client to the server.
1044 Normal user authentication in \fBfetchmail\fP is very much like the
1045 authentication mechanism of
1046 .BR ftp (1).
1047 The correct user-id and password depend upon the underlying security
1048 system at the mailserver.
1049 .PP
1050 If the mailserver is a Unix machine on which you have an ordinary user
1051 account, your regular login name and password are used with
1052 .BR fetchmail .
1053 If you use the same login name on both the server and the client machines,
1054 you needn't worry about specifying a user-id with the
1055 .B \-u
1056 option -- the default behavior is to use your login name on the
1057 client machine as the user-id on the server machine.  If you use a
1058 different login name on the server machine, specify that login name
1059 with the
1060 .B \-u
1061 option.  e.g. if your login name is 'jsmith' on a machine named 'mailgrunt',
1062 you would start \fBfetchmail\fP as follows:
1063 .IP
1064 fetchmail \-u jsmith mailgrunt
1065 .PP
1066 The default behavior of \fBfetchmail\fP is to prompt you for your
1067 mailserver password before the connection is established.  This is the
1068 safest way to use \fBfetchmail\fP and ensures that your password will
1069 not be compromised.  You may also specify your password in your
1070 \fI~/.fetchmailrc\fP file.  This is convenient when using
1071 \fBfetchmail\fP in daemon mode or with scripts.
1072
1073 .SS Using netrc files
1074 .PP
1075 If you do not specify a password, and \fBfetchmail\fP cannot extract one
1076 from your \fI~/.fetchmailrc\fP file, it will look for a \fI~/.netrc\fP
1077 file in your home directory before requesting one interactively; if an
1078 entry matching the mailserver is found in that file, the password will
1079 be used.  Fetchmail first looks for a match on poll name; if it finds none,
1080 it checks for a match on via name.  See the
1081 .BR ftp (1)
1082 man page for details of the syntax of the \fI~/.netrc\fP
1083 file.  To show a practical example, a .netrc might look like
1084 this:
1085 .IP
1086 .nf
1087 machine hermes.example.org
1088 login joe
1089 password topsecret
1090 .fi
1091 .PP
1092 You can repeat this block with different user information if you need to
1093 provide more than one password.
1094 .PP
1095 This feature may allow you to avoid duplicating password
1096 information in more than one file.
1097 .PP
1098 On mailservers that do not provide ordinary user accounts, your user-id and
1099 password are usually assigned by the server administrator when you apply for
1100 a mailbox on the server.  Contact your server administrator if you don't know
1101 the correct user-id and password for your mailbox account.
1102 .SH POP3 VARIANTS
1103 .PP
1104 Early versions of POP3 (RFC1081, RFC1225) supported a crude form of
1105 independent authentication using the \fI.rhosts\fP file on the
1106 mailserver side.  Under this RPOP variant, a fixed per-user ID
1107 equivalent to a password was sent in clear over a link to a reserved
1108 port, with the command RPOP rather than PASS to alert the server that it
1109 should do special checking.  RPOP is supported by \fBfetchmail\fP
1110 (you can specify 'protocol RPOP' to have the program send 'RPOP'
1111 rather than 'PASS') but its use is strongly discouraged, and support
1112 will be removed from a future fetchmail version.  This
1113 facility was vulnerable to spoofing and was withdrawn in RFC1460.
1114 .PP
1115 RFC1460 introduced APOP authentication.  In this variant of POP3,
1116 you register an APOP password on your server host (on some servers, the
1117 program to do this is called \fBpopauth\fP(8)).  You put the same
1118 password in your \fI~/.fetchmailrc\fP file.  Each time \fBfetchmail\fP
1119 logs in, it sends an MD5 hash of your password and the server greeting
1120 time to the server, which can verify it by checking its authorization
1121 database.
1122
1123 \fBNote that APOP is no longer considered resistant against
1124 man-in-the-middle attacks.\fP
1125 .SS RETR or TOP
1126 \fBfetchmail\fP makes some efforts to make the server believe messages
1127 had not been retrieved, by using the TOP command with a large number of
1128 lines when possible.  TOP is a command that retrieves the full header
1129 and a \fBfetchmail\fP-specified amount of body lines. It is optional and
1130 therefore not implemented by all servers, and some are known to
1131 implement it improperly. On many servers however, the RETR command which
1132 retrieves the full message with header and body, sets the "seen" flag
1133 (for instance, in a web interface), whereas the TOP command does not do
1134 that.
1135 .PP
1136 \fBfetchmail\fP will always use the RETR command if "fetchall" is set.
1137 \fBfetchmail\fP will also use the RETR command if "keep" is set and
1138 "uidl" is unset.  Finally, \fBfetchmail\fP will use the RETR command on
1139 Maillennium POP3/PROXY servers (used by Comcast) to avoid a deliberate
1140 TOP misinterpretation in this server that causes message corruption.
1141 .PP
1142 In all other cases, \fBfetchmail\fP will use the TOP command. This
1143 implies that in "keep" setups, "uidl" must be set if "TOP" is desired.
1144 .PP
1145 \fBNote\fP that this description is true for the current version of
1146 fetchmail, but the behavior may change in future versions. In
1147 particular, fetchmail may prefer the RETR command because the TOP
1148 command causes much grief on some servers and is only optional.
1149 .SH ALTERNATE AUTHENTICATION FORMS
1150 .PP
1151 If your \fBfetchmail\fP was built with Kerberos support and you specify
1152 Kerberos authentication (either with \-\-auth or the \fI.fetchmailrc\fP
1153 option \fBauthenticate kerberos_v4\fP) it will try to get a Kerberos
1154 ticket from the mailserver at the start of each query.  Note: if
1155 either the pollname or via name is 'hesiod', fetchmail will try to use
1156 Hesiod to look up the mailserver.
1157 .PP
1158 If you use POP3 or IMAP with GSSAPI authentication, \fBfetchmail\fP will
1159 expect the server to have RFC1731- or RFC1734-conforming GSSAPI
1160 capability, and will use it.  Currently this has only been tested over
1161 Kerberos V, so you're expected to already have a ticket-granting
1162 ticket. You may pass a username different from your principal name
1163 using the standard \fB\-\-user\fP command or by the \fI.fetchmailrc\fP
1164 option \fBuser\fP.
1165 .PP
1166 If your IMAP daemon returns the PREAUTH response in its greeting line,
1167 fetchmail will notice this and skip the normal authentication step.
1168 This can be useful, e.g. if you start imapd explicitly using ssh.
1169 In this case you can declare the authentication value 'ssh' on that
1170 site entry to stop \fI.fetchmail\fP from asking you for a password
1171 when it starts up.
1172 .PP
1173 If you use client authentication with \fITLS1\fP and your IMAP daemon
1174 returns the \fIAUTH=EXTERNAL\fP response, fetchmail will notice this
1175 and will use the authentication shortcut and will not send the
1176 passphrase. In this case you can declare the authentication value 'external'
1177  on that site to stop \fBfetchmail\fP from asking you for a password
1178 when it starts up.
1179 .PP
1180 If you are using POP3, and the server issues a one-time-password
1181 challenge conforming to RFC1938, \fBfetchmail\fP will use your
1182 password as a pass phrase to generate the required response. This
1183 avoids sending secrets over the net unencrypted.
1184 .PP
1185 Compuserve's RPA authentication is supported. If you
1186 compile in the support, \fBfetchmail\fP will try to perform an RPA pass-phrase
1187 authentication instead of sending over the password en clair if it
1188 detects "@compuserve.com" in the hostname.
1189 .PP
1190 If you are using IMAP, Microsoft's NTLM authentication (used by Microsoft
1191 Exchange) is supported. If you compile in the support, \fBfetchmail\fP
1192 will try to perform an NTLM authentication (instead of sending over the
1193 password en clair) whenever the server returns AUTH=NTLM in its
1194 capability response. Specify a user option value that looks like
1195 \&'user@domain': the part to the left of the @ will be passed as the
1196 username and the part to the right as the NTLM domain.
1197
1198 .SS Secure Socket Layers (SSL) and Transport Layer Security (TLS)
1199 .PP
1200 Note that fetchmail currently uses the OpenSSL library, which is
1201 severely underdocumented, so failures may occur just because the
1202 programmers are not aware of OpenSSL's requirement of the day.
1203 For instance, since v6.3.16, fetchmail calls
1204 OpenSSL_add_all_algorithms(), which is necessary to support certificates
1205 with SHA256 on OpenSSL 0.9.8 -- this information is deeply hidden in the
1206 documentation and not at all obvious.  Please do not hesitate to report
1207 subtle SSL failures.
1208 .PP
1209 You can access SSL encrypted services by specifying the \-\-ssl option.
1210 You can also do this using the "ssl" user option in the .fetchmailrc
1211 file. With SSL encryption enabled, queries are initiated over a
1212 connection after negotiating an SSL session, and the connection fails if
1213 SSL cannot be negotiated.  Some services, such as POP3 and IMAP, have
1214 different well known ports defined for the SSL encrypted services.  The
1215 encrypted ports will be selected automatically when SSL is enabled and
1216 no explicit port is specified. The \-\-sslproto 'SSL3' option should be
1217 used to select the SSLv3 protocol (default if unset: v2 or v3).  Also,
1218 the \-\-sslcertck command line or sslcertck run control file option
1219 should be used to force strict certificate checking - see below.
1220 .PP
1221 If SSL is not configured, fetchmail will usually opportunistically try to use
1222 STARTTLS. STARTTLS can be enforced by using \-\-sslproto "TLS1". TLS
1223 connections use the same port as the unencrypted version of the
1224 protocol and negotiate TLS via special command. The \-\-sslcertck
1225 command line or sslcertck run control file option should be used to
1226 force strict certificate checking - see below.
1227 .PP
1228 .B \-\-sslcertck is recommended:
1229 When connecting to an SSL or TLS encrypted server, the
1230 server presents a certificate to the client for validation.  The
1231 certificate is checked to verify that the common name in the certificate
1232 matches the name of the server being contacted and that the effective
1233 and expiration dates in the certificate indicate that it is currently
1234 valid.  If any of these checks fail, a warning message is printed, but
1235 the connection continues.  The server certificate does not need to be
1236 signed by any specific Certifying Authority and may be a "self-signed"
1237 certificate. If the \-\-sslcertck command line option or sslcertck run
1238 control file option is used, fetchmail will instead abort if any of
1239 these checks fail, because it must assume that there is a
1240 man-in-the-middle attack in this scenario, hence fetchmail must not
1241 expose cleartext passwords. Use of the sslcertck or \-\-sslcertck option
1242 is therefore advised.
1243 .PP
1244 Some SSL encrypted servers may request a client side certificate.  A client
1245 side public SSL certificate and private SSL key may be specified.  If
1246 requested by the server, the client certificate is sent to the server for
1247 validation.  Some servers may require a valid client certificate and may
1248 refuse connections if a certificate is not provided or if the certificate
1249 is not valid.  Some servers may require client side certificates be signed
1250 by a recognized Certifying Authority.  The format for the key files and
1251 the certificate files is that required by the underlying SSL libraries
1252 (OpenSSL in the general case).
1253 .PP
1254 A word of care about the use of SSL: While above mentioned
1255 setup with self-signed server certificates retrieved over the wires
1256 can protect you from a passive eavesdropper, it doesn't help against an
1257 active attacker. It's clearly an improvement over sending the
1258 passwords in clear, but you should be aware that a man-in-the-middle
1259 attack is trivially possible (in particular with tools such as
1260 .URL "http://monkey.org/~dugsong/dsniff/" "dsniff" ,
1261 ).  Use of strict certificate checking with a certification authority
1262 recognized by server and client, or perhaps of an SSH tunnel (see below
1263 for some examples) is preferable if you care seriously about the
1264 security of your mailbox and passwords.
1265
1266 .SS ESMTP AUTH
1267 .PP
1268 \fBfetchmail\fP also supports authentication to the ESMTP server on the
1269 client side according to RFC 2554.  You can specify a name/password pair
1270 to be used with the keywords 'esmtpname' and 'esmtppassword'; the former
1271 defaults to the username of the calling user.
1272
1273 .SH DAEMON MODE
1274 .SS Introducing the daemon mode
1275 In daemon mode, \fBfetchmail\fP puts itself into the background and runs
1276 forever, querying each specified host and then sleeping for a given
1277 polling interval.
1278 .SS Starting the daemon mode
1279 There are several ways to make fetchmail work in daemon mode. On the
1280 command line, \fB\-\-daemon\ <interval>\fP or \fB\-d\ <interval>\fP
1281 option runs \fBfetchmail\fP in daemon mode.  You must specify a numeric
1282 argument which is a polling interval (time to wait after completing a 
1283 whole poll cycle with the last server and before starting the next poll 
1284 cycle with the first server) in seconds.
1285 .PP
1286 Example: simply invoking
1287 .IP
1288 fetchmail \-d 900
1289 .PP
1290 will, therefore, poll all the hosts described in your \fI~/.fetchmailrc\fP
1291 file (except those explicitly excluded with the 'skip' verb) a bit less 
1292 often than once every 15 minutes (exactly: 15 minutes + time that the 
1293 poll takes).
1294 .PP
1295 It is also possible to set a polling interval
1296 in your \fI~/.fetchmailrc\fP file by saying 'set\ daemon\ <interval>',
1297 where <interval> is an integer number of seconds.  If you do this,
1298 fetchmail will always start in daemon mode unless you override it with
1299 the command-line option \-\-daemon 0 or \-d0.
1300 .PP
1301 Only one daemon process is permitted per user; in daemon mode,
1302 \fBfetchmail\fP sets up a per-user lockfile to guarantee this.
1303 (You can however cheat and set the FETCHMAILHOME environment variable to
1304 overcome this setting, but in that case, it is your responsibility to
1305 make sure you aren't polling the same server with two processes at the
1306 same time.)
1307 .SS Awakening the background daemon
1308 .PP
1309 Normally, calling fetchmail with a daemon in the background sends a
1310 wake-up signal to the daemon and quits without output. The background
1311 daemon then starts its next poll cycle immediately.  The wake-up signal,
1312 SIGUSR1, can also be sent manually. The wake-up action also clears any
1313 \&'wedged' flags indicating that connections have wedged due to failed
1314 authentication or multiple timeouts.
1315 .SS Terminating the background daemon
1316 .PP
1317 The option
1318 .B \-\-quit
1319 will kill a running daemon process instead of waking it up (if there
1320 is no such process, \fBfetchmail\fP will notify you).
1321 If the \-\-quit option appears last on the command line, \fBfetchmail\fP
1322 will kill the running daemon process and then quit. Otherwise,
1323 \fBfetchmail\fP will first kill a running daemon process and then
1324 continue running with the other options.
1325 .SS Useful options for daemon mode
1326 .PP
1327 The
1328 .B \-L <filename>
1329 or
1330 .B \-\-logfile <filename>
1331 option (keyword: set logfile) is only effective when fetchmail is
1332 detached and in daemon mode. Note that \fBthe logfile must exist
1333 before\fP fetchmail is run, you can use the
1334 .BR touch (1)
1335 command with the filename as its sole argument to create it.
1336 .br
1337 This option allows you to redirect status messages
1338 into a specified logfile (follow the option with the logfile name).  The
1339 logfile is opened for append, so previous messages aren't deleted.  This
1340 is primarily useful for debugging configurations. Note that fetchmail
1341 does not detect if the logfile is rotated, the logfile is only opened
1342 once when fetchmail starts. You need to restart fetchmail after rotating
1343 the logfile and before compressing it (if applicable).
1344 .PP
1345 The
1346 .B \-\-syslog
1347 option (keyword: set syslog) allows you to redirect status and error
1348 messages emitted to the
1349 .BR syslog (3)
1350 system daemon if available.
1351 Messages are logged with an id of \fBfetchmail\fP, the facility \fBLOG_MAIL\fP,
1352 and priorities \fBLOG_ERR\fP, \fBLOG_ALERT\fP or \fBLOG_INFO\fP.
1353 This option is intended for logging status and error messages which
1354 indicate the status of the daemon and the results while fetching mail
1355 from the server(s).
1356 Error messages for command line options and parsing the \fI.fetchmailrc\fP
1357 file are still written to stderr, or to the specified log file.
1358 The
1359 .B \-\-nosyslog
1360 option turns off use of
1361 .BR syslog (3),
1362 assuming it's turned on in the \fI~/.fetchmailrc\fP file.
1363 .PP
1364 The
1365 .B \-N
1366 or
1367 .B \-\-nodetach
1368 option suppresses backgrounding and detachment of the daemon process
1369 from its control terminal.  This is useful for debugging or when
1370 fetchmail runs as the child of a supervisor process such as
1371 .BR init (8)
1372 or Gerrit Pape's
1373 .BR runit (8).
1374 Note that this also causes the logfile option to be ignored (though
1375 perhaps it shouldn't).
1376 .PP
1377 Note that while running in daemon mode polling a IMAP2bis server,
1378 transient errors (such as DNS failures or sendmail delivery refusals)
1379 may force the fetchall option on for the duration of the next polling
1380 cycle.  This is a robustness feature.  It means that if a message is
1381 fetched (and thus marked seen by the mailserver) but not delivered
1382 locally due to some transient error, it will be re-fetched during the
1383 next poll cycle.  (The IMAP logic doesn't delete messages until
1384 they're delivered, so this problem does not arise.)
1385 .PP
1386 If you touch or change the \fI~/.fetchmailrc\fP file while fetchmail is
1387 running in daemon mode, this will be detected at the beginning of the
1388 next poll cycle.  When a changed \fI~/.fetchmailrc\fP is detected,
1389 fetchmail rereads it and restarts from scratch (using exec(2); no state
1390 information is retained in the new instance).  Note that if fetchmail
1391 needs to query for passwords, of that if you break the
1392 \fI~/.fetchmailrc\fP file's syntax, the new instance will softly and
1393 silently vanish away on startup.
1394
1395 .SH ADMINISTRATIVE OPTIONS
1396 .PP
1397 The
1398 .B \-\-postmaster <name>
1399 option (keyword: set postmaster) specifies the last-resort username to
1400 which multidrop mail is to be forwarded if no matching local recipient
1401 can be found. It is also used as destination of undeliverable mail if
1402 the 'bouncemail' global option is off and additionally for spam-blocked
1403 mail if the 'bouncemail' global option is off and the 'spambounce'
1404 global option is on. This option defaults to the user who invoked
1405 \fBfetchmail\fP.
1406 If the invoking user is root, then the default of this option is
1407 the user 'postmaster'.  Setting postmaster to the empty string causes
1408 such mail as described above to be discarded - this however is usually a
1409 bad idea.
1410 See also the description of the 'FETCHMAILUSER' environment variable in
1411 the ENVIRONMENT section below.
1412 .PP
1413 The
1414 .B \-\-nobounce
1415 behaves like the "set no bouncemail" global option, which see.
1416 .PP
1417 The
1418 .B \-\-invisible
1419 option (keyword: set invisible) tries to make fetchmail invisible.
1420 Normally, fetchmail behaves like any other MTA would -- it generates a
1421 Received header into each message describing its place in the chain of
1422 transmission, and tells the MTA it forwards to that the mail came from
1423 the machine fetchmail itself is running on.  If the invisible option
1424 is on, the Received header is suppressed and fetchmail tries to spoof
1425 the MTA it forwards to into thinking it came directly from the
1426 mailserver host.
1427 .PP
1428 The
1429 .B \-\-showdots
1430 option (keyword: set showdots) forces fetchmail to show progress dots
1431 even if the output goes to a file or fetchmail is not in verbose mode.
1432 Fetchmail shows the dots by default when run in \-\-verbose mode 
1433 \fIand\fP output goes to console. This option is ignored in \-\-silent mode.
1434 .PP
1435 By specifying the
1436 .B \-\-tracepolls
1437 option, you can ask fetchmail to add information to the Received
1438 header on the form "polling {label} account {user}", where {label} is
1439 the account label (from the specified rcfile, normally ~/.fetchmailrc)
1440 and {user} is the username which is used to log on to the mail
1441 server. This header can be used to make filtering email where no
1442 useful header information is available and you want mail from
1443 different accounts sorted into different mailboxes (this could, for
1444 example, occur if you have an account on the same server running a
1445 mailing list, and are subscribed to the list using that account). The
1446 default is not adding any such header.  In
1447 .IR .fetchmailrc ,
1448 this is called 'tracepolls'.
1449
1450 .SH RETRIEVAL FAILURE MODES
1451 The protocols \fBfetchmail\fP uses to talk to mailservers are next to
1452 bulletproof.  In normal operation forwarding to port 25, no message is
1453 ever deleted (or even marked for deletion) on the host until the SMTP
1454 listener on the client side has acknowledged to \fBfetchmail\fP that
1455 the message has been either accepted for delivery or rejected due to a
1456 spam block.
1457 .PP
1458 When forwarding to an MDA, however, there is more possibility
1459 of error.  Some MDAs are 'safe' and reliably return a nonzero status
1460 on any delivery error, even one due to temporary resource limits.
1461 The
1462 .BR maildrop (1)
1463 program is like this; so are most programs designed as mail transport
1464 agents, such as
1465 .BR sendmail (1),
1466 including the sendmail wrapper of Postfix and
1467 .BR exim (1).
1468 These programs give back a reliable positive acknowledgement and
1469 can be used with the mda option with no risk of mail loss.  Unsafe
1470 MDAs, though, may return 0 even on delivery failure.  If this
1471 happens, you will lose mail.
1472 .PP
1473 The normal mode of \fBfetchmail\fP is to try to download only 'new'
1474 messages, leaving untouched (and undeleted) messages you have already
1475 read directly on the server (or fetched with a previous \fIfetchmail
1476 \-\-keep\fP).  But you may find that messages you've already read on the
1477 server are being fetched (and deleted) even when you don't specify
1478 \-\-all.  There are several reasons this can happen.
1479 .PP
1480 A potential POP3 problem might be servers that insert messages
1481 in the middle of mailboxes (some VMS implementations of mail are
1482 rumored to do this).  The \fBfetchmail\fP code assumes that new
1483 messages are appended to the end of the mailbox; when this is not true
1484 it may treat some old messages as new and vice versa.  Using UIDL whilst
1485 setting fastuidl 0 might fix this, otherwise, consider switching to IMAP.
1486 .PP
1487 Yet another POP3 problem is that if they can't make tempfiles in the
1488 user's home directory, some POP3 servers will hand back an
1489 undocumented response that causes fetchmail to spuriously report "No
1490 mail".
1491 .PP
1492 The IMAP code uses the presence or absence of the server flag \eSeen
1493 to decide whether or not a message is new.  This isn't the right thing
1494 to do, fetchmail should check the UIDVALIDITY and use UID, but it
1495 doesn't do that yet. Under Unix, it counts on your IMAP server to notice
1496 the BSD-style Status flags set by mail user agents and set the \eSeen
1497 flag from them when appropriate.  All Unix IMAP servers we know of do
1498 this, though it's not specified by the IMAP RFCs.  If you ever trip over
1499 a server that doesn't, the symptom will be that messages you have
1500 already read on your host will look new to the server.  In this
1501 (unlikely) case, only messages you fetched with \fIfetchmail \-\-keep\fP
1502 will be both undeleted and marked old.
1503 .PP
1504 In ETRN and ODMR modes, \fBfetchmail\fP does not actually retrieve messages;
1505 instead, it asks the server's SMTP listener to start a queue flush
1506 to the client via SMTP.  Therefore it sends only undelivered messages.
1507
1508 .SH SPAM FILTERING
1509 Many SMTP listeners allow administrators to set up 'spam filters' that
1510 block unsolicited email from specified domains.  A MAIL FROM or DATA line that
1511 triggers this feature will elicit an SMTP response which
1512 (unfortunately) varies according to the listener.
1513 .PP
1514 Newer versions of
1515 \fBsendmail\fP
1516 return an error code of 571.
1517 .PP
1518 According to RFC2821, the correct thing to return in this situation is
1519 550 "Requested action not taken: mailbox unavailable" (the draft adds
1520 "[E.g., mailbox not found, no access, or command rejected for policy
1521 reasons].").
1522 .PP
1523 Older versions of the
1524 \fBexim\fP
1525 MTA return 501 "Syntax error in parameters or arguments".
1526 .PP
1527 The
1528 \fBpostfix\fP
1529 MTA runs 554 as an antispam response.
1530 .PP
1531 \fBZmailer\fP
1532 may reject code with a 500 response (followed by an enhanced status
1533 code that contains more information).
1534 .PP
1535 Return codes which
1536 \fBfetchmail\fP
1537 treats as antispam responses and discards
1538 the message can be set with the 'antispam' option.  This is one of the
1539 \fIonly\fP
1540 three circumstance under which fetchmail ever discards mail (the others
1541 are the 552 and 553 errors described below, and the suppression of
1542 multidropped messages with a message-ID already seen).
1543 .PP
1544 If
1545 \fBfetchmail\fP
1546 is fetching from an IMAP server, the antispam response will be detected and
1547 the message rejected immediately after the headers have been fetched,
1548 without reading the message body.  Thus, you won't pay for downloading
1549 spam message bodies.
1550 .PP
1551 By default, the list of antispam responses is empty.
1552 .PP
1553 If the \fIspambounce\fP global option is on, mail that is spam-blocked
1554 triggers an RFC1892/RFC1894 bounce message informing the originator that
1555 we do not accept mail from it. See also BUGS.
1556
1557 .SH SMTP/ESMTP ERROR HANDLING
1558 Besides the spam-blocking described above, fetchmail takes special
1559 actions on the following SMTP/ESMTP error responses
1560 .TP 5
1561 452 (insufficient system storage)
1562 Leave the message in the server mailbox for later retrieval.
1563 .TP 5
1564 552 (message exceeds fixed maximum message size)
1565 Delete the message from the server.  Send bounce-mail to the
1566 originator.
1567 .TP 5
1568 553 (invalid sending domain)
1569 Delete the message from the server.  Don't even try to send
1570 bounce-mail to the originator.
1571 .PP
1572 Other errors trigger bounce mail back to the originator. See also BUGS.
1573
1574 .SH THE RUN CONTROL FILE
1575 The preferred way to set up fetchmail is to write a
1576 \&\fI.fetchmailrc\fP file in your home directory (you may do this
1577 directly, with a text editor, or indirectly via \fBfetchmailconf\fP).
1578 When there is a conflict between the command-line arguments and the
1579 arguments in this file, the command-line arguments take precedence.
1580 .PP
1581 To protect the security of your passwords,
1582 your \fI~/.fetchmailrc\fP may not normally have more than 0700 (u=rwx,g=,o=) permissions;
1583 \fBfetchmail\fP
1584 will complain and exit otherwise (this check is suppressed when
1585 \-\-version is on).
1586 .PP
1587 You may read the \fI.fetchmailrc\fP file as a list of commands to
1588 be executed when
1589 \fBfetchmail\fP
1590 is called with no arguments.
1591 .SS Run Control Syntax
1592 .PP
1593 Comments begin with a '#' and extend through the end of the line.
1594 Otherwise the file consists of a series of server entries or global
1595 option statements in a free-format, token-oriented syntax.
1596 .PP
1597 There are four kinds of tokens: grammar keywords, numbers
1598 (i.e. decimal digit sequences), unquoted strings, and quoted strings.
1599 A quoted string is bounded by double quotes and may contain
1600 whitespace (and quoted digits are treated as a string).  Note that
1601 quoted strings will also contain line feed characters if they run across
1602 two or more lines, unless you use a backslash to join lines (see below).
1603 An unquoted string is any whitespace-delimited token that is neither
1604 numeric, string quoted nor contains the special characters ',', ';',
1605 \&':', or '='.
1606 .PP
1607 Any amount of whitespace separates tokens in server entries, but is
1608 otherwise ignored. You may use backslash escape sequences (\en for LF,
1609 \&\et for HT, \eb for BS, \er for CR, \e\fInnn\fP for decimal (where
1610 nnn cannot start with a 0), \e0\fIooo\fP for octal, and \ex\fIhh\fP for
1611 hex) to embed non-printable characters or string delimiters in strings.
1612 In quoted strings, a backslash at the very end of a line will cause the
1613 backslash itself and the line feed (LF or NL, new line) character to be
1614 ignored, so that you can wrap long strings. Without the backslash at the
1615 line end, the line feed character would become part of the string.
1616 .PP
1617 \fBWarning:\fP
1618 while these resemble C-style escape sequences, they are not the same.
1619 fetchmail only supports these eight styles. C supports more escape
1620 sequences that consist of backslash (\e) and a single character, but
1621 does not support decimal codes and does not require the leading 0 in
1622 octal notation.  Example: fetchmail interprets \e233 the same as \exE9
1623 (Latin small letter e with acute), where C would interpret \e233 as
1624 octal 0233 = \ex9B (CSI, control sequence introducer).
1625 .PP
1626 Each server entry consists of one of the keywords 'poll' or 'skip',
1627 followed by a server name, followed by server options, followed by any
1628 number of user (or username) descriptions, followed by user options.
1629 Note: the most common cause of syntax errors is mixing up user and
1630 server options or putting user options before the user descriptions.
1631 .PP
1632 For backward compatibility, the word 'server' is a synonym for 'poll'.
1633 .PP
1634 You can use the noise keywords 'and', 'with',
1635 \&'has', 'wants', and 'options' anywhere in an entry to make
1636 it resemble English.  They're ignored, but but can make entries much
1637 easier to read at a glance.  The punctuation characters ':', ';' and
1638 \&',' are also ignored.
1639 .PP
1640 .SS Poll vs. Skip
1641 The 'poll' verb tells fetchmail to query this host when it is run with
1642 no arguments.  The 'skip' verb tells
1643 \fBfetchmail\fP
1644 not to poll this host unless it is explicitly named on the command
1645 line.  (The 'skip' verb allows you to experiment with test entries
1646 safely, or easily disable entries for hosts that are temporarily down.)
1647 .PP
1648 .SS Keyword/Option Summary
1649 Here are the legal options.  Keyword suffixes enclosed in
1650 square brackets are optional.  Those corresponding to short command-line
1651 options are followed by '\-' and the appropriate option letter.  If
1652 option is only relevant to a single mode of operation, it is noted as
1653 \&'s' or 'm' for singledrop- or multidrop-mode, respectively.
1654
1655 Here are the legal global options:
1656
1657 .TS
1658 l l l lw34.
1659 Keyword         Opt     Mode    Function
1660 _
1661 set daemon      \-d     \&      T{
1662 Set a background poll interval in seconds.
1663 T}
1664 set postmaster          \&      \&      T{
1665 Give the name of the last-resort mail recipient (default: user running
1666 fetchmail, "postmaster" if run by the root user)
1667 T}
1668 set    bouncemail       \&      \&      T{
1669 Direct error mail to the sender (default)
1670 T}
1671 set no bouncemail       \&      \&      T{
1672 Direct error mail to the local postmaster (as per the 'postmaster'
1673 global option above).
1674 T}
1675 set no spambounce       \&      \&      T{
1676 Do not bounce spam-blocked mail (default).
1677 T}
1678 set    spambounce       \&      \&      T{
1679 Bounce blocked spam-blocked mail (as per the 'antispam' user option)
1680 back to the destination as indicated by the 'bouncemail' global option.
1681 Warning: Do not use this to bounce spam back to the sender - most spam
1682 is sent with false sender address and thus this option hurts innocent
1683 bystanders.
1684 T}
1685 set no softbounce       \&      \&      T{
1686 Delete permanently undeliverable mail. It is recommended to use this
1687 option if the configuration has been thoroughly tested.
1688 T}
1689 set    softbounce       \&      \&      T{
1690 Keep permanently undeliverable mail as though a temporary error had
1691 occurred (default).
1692 T}
1693 set logfile     \-L     \&      T{
1694 Name of a file to append error and status messages to.
1695 T}
1696 set idfile      \-i     \&      T{
1697 Name of the file to store UID lists in.
1698 T}
1699 set    syslog   \&      \&      T{
1700 Do error logging through syslog(3).
1701 T}
1702 set no syslog   \&      \&      T{
1703 Turn off error logging through syslog(3). (default)
1704 T}
1705 set properties  \&      \&      T{
1706 String value that is ignored by fetchmail (may be used by extension
1707 scripts).
1708 T}
1709 .TE
1710
1711 Here are the legal server options:
1712
1713 .TS
1714 l l l lw34.
1715 Keyword         Opt     Mode    Function
1716 _
1717 via             \&      \&      T{
1718 Specify DNS name of mailserver, overriding poll name
1719 T}
1720 proto[col]      \-p     \&      T{
1721 Specify protocol (case insensitive):
1722 POP3, IMAP, APOP, KPOP
1723 T}
1724 local[domains]  \&      m       T{
1725 Specify domain(s) to be regarded as local
1726 T}
1727 port            \&      \&      T{
1728 Specify TCP/IP service port (obsolete, use 'service' instead).
1729 T}
1730 service         \-P     \&      T{
1731 Specify service name (a numeric value is also allowed and
1732 considered a TCP/IP port number).
1733 T}
1734 auth[enticate]  \&      \&      T{
1735 Set authentication type (default 'any')
1736 T}
1737 timeout         \-t     \&      T{
1738 Server inactivity timeout in seconds (default 300)
1739 T}
1740 envelope        \-E     m       T{
1741 Specify envelope-address header name
1742 T}
1743 no envelope     \&      m       T{
1744 Disable looking for envelope address
1745 T}
1746 qvirtual        \-Q     m       T{
1747 Qmail virtual domain prefix to remove from user name
1748 T}
1749 aka             \&      m       T{
1750 Specify alternate DNS names of mailserver
1751 T}
1752 interface       \-I     \&      T{
1753 specify IP interface(s) that must be up for server poll to take place
1754 T}
1755 monitor         \-M     \&      T{
1756 Specify IP address to monitor for activity
1757 T}
1758 plugin          \&      \&      T{
1759 Specify command through which to make server connections.
1760 T}
1761 plugout         \&      \&      T{
1762 Specify command through which to make listener connections.
1763 T}
1764 dns             \&      m       T{
1765 Enable DNS lookup for multidrop (default)
1766 T}
1767 no dns          \&      m       T{
1768 Disable DNS lookup for multidrop
1769 T}
1770 checkalias      \&      m       T{
1771 Do comparison by IP address for multidrop
1772 T}
1773 no checkalias   \&      m       T{
1774 Do comparison by name for multidrop (default)
1775 T}
1776 uidl            \-U     \&      T{
1777 Force POP3 to use client-side UIDLs (recommended)
1778 T}
1779 no uidl         \&      \&      T{
1780 Turn off POP3 use of client-side UIDLs (default)
1781 T}
1782 interval        \&      \&      T{
1783 Only check this site every N poll cycles; N is a numeric argument.
1784 T}
1785 tracepolls      \&      \&      T{
1786 Add poll tracing information to the Received header
1787 T}
1788 principal       \&      \&      T{
1789 Set Kerberos principal (only useful with IMAP and kerberos)
1790 T}
1791 esmtpname       \&      \&      T{
1792 Set name for RFC2554 authentication to the ESMTP server.
1793 T}
1794 esmtppassword   \&      \&      T{
1795 Set password for RFC2554 authentication to the ESMTP server.
1796 T}
1797 bad-header      \&      \&      T{
1798 How to treat messages with a bad header. Can be reject (default) or accept.
1799 T}
1800 .TE
1801
1802 Here are the legal user descriptions and options:
1803
1804 .TS
1805 l l l lw34.
1806 Keyword         Opt     Mode    Function
1807 _
1808 user[name]      \-u     \&      T{
1809 This is the user description and must come first after server
1810 description and after possible server options, and before user options.
1811 .br
1812 It sets the remote user name if by itself or followed by 'there', or the
1813 local user name if followed by 'here'.
1814 T}
1815 is              \&      \&      T{
1816 Connect local and remote user names
1817 T}
1818 to              \&      \&      T{
1819 Connect local and remote user names
1820 T}
1821 pass[word]      \&      \&      T{
1822 Specify remote account password
1823 T}
1824 ssl             \&      \&      T{
1825 Connect to server over the specified base protocol using SSL encryption
1826 T}
1827 sslcert         \&      \&      T{
1828 Specify file for \fBclient side\fP public SSL certificate
1829 T}
1830 sslcertfile     \&      \&      T{
1831 Specify file with trusted CA certificates
1832 T}
1833 sslcertpath     \&      \&      T{
1834 Specify c_rehash-ed directory with trusted CA certificates.
1835 T}
1836 sslkey          \&      \&      T{
1837 Specify file for \fBclient side\fP private SSL key
1838 T}
1839 sslproto        \&      \&      T{
1840 Force ssl protocol for connection
1841 T}
1842 folder          \-r     \&      T{
1843 Specify remote folder to query
1844 T}
1845 smtphost        \-S     \&      T{
1846 Specify smtp host(s) to forward to
1847 T}
1848 fetchdomains    \&      m       T{
1849 Specify domains for which mail should be fetched
1850 T}
1851 smtpaddress     \-D     \&      T{
1852 Specify the domain to be put in RCPT TO lines
1853 T}
1854 smtpname        \&      \&      T{
1855 Specify the user and domain to be put in RCPT TO lines
1856 T}
1857 antispam        \-Z     \&      T{
1858 Specify what SMTP returns are interpreted as spam-policy blocks
1859 T}
1860 mda             \-m     \&      T{
1861 Specify MDA for local delivery
1862 T}
1863 bsmtp           \-o     \&      T{
1864 Specify BSMTP batch file to append to
1865 T}
1866 preconnect      \&      \&      T{
1867 Command to be executed before each connection
1868 T}
1869 postconnect     \&      \&      T{
1870 Command to be executed after each connection
1871 T}
1872 keep            \-k     \&      T{
1873 Don't delete seen messages from server (for POP3, uidl is recommended)
1874 T}
1875 flush           \-F     \&      T{
1876 Flush all seen messages before querying (DANGEROUS)
1877 T}
1878 limitflush      \&      \&      T{
1879 Flush all oversized messages before querying
1880 T}
1881 fetchall        \-a     \&      T{
1882 Fetch all messages whether seen or not
1883 T}
1884 rewrite         \&      \&      T{
1885 Rewrite destination addresses for reply (default)
1886 T}
1887 stripcr         \&      \&      T{
1888 Strip carriage returns from ends of lines
1889 T}
1890 forcecr         \&      \&      T{
1891 Force carriage returns at ends of lines
1892 T}
1893 pass8bits       \&      \&      T{
1894 Force BODY=8BITMIME to ESMTP listener
1895 T}
1896 dropstatus      \&      \&      T{
1897 Strip Status and X-Mozilla-Status lines out of incoming mail
1898 T}
1899 dropdelivered   \&      \&      T{
1900 Strip Delivered-To lines out of incoming mail
1901 T}
1902 mimedecode      \&      \&      T{
1903 Convert quoted-printable to 8-bit in MIME messages
1904 T}
1905 idle            \&      \&      T{
1906 Idle waiting for new messages after each poll (IMAP only)
1907 T}
1908 no keep         \-K     \&      T{
1909 Delete seen messages from server (default)
1910 T}
1911 no flush        \&      \&      T{
1912 Don't flush all seen messages before querying (default)
1913 T}
1914 no fetchall     \&      \&      T{
1915 Retrieve only new messages (default)
1916 T}
1917 no rewrite      \&      \&      T{
1918 Don't rewrite headers
1919 T}
1920 no stripcr      \&      \&      T{
1921 Don't strip carriage returns (default)
1922 T}
1923 no forcecr      \&      \&      T{
1924 Don't force carriage returns at EOL (default)
1925 T}
1926 no pass8bits    \&      \&      T{
1927 Don't force BODY=8BITMIME to ESMTP listener (default)
1928 T}
1929 no dropstatus   \&      \&      T{
1930 Don't drop Status headers (default)
1931 T}
1932 no dropdelivered        \&      \&      T{
1933 Don't drop Delivered\-To headers (default)
1934 T}
1935 no mimedecode   \&      \&      T{
1936 Don't convert quoted-printable to 8-bit in MIME messages (default)
1937 T}
1938 no idle         \&      \&      T{
1939 Don't idle waiting for new messages after each poll (IMAP only)
1940 T}
1941 limit           \-l     \&      T{
1942 Set message size limit
1943 T}
1944 warnings        \-w     \&      T{
1945 Set message size warning interval
1946 T}
1947 batchlimit      \-b     \&      T{
1948 Max # messages to forward in single connect
1949 T}
1950 fetchlimit      \-B     \&      T{
1951 Max # messages to fetch in single connect
1952 T}
1953 fetchsizelimit  \&      \&      T{
1954 Max # message sizes to fetch in single transaction
1955 T}
1956 fastuidl        \&      \&      T{
1957 Use binary search for first unseen message (POP3 only)
1958 T}
1959 expunge         \-e     \&      T{
1960 Perform an expunge on every #th message (IMAP and POP3 only)
1961 T}
1962 properties      \&      \&      T{
1963 String value is ignored by fetchmail (may be used by extension scripts)
1964 T}
1965 .TE
1966 .PP
1967 All user options must begin with a user description (user or username
1968 option) and \fIfollow\fP all server descriptions and options.
1969 .PP
1970 In the .fetchmailrc file, the 'envelope' string argument may be
1971 preceded by a whitespace-separated number.  This number, if specified,
1972 is the number of such headers to skip over (that is, an argument of 1
1973 selects the second header of the given type).  This is sometime useful
1974 for ignoring bogus envelope headers created by an ISP's local delivery
1975 agent or internal forwards (through mail inspection systems, for
1976 instance).
1977 .SS Keywords Not Corresponding To Option Switches
1978 .PP
1979 The 'folder' and 'smtphost' options (unlike their command-line
1980 equivalents) can take a space- or comma-separated list of names
1981 following them.
1982 .PP
1983 All options correspond to the obvious command-line arguments, except
1984 the following: 'via', 'interval', 'aka', 'is', 'to', 'dns'/'no dns',
1985 \&'checkalias'/'no checkalias', 'password', 'preconnect', 'postconnect',
1986 \&'localdomains', 'stripcr'/'no stripcr', 'forcecr'/'no forcecr',
1987 \&'pass8bits'/'no pass8bits' 'dropstatus/no dropstatus',
1988 \&'dropdelivered/no dropdelivered', 'mimedecode/no mimedecode', 'no idle',
1989 and 'no envelope'.
1990 .PP
1991 The 'via' option is for if you want to have more
1992 than one configuration pointing at the same site.  If it is present,
1993 the string argument will be taken as the actual DNS name of the
1994 mailserver host to query.
1995 This will override the argument of poll, which can then simply be a
1996 distinct label for the configuration (e.g. what you would give on the
1997 command line to explicitly query this host).
1998 .PP
1999 The 'interval' option (which takes a numeric argument) allows you to poll a
2000 server less frequently than the basic poll interval.  If you say
2001 \&'interval N' the server this option is attached to will only be
2002 queried every N poll intervals.
2003 .SS Singledrop vs. Multidrop options
2004 .PP
2005 Please ensure you read the section titled
2006 \fBTHE USE AND ABUSE OF MULTIDROP MAILBOXES \fP
2007 if you intend to use multidrop mode.
2008 .PP
2009 The 'is' or 'to' keywords associate the following local (client)
2010 name(s) (or server-name to client-name mappings separated by =) with
2011 the mailserver user name in the entry.  If an is/to list has '*' as
2012 its last name, unrecognized names are simply passed through. Note that
2013 until \fBfetchmail\fP version 6.3.4 inclusively, these lists could only
2014 contain local parts of user names (fetchmail would only look at the part
2015 before the @ sign). \fBfetchmail\fP versions 6.3.5 and
2016 newer support full addresses on the left hand side of these mappings,
2017 and they take precedence over any 'localdomains', 'aka', 'via' or
2018 similar mappings.
2019 .PP
2020 A single local name can be used to support redirecting your mail when
2021 your username on the client machine is different from your name on the
2022 mailserver.  When there is only a single local name, mail is forwarded
2023 to that local username regardless of the message's Received, To, Cc,
2024 and Bcc headers.  In this case,
2025 \fBfetchmail\fP
2026 never does DNS lookups.
2027 .PP
2028 When there is more than one local name (or name mapping),
2029 \fBfetchmail\fP looks at the envelope header, if configured, and
2030 otherwise at the Received, To, Cc, and Bcc headers of retrieved mail
2031 (this is 'multidrop mode').  It looks for addresses with hostname parts
2032 that match your poll name or your 'via', 'aka' or 'localdomains'
2033 options, and usually also for hostname parts which DNS tells it are
2034 aliases of the mailserver.  See the discussion of 'dns', 'checkalias',
2035 \&'localdomains', and 'aka' for details on how matching addresses are
2036 handled.
2037 .PP
2038 If \fBfetchmail\fP cannot match any mailserver usernames or
2039 localdomain addresses, the mail will be bounced.
2040 Normally it will be bounced to the sender, but if the 'bouncemail'
2041 global option is off, the mail will go to the local postmaster instead.
2042 (see the 'postmaster' global option). See also BUGS.
2043 .PP
2044 The 'dns' option (normally on) controls the way addresses from
2045 multidrop mailboxes are checked.  On, it enables logic to check each
2046 host address that does not match an 'aka' or 'localdomains' declaration
2047 by looking it up with DNS.  When a mailserver username is recognized
2048 attached to a matching hostname part, its local mapping is added to
2049 the list of local recipients.
2050 .PP
2051 The 'checkalias' option (normally off) extends the lookups performed
2052 by the 'dns' keyword in multidrop mode, providing a way to cope with
2053 remote MTAs that identify themselves using their canonical name, while
2054 they're polled using an alias.
2055 When such a server is polled, checks to extract the envelope address
2056 fail, and \fBfetchmail\fP reverts to delivery using the To/Cc/Bcc
2057 headers (See below \&'Header vs. Envelope addresses').
2058 Specifying this option instructs \fBfetchmail\fP to retrieve all the IP
2059 addresses associated with both the poll name and the name used by the
2060 remote MTA and to do a comparison of the IP addresses.  This comes in
2061 handy in situations where the remote server undergoes frequent canonical
2062 name changes, that would otherwise require modifications to the rcfile.
2063 \&'checkalias' has no effect if \&'no dns' is specified in the rcfile.
2064 .PP
2065 The 'aka' option is for use with multidrop mailboxes.  It allows you
2066 to pre-declare a list of DNS aliases for a server.  This is an
2067 optimization hack that allows you to trade space for speed.  When
2068 \fBfetchmail\fP, while processing a multidrop mailbox, grovels through
2069 message headers looking for names of the mailserver, pre-declaring
2070 common ones can save it from having to do DNS lookups.  Note: the names
2071 you give as arguments to 'aka' are matched as suffixes -- if you specify
2072 (say) 'aka netaxs.com', this will match not just a hostname netaxs.com,
2073 but any hostname that ends with '.netaxs.com'; such as (say)
2074 pop3.netaxs.com and mail.netaxs.com.
2075 .PP
2076 The 'localdomains' option allows you to declare a list of domains
2077 which fetchmail should consider local.  When fetchmail is parsing
2078 address lines in multidrop modes, and a trailing segment of a host
2079 name matches a declared local domain, that address is passed through
2080 to the listener or MDA unaltered (local-name mappings are \fInot\fP
2081 applied).
2082 .PP
2083 If you are using 'localdomains', you may also need to specify 'no
2084 envelope', which disables \fBfetchmail\fP's normal attempt to deduce
2085 an envelope address from the Received line or X-Envelope-To header or
2086 whatever header has been previously set by 'envelope'.  If you set 'no
2087 envelope' in the defaults entry it is possible to undo that in
2088 individual entries by using 'envelope <string>'.  As a special case,
2089 \&'envelope "Received"' restores the default parsing of
2090 Received lines.
2091 .PP
2092 The \fBpassword\fP option requires a string argument, which is the password
2093 to be used with the entry's server.
2094 .PP
2095 The 'preconnect' keyword allows you to specify a shell command to be
2096 executed just before each time
2097 \fBfetchmail\fP
2098 establishes a mailserver connection.  This may be useful if you are
2099 attempting to set up secure POP connections with the aid of
2100 .BR ssh (1).
2101 If the command returns a nonzero status, the poll of that mailserver
2102 will be aborted.
2103 .PP
2104 Similarly, the 'postconnect' keyword similarly allows you to specify a
2105 shell command to be executed just after each time a mailserver
2106 connection is taken down.
2107 .PP
2108 The 'forcecr' option controls whether lines terminated by LF only are
2109 given CRLF termination before forwarding.  Strictly speaking RFC821
2110 requires this, but few MTAs enforce the requirement it so this option
2111 is normally off (only one such MTA, qmail, is in significant use at
2112 time of writing).
2113 .PP
2114 The 'stripcr' option controls whether carriage returns are stripped
2115 out of retrieved mail before it is forwarded.  It is normally not
2116 necessary to set this, because it defaults to 'on' (CR stripping
2117 enabled) when there is an MDA declared but 'off' (CR stripping
2118 disabled) when forwarding is via SMTP.  If 'stripcr' and 'forcecr' are
2119 both on, 'stripcr' will override.
2120 .PP
2121 The 'pass8bits' option exists to cope with Microsoft mail programs that
2122 stupidly slap a "Content-Transfer-Encoding: 7bit" on everything.  With
2123 this option off (the default) and such a header present,
2124 \fBfetchmail\fP
2125 declares BODY=7BIT to an ESMTP-capable listener; this causes problems for
2126 messages actually using 8-bit ISO or KOI-8 character sets, which will
2127 be garbled by having the high bits of all characters stripped.  If
2128 \&'pass8bits' is on,
2129 \fBfetchmail\fP
2130 is forced to declare BODY=8BITMIME to any ESMTP-capable listener.  If
2131 the listener is 8-bit-clean (as all the major ones now are) the right
2132 thing will probably result.
2133 .PP
2134 The 'dropstatus' option controls whether nonempty Status and
2135 X-Mozilla-Status lines are retained in fetched mail (the default) or
2136 discarded.  Retaining them allows your MUA to see what messages (if
2137 any) were marked seen on the server.  On the other hand, it can
2138 confuse some new-mail notifiers, which assume that anything with a
2139 Status line in it has been seen.  (Note: the empty Status lines
2140 inserted by some buggy POP servers are unconditionally discarded.)
2141 .PP
2142 The 'dropdelivered' option controls whether Delivered\-To headers will
2143 be kept in fetched mail (the default) or discarded. These headers are
2144 added by Qmail and Postfix mailservers in order to avoid mail loops but
2145 may get in your way if you try to "mirror" a mailserver within the same
2146 domain. Use with caution.
2147 .PP
2148 The 'mimedecode' option controls whether MIME messages using the
2149 quoted-printable encoding are automatically converted into pure 8-bit
2150 data. If you are delivering mail to an ESMTP-capable, 8-bit-clean
2151 listener (that includes all of the major MTAs like sendmail), then
2152 this will automatically convert quoted-printable message headers and
2153 data into 8-bit data, making it easier to understand when reading
2154 mail. If your e-mail programs know how to deal with MIME messages,
2155 then this option is not needed.  The mimedecode option is off by
2156 default, because doing RFC2047 conversion on headers throws away
2157 character-set information and can lead to bad results if the encoding
2158 of the headers differs from the body encoding.
2159 .PP
2160 The 'idle' option is intended to be used with IMAP servers supporting
2161 the RFC2177 IDLE command extension, but does not strictly require it.
2162 If it is enabled, and fetchmail detects that IDLE is supported, an
2163 IDLE will be issued at the end of each poll.  This will tell the IMAP
2164 server to hold the connection open and notify the client when new mail
2165 is available.  If IDLE is not supported, fetchmail will simulate it by
2166 periodically issuing NOOP. If you need to poll a link frequently, IDLE
2167 can save bandwidth by eliminating TCP/IP connects and LOGIN/LOGOUT
2168 sequences. On the other hand, an IDLE connection will eat almost all
2169 of your fetchmail's time, because it will never drop the connection
2170 and allow other polls to occur unless the server times out the IDLE.
2171 It also doesn't work with multiple folders; only the first folder will
2172 ever be polled.
2173
2174 .PP
2175 The 'properties' option is an extension mechanism.  It takes a string
2176 argument, which is ignored by fetchmail itself.  The string argument may be
2177 used to store configuration information for scripts which require it.
2178 In particular, the output of '\-\-configdump' option will make properties
2179 associated with a user entry readily available to a Python script.
2180 .PP
2181 .SS Miscellaneous Run Control Options
2182 The words 'here' and 'there' have useful English-like
2183 significance.  Normally 'user eric is esr' would mean that
2184 mail for the remote user 'eric' is to be delivered to 'esr',
2185 but you can make this clearer by saying 'user eric there is esr here',
2186 or reverse it by saying 'user esr here is eric there'
2187 .PP
2188 Legal protocol identifiers for use with the 'protocol' keyword are:
2189 .sp
2190 .nf
2191     auto (or AUTO) (legacy, to be removed from future release)
2192     pop3 (or POP3)
2193     sdps (or SDPS)
2194     imap (or IMAP)
2195     apop (or APOP)
2196     kpop (or KPOP)
2197 .fi
2198 .sp
2199 .PP
2200 Legal authentication types are 'any', 'password', 'kerberos',
2201 \&'kerberos_v4', 'kerberos_v5' and 'gssapi', 'cram\-md5', 'otp', 'msn'
2202 (only for POP3), 'ntlm', 'ssh', 'external' (only IMAP).
2203 The 'password' type specifies
2204 authentication by normal transmission of a password (the password may be
2205 plain text or subject to protocol-specific encryption as in CRAM-MD5);
2206 \&'kerberos' tells \fBfetchmail\fP to try to get a Kerberos ticket at the
2207 start of each query instead, and send an arbitrary string as the
2208 password; and 'gssapi' tells fetchmail to use GSSAPI authentication.
2209 See the description of the 'auth' keyword for more.
2210 .PP
2211 Specifying 'kpop' sets POP3 protocol over port 1109 with Kerberos V4
2212 authentication.  These defaults may be overridden by later options.
2213 .PP
2214 There are some global option statements: 'set logfile'
2215 followed by a string sets the same global specified by \-\-logfile.  A
2216 command-line \-\-logfile option will override this. Note that \-\-logfile is
2217 only effective if fetchmail detaches itself from the terminal and the
2218 logfile already exists before fetchmail is run, and it overrides
2219 \-\-syslog in this case.  Also,
2220 \&'set daemon' sets the poll interval as \-\-daemon does.  This can be
2221 overridden by a command-line \-\-daemon option; in particular \-\-daemon\~0
2222 can be used to force foreground operation. The 'set postmaster'
2223 statement sets the address to which multidrop mail defaults if there are
2224 no local matches.  Finally, 'set syslog' sends log messages to
2225 syslogd(8).
2226
2227 .SH DEBUGGING FETCHMAIL
2228 .SS Fetchmail crashing
2229 There are various ways in that fetchmail may "crash", i. e. stop
2230 operation suddenly and unexpectedly. A "crash" usually refers to an
2231 error condition that the software did not handle by itself. A well-known
2232 failure mode is the "segmentation fault" or "signal 11" or "SIGSEGV" or
2233 just "segfault" for short. These can be caused by hardware or by software
2234 problems. Software-induced segfaults can usually be reproduced easily
2235 and in the same place, whereas hardware-induced segfaults can go away if
2236 the computer is rebooted, or powered off for a few hours, and can happen
2237 in random locations even if you use the software the same way.
2238
2239 For solving hardware-induced segfaults, find the faulty component and repair or
2240 replace it.
2241 .URL http://www.bitwizard.nl/sig11/ "The Sig11 FAQ"
2242 may help you with details.
2243
2244 For solving software-induced segfaults, the developers may need a "stack
2245 backtrace".
2246
2247 .SS Enabling fetchmail core dumps
2248 By default, fetchmail suppresses core dumps as these might contain
2249 passwords and other sensitive information. For debugging fetchmail
2250 crashes, obtaining a "stack backtrace" from a core dump is often the
2251 quickest way to solve the problem, and when posting your problem on a
2252 mailing list, the developers may ask you for a "backtrace".
2253
2254 1. To get useful backtraces, fetchmail needs to be installed without
2255 getting stripped of its compilation symbols.  Unfortunately, most
2256 binary packages that are installed are stripped, and core files from
2257 symbol-stripped programs are worthless. So you may need to recompile
2258 fetchmail. On many systems, you can type
2259 .sp
2260 .nf
2261         file `which fetchmail`
2262 .fi
2263 .sp
2264 to find out if fetchmail was symbol-stripped or not. If yours was
2265 unstripped, fine, proceed, if it was stripped, you need to recompile the
2266 source code first. You do not usually need to install fetchmail in order
2267 to debug it.
2268
2269 2. The shell environment that starts fetchmail needs to enable core
2270 dumps. The key is the "maximum core (file) size" that can usually be
2271 configured with a tool named "limit" or "ulimit". See the documentation
2272 for your shell for details. In the popular bash shell, "ulimit \-Sc
2273 unlimited" will allow the core dump.
2274
2275 3. You need to tell fetchmail, too, to allow core dumps. To do
2276 this, run fetchmail with the \fB\-d0 \-v\fP options.  It is often easier
2277 to also add \fB\-\-nosyslog \-N\fP as well.
2278
2279 Finally, you need to reproduce the crash. You can just start fetchmail
2280 from the directory where you compiled it by typing \fB./fetchmail\fP,
2281 so the complete command line will start with \fB./fetchmail \-Nvd0
2282 \&\-\-nosyslog\fP and perhaps list your other options.
2283
2284 After the crash, run your debugger to obtain the core dump.  The
2285 debugger will often be GNU GDB, you can then type (adjust paths as
2286 necessary) \fBgdb ./fetchmail fetchmail.core\fP and then, after GDB
2287 has started up and read all its files, type \fBbacktrace full\fP, save
2288 the output (copy & paste will do, the backtrace will be read by a human)
2289 and then type \fBquit\fP to leave gdb.
2290 \fBNote:\fP
2291 on some systems, the core
2292 files have different names, they might contain a number instead of the
2293 program name, or number and name, but it will usually have "core" as
2294 part of their name.
2295
2296 .SH INTERACTION WITH RFC 822
2297 When trying to determine the originating address of a message,
2298 fetchmail looks through headers in the following order:
2299 .sp
2300 .nf
2301         Return-Path:
2302         Resent-Sender: (ignored if it doesn't contain an @ or !)
2303         Sender: (ignored if it doesn't contain an @ or !)
2304         Resent-From:
2305         From:
2306         Reply-To:
2307         Apparently-From:
2308 .fi
2309 .sp
2310 The originating address is used for logging, and to set the MAIL FROM
2311 address when forwarding to SMTP.  This order is intended to cope
2312 gracefully with receiving mailing list messages in multidrop mode. The
2313 intent is that if a local address doesn't exist, the bounce message
2314 won't be returned blindly to the author or to the list itself, but
2315 rather to the list manager (which is less annoying).
2316
2317 In multidrop mode, destination headers are processed as follows:
2318 First, fetchmail looks for the header specified by the 'envelope' option
2319 in order to determine the local recipient address. If the mail is
2320 addressed to more than one recipient, the Received line won't contain
2321 any information regarding recipient addresses.
2322
2323 Then fetchmail looks for the Resent-To:, Resent-Cc:, and Resent-Bcc:
2324 lines.  If they exist, they should contain the final recipients and
2325 have precedence over their To:/Cc:/Bcc: counterparts.  If the Resent\-*
2326 lines don't exist, the To:, Cc:, Bcc: and Apparently-To: lines are
2327 looked for. (The presence of a Resent\-To: is taken to imply that the
2328 person referred by the To: address has already received the original
2329 copy of the mail.)
2330
2331 .SH CONFIGURATION EXAMPLES
2332 Note that although there are password declarations in a good many
2333 of the examples below, this is mainly for illustrative purposes.
2334 We recommend stashing account/password pairs in your $HOME/.netrc
2335 file, where they can be used not just by fetchmail but by ftp(1) and
2336 other programs.
2337
2338 The basic format is:
2339
2340 .IP
2341 poll \fISERVERNAME\fP protocol \fIPROTOCOL\fP username \fINAME\fP
2342 password \fIPASSWORD\fP
2343
2344 .PP
2345 Example:
2346
2347 .IP
2348 .nf
2349 poll pop.provider.net protocol pop3 username "jsmith" password "secret1"
2350 .fi
2351
2352 .PP
2353 Or, using some abbreviations:
2354
2355 .IP
2356 .nf
2357 poll pop.provider.net proto pop3 user "jsmith" password "secret1"
2358 .fi
2359
2360 .PP
2361 Multiple servers may be listed:
2362
2363 .IP
2364 .nf
2365 poll pop.provider.net proto pop3 user "jsmith" pass "secret1"
2366 poll other.provider.net proto imap user "John.Smith" pass "My^Hat"
2367 .fi
2368
2369 .PP
2370 Here's the same version with more whitespace and some noise words:
2371
2372 .IP
2373 .nf
2374 poll pop.provider.net proto pop3
2375      user "jsmith", with password secret1, is "jsmith" here;
2376 poll other.provider.net proto imap:
2377      user "John.Smith", with password "My^Hat", is "John.Smith" here;
2378 .fi
2379
2380 .PP
2381 If you need to include whitespace in a parameter string or start the
2382 latter with a number, enclose the string in double quotes.  Thus:
2383
2384 .IP
2385 .nf
2386 poll mail.provider.net with proto pop3:
2387      user "jsmith" there has password "4u but u can't krak this"
2388      is jws here and wants mda "/bin/mail"
2389 .fi
2390
2391 .PP
2392 You may have an initial server description headed by the keyword
2393 \&'defaults' instead of 'poll' followed by a name.  Such a record
2394 is interpreted as defaults for all queries to use. It may be overwritten
2395 by individual server descriptions.  So, you could write:
2396
2397 .IP
2398 .nf
2399 defaults proto pop3
2400      user "jsmith"
2401 poll pop.provider.net
2402      pass "secret1"
2403 poll mail.provider.net
2404      user "jjsmith" there has password "secret2"
2405 .fi
2406
2407 .PP
2408 It's possible to specify more than one user per server.
2409 The 'user' keyword leads off a user description, and every user specification
2410 in a multi-user entry must include it.  Here's an example:
2411
2412 .IP
2413 .nf
2414 poll pop.provider.net proto pop3 port 3111
2415      user "jsmith" with pass "secret1" is "smith" here
2416      user jones with pass "secret2" is "jjones" here keep
2417 .fi
2418
2419 .PP
2420 This associates the local username 'smith' with the pop.provider.net
2421 username 'jsmith' and the local username 'jjones' with the
2422 pop.provider.net username 'jones'.  Mail for 'jones' is kept on the
2423 server after download.
2424
2425 .PP
2426 Here's what a simple retrieval configuration for a multidrop mailbox
2427 looks like:
2428
2429 .IP
2430 .nf
2431 poll pop.provider.net:
2432      user maildrop with pass secret1 to golux 'hurkle'='happy' snark here
2433 .fi
2434
2435 .PP
2436 This says that the mailbox of account 'maildrop' on the server is a
2437 multidrop box, and that messages in it should be parsed for the
2438 server user names 'golux', 'hurkle', and 'snark'.  It further
2439 specifies that 'golux' and 'snark' have the same name on the
2440 client as on the server, but mail for server user 'hurkle' should be
2441 delivered to client user 'happy'.
2442
2443 .PP
2444 \fBNote\fP that \fBfetchmail,\fP until version 6.3.4, did NOT allow full
2445 user@domain specifications here, these would never match.
2446 \fIFetchmail\fP 6.3.5 and newer support user@domain specifications on
2447 the left-hand side of a user mapping.
2448
2449 .PP
2450 Here's an example of another kind of multidrop connection:
2451
2452 .IP
2453 .nf
2454 poll pop.provider.net localdomains loonytoons.org toons.org
2455      envelope X-Envelope-To
2456      user maildrop with pass secret1 to * here
2457 .fi
2458
2459 .PP
2460 This also says that the mailbox of account 'maildrop' on the server is
2461 a multidrop box.  It tells fetchmail that any address in the
2462 loonytoons.org or toons.org domains (including sub-domain addresses like
2463 \&'joe@daffy.loonytoons.org') should be passed through to the local SMTP
2464 listener without modification.  Be careful of mail loops if you do this!
2465
2466 .PP
2467 Here's an example configuration using ssh and the plugin option.  The
2468 queries are made directly on the stdin and stdout of imapd via ssh.
2469 Note that in this setup, IMAP authentication can be skipped.
2470
2471 .IP
2472 .nf
2473 poll mailhost.net with proto imap:
2474      plugin "ssh %h /usr/sbin/imapd" auth ssh;
2475      user esr is esr here
2476 .fi
2477
2478 .SH THE USE AND ABUSE OF MULTIDROP MAILBOXES
2479 Use the multiple-local-recipients feature with caution -- it can bite.
2480 All multidrop features are ineffective in ETRN and ODMR modes.
2481
2482 Also, note that in multidrop mode duplicate mails are suppressed.  A
2483 piece of mail is considered duplicate if it has the same message-ID as
2484 the message immediately preceding and more than one addressee.  Such
2485 runs of messages may be generated when copies of a message addressed
2486 to multiple users are delivered to a multidrop box.
2487
2488 .SS Header vs. Envelope addresses
2489 The fundamental problem is that by having your mailserver toss several
2490 peoples' mail in a single maildrop box, you may have thrown away
2491 potentially vital information about who each piece of mail was
2492 actually addressed to (the 'envelope address', as opposed to the
2493 header addresses in the RFC822 To/Cc headers - the Bcc is not available
2494 at the receiving end).  This 'envelope address' is the address you need
2495 in order to reroute mail properly.
2496 .PP
2497 Sometimes
2498 \fBfetchmail\fP
2499 can deduce the envelope address.  If the mailserver MTA is
2500 \fBsendmail\fP
2501 and the item of mail had just one recipient, the MTA will have written
2502 a 'by/for' clause that gives the envelope addressee into its Received
2503 header. But this doesn't work reliably for other MTAs, nor if there is
2504 more than one recipient.  By default, \fBfetchmail\fP looks for
2505 envelope addresses in these lines; you can restore this default with
2506 \&\-E "Received" or 'envelope Received'.
2507 .PP
2508 \fBAs a better alternative,\fP
2509 some SMTP listeners and/or mail servers insert a header
2510 in each message containing a copy of the envelope addresses.  This
2511 header (when it exists) is often 'X\-Original\-To', 'Delivered\-To' or
2512 \&'X\-Envelope\-To'.  Fetchmail's assumption about this can be changed with
2513 the \-E or 'envelope' option.  Note that writing an envelope header of
2514 this kind exposes the names of recipients (including blind-copy
2515 recipients) to all receivers of the messages, so the upstream must store
2516 one copy of the message per recipient to avoid becoming a privacy problem.
2517 .PP
2518 Postfix, since version 2.0, writes an X\-Original\-To: header which
2519 contains a copy of the envelope as it was received.
2520 .PP
2521 Qmail and Postfix generally write a 'Delivered\-To' header upon
2522 delivering the message to the mail spool and use it to avoid mail loops.
2523 Qmail virtual domains however will prefix the user name with a string
2524 that normally matches the user's domain. To remove this prefix you can
2525 use the \-Q or 'qvirtual' option.
2526 .PP
2527 Sometimes, unfortunately, neither of these methods works.  That is the
2528 point when you should contact your ISP and ask them to provide such an
2529 envelope header, and you should not use multidrop in this situation.
2530 When they all fail, fetchmail must fall back on the contents of To/Cc
2531 headers (Bcc headers are not available - see below) to try to determine
2532 recipient addressees -- and these are unreliable.
2533 In particular, mailing-list software often ships mail with only
2534 the list broadcast address in the To header.
2535 .PP
2536 \fBNote that a future version of \fBfetchmail\fP may remove To/Cc parsing!\fP
2537 .PP
2538 When
2539 \fBfetchmail\fP
2540 cannot deduce a recipient address that is local, and the intended
2541 recipient address was anyone other than fetchmail's invoking user,
2542 \fBmail will get lost.\fP
2543 This is what makes the multidrop feature risky without proper envelope
2544 information.
2545 .PP
2546 A related problem is that when you blind-copy a mail message, the Bcc
2547 information is carried \fIonly\fP as envelope address (it's removed from
2548 the headers by the sending mail server, so fetchmail can see it only if
2549 there is an X\-Envelope\-To header).  Thus, blind-copying to someone who
2550 gets mail over a fetchmail multidrop link will fail unless the the
2551 mailserver host routinely writes X\-Envelope\-To or an equivalent header
2552 into messages in your maildrop.
2553 .PP
2554 \fBIn conclusion, mailing lists and Bcc'd mail can only work if the
2555 server you're fetching from\fP
2556 .IP (1)
2557 \fBstores one copy of the message per recipient in your domain and\fP
2558 .IP (2)
2559 \fBrecords the envelope information in a special header (X\-Original\-To,
2560 Delivered\-To, X\-Envelope\-To).\fP
2561
2562 .SS Good Ways To Use Multidrop Mailboxes
2563 Multiple local names can be used to administer a mailing list from the
2564 client side of a \fBfetchmail\fP collection.  Suppose your name is
2565 \&'esr', and you want to both pick up your own mail and maintain a mailing
2566 list called (say) "fetchmail-friends", and you want to keep the alias
2567 list on your client machine.
2568 .PP
2569 On your server, you can alias 'fetchmail\-friends' to 'esr'; then, in
2570 your \fI.fetchmailrc\fP, declare 'to esr fetchmail\-friends here'.
2571 Then, when mail including 'fetchmail\-friends' as a local address
2572 gets fetched, the list name will be appended to the list of
2573 recipients your SMTP listener sees.  Therefore it will undergo alias
2574 expansion locally.  Be sure to include 'esr' in the local alias
2575 expansion of fetchmail\-friends, or you'll never see mail sent only to
2576 the list.  Also be sure that your listener has the "me-too" option set
2577 (sendmail's \-oXm command-line option or OXm declaration) so your name
2578 isn't removed from alias expansions in messages you send.
2579 .PP
2580 This trick is not without its problems, however.  You'll begin to see
2581 this when a message comes in that is addressed only to a mailing list
2582 you do \fInot\fP have declared as a local name.  Each such message
2583 will feature an 'X\-Fetchmail\-Warning' header which is generated
2584 because fetchmail cannot find a valid local name in the recipient
2585 addresses.  Such messages default (as was described above) to being
2586 sent to the local user running \fBfetchmail\fP, but the program has no
2587 way to know that that's actually the right thing.
2588
2589 .SS Bad Ways To Abuse Multidrop Mailboxes
2590 Multidrop mailboxes and
2591 \fBfetchmail\fP
2592 serving multiple users in daemon mode do not mix.  The problem, again, is
2593 mail from mailing lists, which typically does not have an individual
2594 recipient address on it.   Unless
2595 \fBfetchmail\fP
2596 can deduce an envelope address, such mail will only go to the account
2597 running fetchmail (probably root).  Also, blind-copied users are very
2598 likely never to see their mail at all.
2599 .PP
2600 If you're tempted to use
2601 \fBfetchmail\fP
2602 to retrieve mail for multiple users from a single mail drop via POP or
2603 IMAP, think again (and reread the section on header and envelope
2604 addresses above).  It would be smarter to just let the mail sit in the
2605 mailserver's queue and use fetchmail's ETRN or ODMR modes to trigger
2606 SMTP sends periodically (of course, this means you have to poll more
2607 frequently than the mailserver's expiry period).  If you can't arrange
2608 this, try setting up a UUCP feed.
2609 .PP
2610 If you absolutely \fImust\fP use multidrop for this purpose, make sure
2611 your mailserver writes an envelope-address header that fetchmail can
2612 see.  Otherwise you \fIwill\fP lose mail and it \fIwill\fP come back
2613 to haunt you.
2614
2615 .SS Speeding Up Multidrop Checking
2616 Normally, when multiple users are declared
2617 \fBfetchmail\fP
2618 extracts recipient addresses as described above and checks each host
2619 part with DNS to see if it's an alias of the mailserver.  If so, the
2620 name mappings described in the "to ... here" declaration are done and
2621 the mail locally delivered.
2622 .PP
2623 This is a convenient but also slow method.  To speed
2624 it up, pre-declare mailserver aliases with 'aka'; these are checked
2625 before DNS lookups are done.  If you're certain your aka list contains
2626 \fBall\fP
2627 DNS aliases of the mailserver (and all MX names pointing at it - note
2628 this may change in a future version)
2629 you can declare 'no dns' to suppress DNS lookups entirely and
2630 \fIonly\fP match against the aka list.
2631
2632 .SH SOCKS
2633 Support for socks4/5 is a \fBcompile time\fP configuration option. Once
2634 compiled in, fetchmail will always use the socks libraries and
2635 configuration on your system, there are no run-time switches in
2636 fetchmail - but you can still configure SOCKS: you can specify which
2637 SOCKS configuration file is used in the \fBSOCKS_CONF\fP environment
2638 variable.
2639
2640 For instance, if you wanted to bypass the SOCKS proxy altogether and
2641 have fetchmail connect directly, you could just pass
2642 SOCKS_CONF=/dev/null in the environment, for example (add your usual
2643 command line options - if any - to the end of this line):
2644
2645 .nf
2646 env SOCKS_CONF=/dev/null fetchmail
2647 .fi
2648
2649 .SH EXIT CODES
2650 To facilitate the use of
2651 \fBfetchmail\fP
2652 in shell scripts, an exit\ status code is returned to give an indication
2653 of what occurred during a given connection.
2654 .PP
2655 The exit codes returned by
2656 \fBfetchmail\fP
2657 are as follows:
2658 .IP 0
2659 One or more messages were successfully retrieved (or, if the \-c option
2660 was selected, were found waiting but not retrieved).
2661 .IP 1
2662 There was no mail awaiting retrieval.  (There may have been old mail still
2663 on the server but not selected for retrieval.) If you do not want "no
2664 mail" to be an error condition (for instance, for cron jobs), use a
2665 POSIX-compliant shell and add
2666
2667 .nf
2668 || [ $? \-eq 1 ]
2669 .fi
2670
2671 to the end of the fetchmail command line, note that this leaves 0
2672 untouched, maps 1 to 0, and maps all other codes to 1. See also item #C8
2673 in the FAQ.
2674 .IP 2
2675 An error was encountered when attempting to open a socket to retrieve
2676 mail.  If you don't know what a socket is, don't worry about it --
2677 just treat this as an 'unrecoverable error'.  This error can also be
2678 because a protocol fetchmail wants to use is not listed in /etc/services.
2679 .IP 3
2680 The user authentication step failed.  This usually means that a bad
2681 user-id, password, or APOP id was specified.  Or it may mean that you
2682 tried to run fetchmail under circumstances where it did not have
2683 standard input attached to a terminal and could not prompt for a
2684 missing password.
2685 .IP 4
2686 Some sort of fatal protocol error was detected.
2687 .IP 5
2688 There was a syntax error in the arguments to
2689 \fBfetchmail\fP, or a pre- or post-connect command failed.
2690 .IP 6
2691 The run control file had bad permissions.
2692 .IP 7
2693 There was an error condition reported by the server.  Can also
2694 fire if \fBfetchmail\fP timed out while waiting for the server.
2695 .IP 8
2696 Client-side exclusion error.  This means
2697 \fBfetchmail\fP
2698 either found another copy of itself already running, or failed in such
2699 a way that it isn't sure whether another copy is running.
2700 .IP 9
2701 The user authentication step failed because the server responded "lock
2702 busy".  Try again after a brief pause!  This error is not implemented
2703 for all protocols, nor for all servers.  If not implemented for your
2704 server, "3" will be returned instead, see above.  May be returned when
2705 talking to qpopper or other servers that can respond with "lock busy"
2706 or some similar text containing the word "lock".
2707 .IP 10
2708 The
2709 \fBfetchmail\fP
2710 run failed while trying to do an SMTP port open or transaction.
2711 .IP 11
2712 Fatal DNS error.  Fetchmail encountered an error while performing
2713 a DNS lookup at startup and could not proceed.
2714 .IP 12
2715 BSMTP batch file could not be opened.
2716 .IP 13
2717 Poll terminated by a fetch limit (see the \-\-fetchlimit option).
2718 .IP 14
2719 Server busy indication.
2720 .IP 23
2721 Internal error.  You should see a message on standard error with
2722 details.
2723 .IP "24 - 26, 28, 29"
2724 These are internal codes and should not appear externally.
2725 .PP
2726 When
2727 \fBfetchmail\fP
2728 queries more than one host, return status is 0 if \fIany\fP query
2729 successfully retrieved mail. Otherwise the returned error status is
2730 that of the last host queried.
2731
2732 .SH FILES
2733 .TP 5
2734 ~/.fetchmailrc
2735 default run control file
2736 .TP 5
2737 ~/.fetchids
2738 default location of file recording last message UIDs seen per host.
2739 .TP 5
2740 ~/.fetchmail.pid
2741 lock file to help prevent concurrent runs (non-root mode).
2742 .TP 5
2743 ~/.netrc
2744 your FTP run control file, which (if present) will be searched for
2745 passwords as a last resort before prompting for one interactively.
2746 .TP 5
2747 /var/run/fetchmail.pid
2748 lock file to help prevent concurrent runs (root mode, Linux systems).
2749 .TP 5
2750 /etc/fetchmail.pid
2751 lock file to help prevent concurrent runs (root mode, systems without /var/run).
2752
2753 .SH ENVIRONMENT
2754 .IP \fBFETCHMAILHOME\fP
2755 If this environment variable is set to a valid and
2756 existing directory name, fetchmail will read $FETCHMAILHOME/fetchmailrc
2757 (the dot is missing in this case), $FETCHMAILHOME/.fetchids and
2758 $FETCHMAILHOME/.fetchmail.pid rather than from the user's home
2759 directory.  The .netrc file is always looked for in the the invoking
2760 user's home directory regardless of FETCHMAILHOME's setting.
2761
2762 .IP \fBFETCHMAILUSER\fP
2763 If this environment variable is set, it is used as the name of the
2764 calling user (default local name) for purposes such as mailing error
2765 notifications.  Otherwise, if either the LOGNAME or USER variable is
2766 correctly set (e.g. the corresponding UID matches the session user ID)
2767 then that name is used as the default local name.  Otherwise
2768 \fBgetpwuid\fP(3) must be able to retrieve a password entry for the
2769 session ID (this elaborate logic is designed to handle the case of
2770 multiple names per userid gracefully).
2771
2772 .IP \fBFETCHMAIL_INCLUDE_DEFAULT_X509_CA_CERTS\fP
2773 (since v6.3.17):
2774 If this environment variable is set and not empty, fetchmail will always load
2775 the default X.509 trusted certificate locations for SSL/TLS CA certificates,
2776 even if \fB\-\-sslcertfile\fP and \fB\-\-sslcertpath\fP are given.  The latter locations take precedence over the system default locations.
2777 This is useful in case there are broken certificates in the system directories
2778 and the user has no administrator privileges to remedy the problem.
2779
2780 .IP \fBHOME_ETC\fP
2781 If the HOME_ETC variable is set, fetchmail will read
2782 $HOME_ETC/.fetchmailrc instead of ~/.fetchmailrc.
2783
2784 If HOME_ETC and FETCHMAILHOME are both set, HOME_ETC will be ignored.
2785
2786 .IP \fBSOCKS_CONF\fP
2787 (only if SOCKS support is compiled in) this variable is used by the
2788 socks library to find out which configuration file it should read. Set
2789 this to /dev/null to bypass the SOCKS proxy.
2790
2791 .SH SIGNALS
2792 If a \fBfetchmail\fP daemon is running as root, SIGUSR1 wakes it up from its
2793 sleep phase and forces a poll of all non-skipped servers. For compatibility
2794 reasons, SIGHUP can also be used in 6.3.X but may not be available in future
2795 fetchmail versions.
2796 .PP
2797 If \fBfetchmail\fP is running in daemon mode as non-root, use SIGUSR1 to wake
2798 it (this is so SIGHUP due to logout can retain the default action of killing
2799 it).
2800 .PP
2801 Running \fBfetchmail\fP in foreground while a background fetchmail is
2802 running will do whichever of these is appropriate to wake it up.
2803
2804 .SH BUGS AND KNOWN PROBLEMS
2805 .PP
2806 Please check the \fBNEWS\fP file that shipped with fetchmail for more
2807 known bugs than those listed here.
2808 .PP
2809 Fetchmail cannot handle user names that contain blanks after a "@"
2810 character, for instance "demonstr@ti on". These are rather uncommon and
2811 only hurt when using UID-based \-\-keep setups, so the 6.3.X versions of
2812 fetchmail won't be fixed.
2813 .PP
2814 The assumptions that the DNS and in particular the checkalias options
2815 make are not often sustainable. For instance, it has become uncommon for
2816 an MX server to be a POP3 or IMAP server at the same time. Therefore the
2817 MX lookups may go away in a future release.
2818 .PP
2819 The mda and plugin options interact badly.  In order to collect error
2820 status from the MDA, fetchmail has to change its normal signal
2821 handling so that dead plugin processes don't get reaped until the end
2822 of the poll cycle.  This can cause resource starvation if too many
2823 zombies accumulate.  So either don't deliver to a MDA using plugins or
2824 risk being overrun by an army of undead.
2825 .PP
2826 The \-\-interface option does not support IPv6 and it is doubtful if it
2827 ever will, since there is no portable way to query interface IPv6
2828 addresses.
2829 .PP
2830 The RFC822 address parser used in multidrop mode chokes on some
2831 @-addresses that are technically legal but bizarre.  Strange uses of
2832 quoting and embedded comments are likely to confuse it.
2833 .PP
2834 In a message with multiple envelope headers, only the last one
2835 processed will be visible to fetchmail.
2836 .PP
2837 Use of some of these protocols requires that the program send
2838 unencrypted passwords over the TCP/IP connection to the mailserver.
2839 This creates a risk that name/password pairs might be snaffled with a
2840 packet sniffer or more sophisticated monitoring software.  Under Linux
2841 and FreeBSD, the \-\-interface option can be used to restrict polling to
2842 availability of a specific interface device with a specific local or
2843 remote IP address, but snooping is still possible if (a) either host
2844 has a network device that can be opened in promiscuous mode, or (b)
2845 the intervening network link can be tapped.  We recommend the use of
2846 .BR ssh (1)
2847 tunnelling to not only shroud your passwords but encrypt the entire
2848 conversation.
2849 .PP
2850 Use of the %F or %T escapes in an mda option could open a security
2851 hole, because they pass text manipulable by an attacker to a shell
2852 command.  Potential shell characters are replaced by '_' before
2853 execution.  The hole is further reduced by the fact that fetchmail
2854 temporarily discards any suid privileges it may have while running the
2855 MDA.  For maximum safety, however, don't use an mda command containing
2856 %F or %T when fetchmail is run from the root account itself.
2857 .PP
2858 Fetchmail's method of sending bounces due to errors or spam-blocking and
2859 spam bounces requires that port 25 of localhost be available for sending
2860 mail via SMTP.
2861 .PP
2862 If you modify \fI~/.fetchmailrc\fP while a background instance is
2863 running and break the syntax, the background instance will die silently.
2864 Unfortunately, it can't die noisily because we don't yet know whether
2865 syslog should be enabled.  On some systems, fetchmail dies quietly even
2866 if there is no syntax error; this seems to have something to do with
2867 buggy terminal ioctl code in the kernel.
2868 .PP
2869 The \-f\~\- option (reading a configuration from stdin) is incompatible
2870 with the plugin option.
2871 .PP
2872 The 'principal' option only handles Kerberos IV, not V.
2873 .PP
2874 Interactively entered passwords are truncated after 63 characters. If
2875 you really need to use a longer password, you will have to use a
2876 configuration file.
2877 .PP
2878 A backslash as the last character of a configuration file will be
2879 flagged as a syntax error rather than ignored.
2880 .PP
2881 The BSMTP error handling is virtually nonexistent and may leave broken
2882 messages behind.
2883 .PP
2884 Send comments, bug reports, gripes, and the like to the
2885 .MTO "fetchmail-devel@lists.berlios.de" "fetchmail-devel list"
2886
2887 .PP
2888 An
2889 .URL "http://fetchmail.berlios.de/fetchmail-FAQ.html" "HTML FAQ"
2890 is available at the fetchmail home page, it should also accompany your
2891 installation.
2892
2893 .SH AUTHOR
2894 Fetchmail is currently maintained by Matthias Andree and Rob Funk with
2895 major assistance from Sunil Shetye (for code) and Rob MacGregor (for the
2896 mailing lists).
2897 .PP
2898 Most of the code is from
2899 .MTO esr@snark.thyrsus.com "Eric S. Raymond"
2900 \&.  Too many other people to name here have contributed code and patches.
2901 .PP
2902 This program is descended from and replaces
2903 .BR popclient ,
2904 by
2905 .MTO "ceharris@mal.com" "Carl Harris"
2906 \&; the internals have become quite different, but some of its interface
2907 design is directly traceable to that ancestral program.
2908 .PP
2909 This manual page has been improved by Matthias Andree, R.\ Hannes
2910 Beinert, and H\['e]ctor Garc\['i]a.
2911
2912 .SH SEE ALSO
2913 .PP
2914 .BR README ,
2915 .BR README.SSL ,
2916 .BR README.SSL-SERVER ,
2917 .URL "http://www.fetchmail.info/fetchmail-FAQ.html" "The Fetchmail FAQ" ,
2918 .BR mutt (1),
2919 .BR elm (1),
2920 .BR mail (1),
2921 .BR sendmail (8),
2922 .BR popd (8),
2923 .BR imapd (8),
2924 .BR netrc (5).
2925
2926 .PP
2927 .URL "http://fetchmail.berlios.de/" "The fetchmail home page."
2928
2929 .PP
2930 .URL "http://www.courier-mta.org/maildrop/" "The maildrop home page."
2931
2932 .SH APPLICABLE STANDARDS
2933 .PP
2934 Note that this list is just a collection of references and not a
2935 statement as to the actual protocol conformance or requirements in
2936 fetchmail.
2937 .TP 5
2938 SMTP/ESMTP:
2939 RFC 821, RFC 2821, RFC 1869, RFC 1652, RFC 1870, RFC 1983, RFC 1985,
2940 RFC 2554.
2941 .TP 5
2942 mail:
2943 RFC 822, RFC 2822, RFC 1123, RFC 1892, RFC 1894.
2944 .TP 5
2945 .TP 5
2946 POP3:
2947 RFC 1081, RFC 1225, RFC 1460, RFC 1725, RFC 1734, RFC 1939, RFC 1957,
2948 RFC 2195, RFC 2449.
2949 .TP 5
2950 APOP:
2951 RFC 1939.
2952 .TP 5
2953 RPOP:
2954 RFC 1081, RFC 1225.
2955 .TP 5
2956 IMAP2/IMAP2BIS:
2957 RFC 1176, RFC 1732.
2958 .TP 5
2959 IMAP4/IMAP4rev1:
2960 RFC 1730, RFC 1731, RFC 1732, RFC 2060, RFC 2061, RFC 2195, RFC 2177,
2961 RFC 2683.
2962 .TP 5
2963 ETRN:
2964 RFC 1985.
2965 .TP 5
2966 ODMR/ATRN:
2967 RFC 2645.
2968 .TP 5
2969 OTP:
2970 RFC 1938.
2971 .TP 5
2972 LMTP:
2973 RFC 2033.
2974 .TP 5
2975 GSSAPI:
2976 RFC 1508, RFC 1734,
2977 .URL http://www.iana.org/assignments/gssapi-service-names/ "Generic Security Service Application Program Interface (GSSAPI)/Kerberos/Simple Authentication and Security Layer (SASL) Service Names" . 
2978 .TP 5
2979 TLS:
2980 RFC 2595.