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