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