1fetchmail(1)              fetchmail reference manual              fetchmail(1)
2
3
4

NAME

6       fetchmail - fetch mail from a POP, IMAP, ETRN, or ODMR-capable server
7
8

SYNOPSIS

10       fetchmail [option...] [mailserver...]
11       fetchmailconf
12
13

DESCRIPTION

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 ⟨https://fetchmail.sourceforge.io/
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

PREFACE ON THIS MANUAL

133       Fetchmail's run-time strings have been translated (localized)  to  some
134       languages, but the manual is only available in English.  In some situa‐
135       tions, for comparing output to manual, it  may  be  helpful  to  switch
136       fetchmail  to  English  output  by overriding the locale variables, for
137       instance:
138
139
140              env LC_ALL=C fetchmail # add other options before the hash
141
142
143              env LANG=en fetchmail # other options before the hash
144
145       or similar. Details vary by operating system.
146
147

GENERAL OPERATION

149       The behavior of fetchmail is controlled by command-line options  and  a
150       run  control file, ~/.fetchmailrc, the syntax of which we describe in a
151       later section (this file is  what  the  fetchmailconf  program  edits).
152       Command-line options override ~/.fetchmailrc declarations.
153
154       Each  server name that you specify following the options on the command
155       line will be queried.  If you do not specify any servers on the command
156       line,  each  'poll'  entry in your ~/.fetchmailrc file will be queried,
157       unless the idle option is used, which see.
158
159       To facilitate the use of fetchmail in scripts and pipelines, it returns
160       an appropriate exit code upon termination -- see EXIT CODES below.
161
162       The  following  options modify the behavior of fetchmail.  It is seldom
163       necessary to specify any of these once you have a working  .fetchmailrc
164       file set up.
165
166       Almost  all  options  have a corresponding keyword which can be used to
167       declare them in a .fetchmailrc file.
168
169       Some special options are not covered here, but are  documented  instead
170       in sections on AUTHENTICATION and DAEMON MODE which follow.
171
172   General Options
173       -? | --help
174              Displays option help.
175
176       -V | --version
177              Displays the version information for your copy of fetchmail.  No
178              mail fetch is performed.  Instead, for  each  server  specified,
179              all  the  option information that would be computed if fetchmail
180              were connecting to that server is displayed.  Any non-printables
181              in  passwords  or other string names are shown as backslashed C-
182              like escape sequences.  This option is useful for verifying that
183              your options are set the way you want them.
184
185       -c | --check
186              Return  a status code to indicate whether there is mail waiting,
187              without actually fetching  or  deleting  mail  (see  EXIT  CODES
188              below).  This option turns off daemon mode (in which it would be
189              useless).  It doesn't play well with queries to multiple  sites,
190              and doesn't work with ETRN or ODMR.  It will return a false pos‐
191              itive if you leave read but undeleted mail in your server  mail‐
192              box  and  your  fetch protocol can't tell kept messages from new
193              ones.  This means it will work with IMAP, not  work  with  POP2,
194              and may occasionally flake out under POP3.
195
196       -s | --silent
197              Silent  mode.   Suppresses all progress/status messages that are
198              normally echoed to standard output during a fetch (but does  not
199              suppress actual error messages).  The --verbose option overrides
200              this.
201
202       -v | --verbose
203              Verbose mode.  All control messages passed between fetchmail and
204              the  mailserver are echoed to stdout.  Overrides --silent.  Dou‐
205              bling this option (-v -v) causes extra diagnostic information to
206              be printed.
207
208       --nosoftbounce
209              (since v6.3.10, Keyword: set no softbounce, since v6.3.10)
210              Hard  bounce  mode. All permanent delivery errors cause messages
211              to be deleted from the  upstream  server,  see  "no  softbounce"
212              below.
213
214       --softbounce
215              (since v6.3.10, Keyword: set softbounce, since v6.3.10)
216              Soft  bounce  mode. All permanent delivery errors cause messages
217              to be left on the upstream server if the protocol supports that.
218              This  option  is on by default to match historic fetchmail docu‐
219              mentation, and will be changed to hard bounce mode in  the  next
220              fetchmail release.
221
222   Disposal Options
223       -a | --all | (since v6.3.3) --fetchall
224              (Keyword: fetchall, since v3.0)
225              Retrieve  both  old (seen) and new messages from the mailserver.
226              The default is to fetch only messages the server has not  marked
227              seen.   Under  POP3,  this  option  also  forces the use of RETR
228              rather than TOP.  Note that POP2  retrieval  behaves  as  though
229              --all  is always on (see RETRIEVAL FAILURE MODES below) and this
230              option does not work with ETRN or ODMR.  While the -a and  --all
231              command-line and fetchall rcfile options have been supported for
232              a long time, the --fetchall command-line  option  was  added  in
233              v6.3.3.
234
235       -k | --keep
236              (Keyword: keep)
237              Keep  retrieved  messages  on  the remote mailserver.  Normally,
238              messages are deleted from the folder  on  the  mailserver  after
239              they  have  been  retrieved.   Specifying the keep option causes
240              retrieved messages to remain in your folder on  the  mailserver.
241              This  option does not work with ETRN or ODMR. If used with POP3,
242              it is recommended to also specify the --uidl option or uidl key‐
243              word.
244
245       -K | --nokeep
246              (Keyword: nokeep)
247              Delete  retrieved  messages  from  the  remote mailserver.  This
248              option forces retrieved mail to be deleted.  It may be useful if
249              you have specified a default of keep in your .fetchmailrc.  This
250              option is forced on with ETRN and ODMR.
251
252       -F | --flush
253              (Keyword: flush)
254              POP3/IMAP only.  This is a dangerous option and can  cause  mail
255              loss  when  used improperly. It deletes old (seen) messages from
256              the mailserver before retrieving new  messages.   Warning:  This
257              can  cause  mail  loss if you check your mail with other clients
258              than fetchmail, and cause fetchmail to delete a message  it  had
259              never  fetched  before.  It can also cause mail loss if the mail
260              server marks the message seen after retrieval  (IMAP2  servers).
261              You  should  probably  not use this option in your configuration
262              file. If you use it with POP3, you must use the  'uidl'  option.
263              What  you  probably  want  is  the default setting: if you don't
264              specify '-k', then fetchmail will automatically delete  messages
265              after successful delivery.
266
267       --limitflush
268              POP3/IMAP  only, since version 6.3.0.  Delete oversized messages
269              from the mailserver before retrieving  new  messages.  The  size
270              limit  should  be  separately specified with the --limit option.
271              This option does not work with ETRN or ODMR.
272
273   Protocol and Query Options
274       -p <proto> | --proto <proto> | --protocol <proto>
275              (Keyword: proto[col])
276              Specify the protocol to use when communicating with  the  remote
277              mailserver.   If  no protocol is specified, the default is AUTO.
278              proto may be one of the following:
279
280              AUTO   Tries IMAP, POP3, and POP2 (skipping  any  of  these  for
281                     which support has not been compiled in).
282
283              POP2   Post Office Protocol 2 (legacy, to be removed from future
284                     release)
285
286              POP3   Post Office Protocol 3
287
288              APOP   Use POP3 with old-fashioned MD5-challenge authentication.
289                     Considered not resistant to man-in-the-middle attacks.
290
291              RPOP   Use POP3 with RPOP authentication.
292
293              KPOP   Use POP3 with Kerberos V4 authentication on port 1109.
294
295              SDPS   Use POP3 with Demon Internet's SDPS extensions.
296
297              IMAP   IMAP2bis,  IMAP4,  or  IMAP4rev1 (fetchmail automatically
298                     detects their capabilities).
299
300              ETRN   Use the ESMTP ETRN option.
301
302              ODMR   Use the the On-Demand Mail Relay ESMTP profile.
303
304       All these alternatives work in basically the  same  way  (communicating
305       with standard server daemons to fetch mail already delivered to a mail‐
306       box on the server) except ETRN and ODMR.  The ETRN mode allows  you  to
307       ask  a compliant ESMTP server (such as BSD sendmail at release 8.8.0 or
308       higher) to immediately open a sender-SMTP  connection  to  your  client
309       machine and begin forwarding any items addressed to your client machine
310       in the server's queue of undelivered mail.   The ODMR mode requires  an
311       ODMR-capable  server  and  works similarly to ETRN, except that it does
312       not require the client machine to have a static DNS.
313
314       -U | --uidl
315              (Keyword: uidl)
316              Force UIDL use (effective only with  POP3).   Force  client-side
317              tracking  of  'newness'  of messages (UIDL stands for "unique ID
318              listing" and is described in RFC1939).  Use with 'keep' to use a
319              mailbox  as a baby news drop for a group of users. The fact that
320              seen messages are skipped is logged,  unless  error  logging  is
321              done  through  syslog  while  running in daemon mode.  Note that
322              fetchmail may automatically  enable  this  option  depending  on
323              upstream server capabilities.  Note also that this option may be
324              removed and forced enabled in a future  fetchmail  version.  See
325              also: --idfile.
326
327       --idle (since 6.3.3)
328              (Keyword: idle, since before 6.0.0)
329              Enable IDLE use (effective only with IMAP). Note that this works
330              with only one account and one folder  at  a  given  time,  other
331              folders  or  accounts will not be polled when idle is in effect!
332              While the idle rcfile keyword had  been  supported  for  a  long
333              time, the --idle command-line option was added in version 6.3.3.
334              IDLE use means that fetchmail tells  the  IMAP  server  to  send
335              notice  of  new  messages,  so they can be retrieved sooner than
336              would be possible with regular polls.
337
338       -P <portnumber> | --service <servicename>
339              (Keyword: service) Since version 6.3.0.
340              The service option permits you to specify a service name to con‐
341              nect  to.   You  can specify a decimal port number here, if your
342              services database lacks the required  service-port  assignments.
343              See  the  FAQ  item R12 and the --ssl documentation for details.
344              This replaces the older --port option.
345
346       --port <portnumber>
347              (Keyword: port)
348              Obsolete version of --service that does not take service  names.
349              Note: this option may be removed from a future version.
350
351       --principal <principal>
352              (Keyword: principal)
353              The  principal option permits you to specify a service principal
354              for mutual authentication.  This is applicable to POP3  or  IMAP
355              with  Kerberos 4 authentication only.  It does not apply to Ker‐
356              beros 5 or GSSAPI.  This option  may  be  removed  in  a  future
357              fetchmail version.
358
359       -t <seconds> | --timeout <seconds>
360              (Keyword: timeout)
361              The  timeout option allows you to set a server-nonresponse time‐
362              out in seconds.  If a mailserver does not send a  greeting  mes‐
363              sage  or  respond  to  commands for the given number of seconds,
364              fetchmail will drop the connection to it.  Without such a  time‐
365              out  fetchmail  might  hang  until the TCP connection times out,
366              trying to fetch mail from a down host, which may be  very  long.
367              This  would  be particularly annoying for a fetchmail running in
368              the background.  There is a default timeout which  fetchmail  -V
369              will  report.   If a given connection receives too many timeouts
370              in succession, fetchmail will consider it wedged and stop retry‐
371              ing.   The  calling  user will be notified by email if this hap‐
372              pens.
373
374              Beginning with fetchmail 6.3.10, the SMTP client uses the recom‐
375              mended  minimum  timeouts  from  RFC-5321  while waiting for the
376              SMTP/LMTP server it is talking to.  You can raise  the  timeouts
377              even  more,  but  you  cannot  shorten  them. This is to avoid a
378              painful situation where fetchmail has  been  configured  with  a
379              short  timeout  (a  minute  or less), ships a long message (many
380              MBytes) to the local MTA, which then takes longer  than  timeout
381              to  respond  "OK", which it eventually will; that would mean the
382              mail gets delivered properly, but fetchmail cannot notice it and
383              will thus refetch this big message over and over again.
384
385       --plugin <command>
386              (Keyword: plugin)
387              The  plugin  option  allows  you  to  use an external program to
388              establish the TCP connection.  This is useful if you want to use
389              ssh,  or  need some special firewalling setup.  The program will
390              be looked up in $PATH and can optionally be passed the  hostname
391              and  port  as  arguments  using "%h" and "%p" respectively (note
392              that the interpolation logic  is  rather  primitive,  and  these
393              tokens  must  be bounded by whitespace or beginning of string or
394              end of string).  Fetchmail will write to the plugin's stdin  and
395              read from the plugin's stdout.
396
397       --plugout <command>
398              (Keyword: plugout)
399              Identical  to  the plugin option above, but this one is used for
400              the SMTP connections.
401
402       -r <name> | --folder <name>
403              (Keyword: folder[s])
404              Causes a specified non-default mail folder on the mailserver (or
405              comma-separated list of folders) to be retrieved.  The syntax of
406              the folder name is server-dependent.  This option is not  avail‐
407              able under POP3, ETRN, or ODMR.
408
409       --tracepolls
410              (Keyword: tracepolls)
411              Tell  fetchmail  to  poll trace information in the form 'polling
412              account %s' and 'folder %s' to the Received line  it  generates,
413              where  the  %s parts are replaced by the user's remote name, the
414              poll label,  and  the  folder  (mailbox)  where  available  (the
415              Received  header also normally includes the server's true name).
416              This can be used to  facilitate  mail  filtering  based  on  the
417              account  it  is  being  received from. The folder information is
418              written only since version 6.3.4.
419
420       --ssl  (Keyword: ssl)
421              Causes the connection to the mail server  to  be  encrypted  via
422              SSL,  by  negotiating SSL directly after connecting (SSL-wrapped
423              mode).  Please see the description of  --sslproto  below!   More
424              information  is available in the README.SSL file that ships with
425              fetchmail.
426
427              Note that even if this option is omitted,  fetchmail  may  still
428              negotiate  SSL  in-band  for  POP3  or IMAP, through the STLS or
429              STARTTLS feature.  You can use the --sslproto option  to  modify
430              that behavior.
431
432              If no port is specified, the connection is attempted to the well
433              known port of the SSL version of the  base  protocol.   This  is
434              generally a different port than the port used by the base proto‐
435              col.  For IMAP, this is port 143 for the clear protocol and port
436              993  for  the SSL secured protocol; for POP3, it is port 110 for
437              the clear text and port 995 for the encrypted variant.
438
439              If your system lacks the corresponding  entries  from  /etc/ser‐
440              vices,  see  the  --service  option and specify the numeric port
441              number as given in the previous paragraph (unless your  ISP  had
442              directed you to different ports, which is uncommon however).
443
444       --sslcert <name>
445              (Keyword: sslcert)
446              For certificate-based client authentication.  Some SSL encrypted
447              servers require client side keys and certificates for  authenti‐
448              cation.   In  most  cases, this is optional.  This specifies the
449              location of the public key certificate to be  presented  to  the
450              server  at  the  time the SSL session is established.  It is not
451              required (but may be provided) if the server  does  not  require
452              it.   It  may  be the same file as the private key (combined key
453              and certificate file) but this  is  not  recommended.  Also  see
454              --sslkey below.
455
456              NOTE: If you use client authentication, the user name is fetched
457              from the certificate's CommonName and  overrides  the  name  set
458              with --user.
459
460       --sslkey <name>
461              (Keyword: sslkey)
462              Specifies  the  file  name  of  the client side private SSL key.
463              Some SSL encrypted servers require client side keys and certifi‐
464              cates  for  authentication.   In  most  cases, this is optional.
465              This specifies the location of the  private  key  used  to  sign
466              transactions  with  the  server  at  the time the SSL session is
467              established.  It is not required (but may be  provided)  if  the
468              server  does not require it. It may be the same file as the pub‐
469              lic key (combined key and certificate file) but this is not rec‐
470              ommended.
471
472              If a password is required to unlock the key, it will be prompted
473              for at the time just prior to establishing the  session  to  the
474              server.  This can cause some complications in daemon mode.
475
476              Also see --sslcert above.
477
478       --sslproto <value>
479              (Keyword: sslproto, NOTE: semantic changes since v6.4.0)
480              This option has a dual use, out of historic fetchmail behaviour.
481              It controls both the SSL/TLS protocol version and, if  --ssl  is
482              not specified, the STARTTLS behaviour (upgrading the protocol to
483              an SSL or TLS connection in-band). Some other options  may  how‐
484              ever make TLS mandatory.
485
486       Only  if  this option and --ssl are both missing for a poll, there will
487       be opportunistic TLS for POP3 and IMAP, where fetchmail will attempt to
488       upgrade to TLSv1 or newer.
489
490       Recognized  values  for --sslproto are given below. You should normally
491       chose one of the auto-negotiating options, i. e. 'auto' or one  of  the
492       options  ending in a plus (+) character. Note that depending on OpenSSL
493       library version and configuration, some options cause  run-time  errors
494       because the requested SSL or TLS versions are not supported by the par‐
495       ticular installed OpenSSL library.
496
497              '', the empty string
498                     Disable STARTTLS. If --ssl is given for the same  server,
499                     log  an  error  and  pretend  that  'auto'  had been used
500                     instead.
501
502              'auto' (default).  Since  v6.4.0.  Require  TLS.  Auto-negotiate
503                     TLSv1  or  newer,  disable  SSLv3  downgrade.  (fetchmail
504                     6.3.26 and older have auto-negotiated all protocols  that
505                     their  OpenSSL  library  supported,  including the broken
506                     SSLv3).
507
508              'SSL23'
509                     see 'auto'.
510
511              'SSL3' Require SSLv3 exactly. SSLv3 is broken, not supported  on
512                     all systems, avoid it if possible.  This will make fetch‐
513                     mail negotiate SSLv3 only, and is the  only  way  besides
514                     'SSL3+' to have fetchmail 6.4.0 or newer permit SSLv3.
515
516              'SSL3+'
517                     same  as  'auto',  but  permit SSLv3 as well. This is the
518                     only way besides 'SSL3' to have fetchmail 6.4.0 or  newer
519                     permit SSLv3.
520
521              'TLS1' Require  TLSv1. This does not negotiate TLSv1.1 or newer,
522                     and is discouraged. Replace by TLS1+  unless  the  latter
523                     chokes your server.
524
525              'TLS1+'
526                     Since v6.4.0. See 'auto'.
527
528              'TLS1.1'
529                     Since v6.4.0. Require TLS v1.1 exactly.
530
531              'TLS1.1+'
532                     Since  v6.4.0.  Require  TLS.  Auto-negotiate  TLSv1.1 or
533                     newer.
534
535              'TLS1.2'
536                     Since v6.4.0. Require TLS v1.2 exactly.
537
538              'TLS1.2+'
539                     Since v6.4.0.  Require  TLS.  Auto-negotiate  TLSv1.2  or
540                     newer.
541
542              'TLS1.3'
543                     Since v6.4.0. Require TLS v1.3 exactly.
544
545              'TLS1.3+'
546                     Since  v6.4.0.  Require  TLS.  Auto-negotiate  TLSv1.3 or
547                     newer.
548
549              Unrecognized parameters
550                     are treated the same as 'auto'.
551
552              NOTE: you should hardly ever need to use anything other than  ''
553              (to force an unencrypted connection) or 'auto' (to enforce TLS).
554
555       --sslcertck
556              (Keyword: sslcertck, default enabled since v6.4.0)
557              --sslcertck causes fetchmail to require that SSL/TLS be used and
558              disconnect if it can not successfully negotiate SSL or  TLS,  or
559              if  it  cannot  successfully verify and validate the certificate
560              and follow it to a trust anchor (or trusted  root  certificate).
561              The  trust  anchors are given as a set of local trusted certifi‐
562              cates (see the sslcertfile  and  sslcertpath  options).  If  the
563              server certificate cannot be obtained or is not signed by one of
564              the trusted ones (directly or indirectly), fetchmail  will  dis‐
565              connect, regardless of the sslfingerprint option.
566
567              Note  that CRL (certificate revocation lists) are only supported
568              in OpenSSL 0.9.7 and newer! Your system  clock  should  also  be
569              reasonably accurate when using this option.
570
571       --nosslcertck
572              (Keyword: no sslcertck, only in v6.4.X)
573              The  opposite  of  --sslcertck, this is a discouraged option. It
574              permits fetchmail to continue connecting even if the server cer‐
575              tificate  failed  the  verification checks.  Should only be used
576              together with --sslfingerprint.
577
578       --sslcertfile <file>
579              (Keyword: sslcertfile, since v6.3.17)
580              Sets the file fetchmail uses to look up local certificates.  The
581              default  is  empty.  This can be given in addition to --sslcert‐
582              path below, and certificates specified in --sslcertfile will  be
583              processed before those in --sslcertpath.  The option can be used
584              in addition to --sslcertpath.
585
586              The file is a  text  file.  It  contains  the  concatenation  of
587              trusted CA certificates in PEM format.
588
589              Note  that  using  this option will suppress loading the default
590              SSL trusted CA certificates file unless you set the  environment
591              variable  FETCHMAIL_INCLUDE_DEFAULT_X509_CA_CERTS to a non-empty
592              value.
593
594       --sslcertpath <directory>
595              (Keyword: sslcertpath)
596              Sets the directory fetchmail uses to look up local certificates.
597              The  default  is  your  OpenSSL default directory. The directory
598              must be hashed the way OpenSSL expects it - every time  you  add
599              or  modify  a  certificate in the directory, you need to use the
600              c_rehash tool (which comes with OpenSSL in the tools/  subdirec‐
601              tory).  Also,  after  OpenSSL  upgrades,  you  may  need  to run
602              c_rehash; particularly when upgrading from 0.9.X to 1.0.0.
603
604              This can be given in addition to --sslcertfile above, which  see
605              for precedence rules.
606
607              Note that using this option will suppress adding the default SSL
608              trusted CA certificates directory unless you set the environment
609              variable  FETCHMAIL_INCLUDE_DEFAULT_X509_CA_CERTS to a non-empty
610              value.
611
612       --sslcommonname <common name>
613              (Keyword: sslcommonname; since v6.3.9)
614              Use of this option is discouraged. Before using it, contact  the
615              administrator  of  your upstream server and ask for a proper SSL
616              certificate to be used. If that cannot be attained, this  option
617              can  be  used  to  specify  the name (CommonName) that fetchmail
618              expects on  the  server  certificate.   A  correctly  configured
619              server  will  have  this  set  to  the  hostname  by which it is
620              reached, and by default fetchmail will expect as much. Use  this
621              option  when the CommonName is set to some other value, to avoid
622              the "Server  CommonName  mismatch"  warning,  and  only  if  the
623              upstream server can't be made to use proper certificates.
624
625       --sslfingerprint <fingerprint>
626              (Keyword: sslfingerprint)
627              Specify  the  fingerprint  of the server key (an MD5 hash of the
628              key) in hexadecimal notation with colons  separating  groups  of
629              two digits. The letter hex digits must be in upper case. This is
630              the format that fetchmail uses to report the fingerprint when an
631              SSL connection is established. When this is specified, fetchmail
632              will compare the server key fingerprint with the given one,  and
633              the connection will fail if they do not match, regardless of the
634              sslcertck setting. The connection will also  fail  if  fetchmail
635              cannot  obtain  an SSL certificate from the server.  This can be
636              used to prevent man-in-the-middle attacks, but the finger  print
637              from the server must be obtained or verified over a secure chan‐
638              nel, and certainly not over the same  Internet  connection  that
639              fetchmail would use.
640
641              Using this option will prevent printing certificate verification
642              errors as long as --nosslcertck is in effect.
643
644              To obtain the fingerprint of a certificate stored  in  the  file
645              cert.pem, try:
646
647                   openssl x509 -in cert.pem -noout -md5 -fingerprint
648
649              For details, see x509(1ssl).
650
651   Delivery Control Options
652       -S <hosts> | --smtphost <hosts>
653              (Keyword: smtp[host])
654              Specify  a  hunt  list  of hosts to forward mail to (one or more
655              hostnames, comma-separated). Hosts are tried in list order;  the
656              first  one that is up becomes the forwarding target for the cur‐
657              rent run.  If this option is not specified, 'localhost' is  used
658              as  the default.  Each hostname may have a port number following
659              the host name.  The port number is separated from the host  name
660              by a slash; the default port is "smtp".  If you specify an abso‐
661              lute path name (beginning with a /), it will be  interpreted  as
662              the name of a UNIX socket accepting LMTP connections (such as is
663              supported by the Cyrus IMAP daemon) Example:
664
665                   --smtphost server1,server2/2525,server3,/var/imap/socket/lmtp
666
667              This option can be used with ODMR, and  will  make  fetchmail  a
668              relay between the ODMR server and SMTP or LMTP receiver.
669
670              WARNING:  if  you use address numeric IP addresses here, be sure
671              to use --smtpaddress or --smtpname (either of which see) with  a
672              valid SMTP address literal!
673
674       --fetchdomains <hosts>
675              (Keyword: fetchdomains)
676              In  ETRN or ODMR mode, this option specifies the list of domains
677              the server should ship mail for once the  connection  is  turned
678              around.   The  default is the FQDN of the machine running fetch‐
679              mail.
680
681       -D <domain> | --smtpaddress <domain>
682              (Keyword: smtpaddress)
683              Specify the domain to be appended to addresses in RCPT TO  lines
684              shipped  to  SMTP.  When  this is not specified, the name of the
685              SMTP server (as specified by --smtphost) is used  for  SMTP/LMTP
686              and 'localhost' is used for UNIX socket/BSMTP.
687
688              NOTE:  if  you  intend  to  use  numeric addresses, or so-called
689              address literals per the SMTP standard,  write  them  in  proper
690              SMTP  syntax, for instance --smtpaddress "[192.0.2.6]" or --smt‐
691              paddress "[IPv6:2001:DB8::6]".
692
693       --smtpname <user@domain>
694              (Keyword: smtpname)
695              Specify the domain and user to be put in RCPT TO  lines  shipped
696              to  SMTP.   The  default  user is the current local user. Please
697              also see the  NOTE  about  --smtpaddress  and  address  literals
698              above.
699
700       -Z <nnn> | --antispam <nnn[, nnn]...>
701              (Keyword: antispam)
702              Specifies  the list of numeric SMTP errors that are to be inter‐
703              preted as a spam-block response from the listener.  A  value  of
704              -1  disables this option.  For the command-line option, the list
705              values should be comma-separated.  Note that the antispam values
706              only  apply  to "MAIL FROM" responses in the SMTP/LMTP dialogue,
707              but several MTAs (Postfix in its default  configuration,  qmail)
708              defer  the  anti-spam  response  code  until  after the RCPT TO.
709              --antispam does not  work  in  these  circumstances.   Also  see
710              --softbounce (default) and its inverse.
711
712       -m <command> | --mda <command>
713              (Keyword: mda)
714              This option lets fetchmail use a Message or Local Delivery Agent
715              (MDA or LDA) directly, rather than forward via SMTP or LMTP.
716
717              To avoid losing mail, use this option only with MDAs like  mail‐
718              drop  or  MTAs  like sendmail that exit with a nonzero status on
719              disk-full and other delivery errors; the  nonzero  status  tells
720              fetchmail  that  delivery  failed  and prevents the message from
721              being deleted on the server.
722
723              If fetchmail is running as root,  it  sets  its  user  id  while
724              delivering  mail  through  an MDA as follows:  First, the FETCH‐
725              MAILUSER, LOGNAME, and USER environment variables are checked in
726              this  order.  The value of the first variable from his list that
727              is defined (even if it is empty!) is looked  up  in  the  system
728              user  database.  If  none of the variables is defined, fetchmail
729              will use the real user id it was started with.  If  one  of  the
730              variables  was  defined,  but the user stated there isn't found,
731              fetchmail continues running as root, without checking  remaining
732              variables  on the list.  Practically, this means that if you run
733              fetchmail as root (not recommended), it is most useful to define
734              the  FETCHMAILUSER environment variable to set the user that the
735              MDA should run as. Some MDAs (such as maildrop) are designed  to
736              be  setuid  root  and  setuid to the recipient's user id, so you
737              don't lose functionality this way even when running fetchmail as
738              unprivileged user.  Check the MDA's manual for details.
739
740              Some  possible  MDAs  are  "/usr/sbin/sendmail  -i  -f %F -- %T"
741              (Note: some several older or vendor sendmail versions mistake --
742              for  an address, rather than an indicator to mark the end of the
743              option arguments), "/usr/bin/deliver" and "/usr/bin/maildrop  -d
744              %T".   Local  delivery  addresses  will be inserted into the MDA
745              command wherever you place a %T; the mail message's From address
746              will be inserted where you place an %F.
747
748              Do  NOT  enclose the %F or %T string in single quotes!  For both
749              %T and %F, fetchmail encloses the  addresses  in  single  quotes
750              ('),  after  removing any single quotes they may contain, before
751              the MDA command is passed to the shell.
752
753              Do NOT use an MDA invocation that dispatches on the contents  of
754              To/Cc/Bcc, like "sendmail -i -t" or "qmail-inject", it will cre‐
755              ate mail loops and bring the just wrath of many postmasters down
756              upon  your head.  This is one of the most frequent configuration
757              errors!
758
759              Also, do not try to combine multidrop mode with an MDA  such  as
760              maildrop  that can only accept one address, unless your upstream
761              stores one copy of the message per recipient and transports  the
762              envelope recipient in a header; you will lose mail.
763
764              The  well-known  procmail(1)  package  is very hard to configure
765              properly, it has a very nasty "fall through to  the  next  rule"
766              behavior on delivery errors (even temporary ones, such as out of
767              disk space if another user's  mail  daemon  copies  the  mailbox
768              around  to  purge old messages), so your mail will end up in the
769              wrong mailbox sooner or later. The proper procmail configuration
770              is outside the scope of this document. Using maildrop(1) is usu‐
771              ally much easier, and many users find the filter syntax used  by
772              maildrop easier to understand.
773
774              Finally,  we  strongly  advise that you do not use qmail-inject.
775              The command line interface  is  non-standard  without  providing
776              benefits  for  typical  use,  and fetchmail makes no attempts to
777              accommodate qmail-inject's deviations from the standard. Some of
778              qmail-inject's command-line and environment options are actually
779              dangerous and can cause broken threads,  non-detected  duplicate
780              messages and forwarding loops.
781
782
783       --lmtp (Keyword: lmtp)
784              Cause  delivery via LMTP (Local Mail Transfer Protocol).  A ser‐
785              vice host and port must be explicitly specified on each host  in
786              the  smtphost  hunt list (see above) if this option is selected;
787              the default port 25 will (in accordance with RFC  2033)  not  be
788              accepted.
789
790       --bsmtp <filename>
791              (Keyword: bsmtp)
792              Append  fetched  mail to a BSMTP file.  This simply contains the
793              SMTP commands that would normally be generated by fetchmail when
794              passing mail to an SMTP listener daemon.
795
796              An  argument of '-' causes the SMTP batch to be written to stan‐
797              dard output, which is of limited use: this only makes sense  for
798              debugging, because fetchmail's regular output is interspersed on
799              the same channel, so this isn't suitable for mail delivery. This
800              special mode may be removed in a later release.
801
802              Note  that  fetchmail's  reconstruction of MAIL FROM and RCPT TO
803              lines is not guaranteed correct; the caveats discussed under THE
804              USE AND ABUSE OF MULTIDROP MAILBOXES below apply.  This mode has
805              precedence before --mda and SMTP/LMTP.
806
807       --bad-header {reject|accept}
808              (Keyword: bad-header; since v6.3.15)
809              Specify how fetchmail is supposed to  treat  messages  with  bad
810              headers, i. e. headers with bad syntax. Traditionally, fetchmail
811              has rejected  such  messages,  but  some  distributors  modified
812              fetchmail  to accept them. You can now configure fetchmail's be‐
813              haviour per server.
814
815
816   Resource Limit Control Options
817       -l <maxbytes> | --limit <maxbytes>
818              (Keyword: limit)
819              Takes a maximum octet size argument, where 0 is the default  and
820              also the special value designating "no limit".  If nonzero, mes‐
821              sages larger than this size will not be fetched and will be left
822              on  the  server  (in  foreground sessions, the progress messages
823              will note that they are "oversized").   If  the  fetch  protocol
824              permits  (in particular, under IMAP or POP3 without the fetchall
825              option) the message will not be marked seen.
826
827              An explicit --limit of 0 overrides any limits set  in  your  run
828              control  file.  This  option  is  intended  for those needing to
829              strictly control fetch time due to expensive and variable  phone
830              rates.
831
832              Combined  with  --limitflush, it can be used to delete oversized
833              messages waiting on a server.  In daemon mode, oversize  notifi‐
834              cations  are  mailed  to  the  calling  user (see the --warnings
835              option). This option does not work with ETRN or ODMR.
836
837       -w <interval> | --warnings <interval>
838              (Keyword: warnings)
839              Takes an interval in seconds.  When you call  fetchmail  with  a
840              'limit'  option  in  daemon  mode, this controls the interval at
841              which warnings about oversized messages are mailed to the  call‐
842              ing  user  (or  the  user specified by the 'postmaster' option).
843              One such notification is always mailed at the  end  of  the  the
844              first  poll that the oversized message is detected.  Thereafter,
845              re-notification is suppressed until after the  warning  interval
846              elapses  (it  will  take place at the end of the first following
847              poll).
848
849       -b <count> | --batchlimit <count>
850              (Keyword: batchlimit)
851              Specify the maximum number of messages that will be  shipped  to
852              an SMTP listener before the connection is deliberately torn down
853              and rebuilt (defaults to 0,  meaning  no  limit).   An  explicit
854              --batchlimit  of  0 overrides any limits set in your run control
855              file.  While sendmail(8) normally initiates delivery of  a  mes‐
856              sage  immediately  after  receiving the message terminator, some
857              SMTP listeners are not so prompt.  MTAs like smail(8)  may  wait
858              till the delivery socket is shut down to deliver.  This may pro‐
859              duce annoying delays when fetchmail  is  processing  very  large
860              batches.  Setting the batch limit to some nonzero size will pre‐
861              vent these delays.  This option does not work with ETRN or ODMR.
862
863       -B <number> | --fetchlimit <number>
864              (Keyword: fetchlimit)
865              Limit the number of messages accepted from a given server  in  a
866              single poll.  By default there is no limit. An explicit --fetch‐
867              limit of 0 overrides any limits set in your  run  control  file.
868              This option does not work with ETRN or ODMR.
869
870       --fetchsizelimit <number>
871              (Keyword: fetchsizelimit)
872              Limit  the  number  of  sizes  of messages accepted from a given
873              server in a single transaction.  This option is useful in reduc‐
874              ing  the  delay in downloading the first mail when there are too
875              many mails in the mailbox.  By default, the limit  is  100.   If
876              set  to  0,  sizes  of all messages are downloaded at the start.
877              This option does not work with ETRN or ODMR.  For POP3, the only
878              valid non-zero value is 1.
879
880       --fastuidl <number>
881              (Keyword: fastuidl)
882              Do  a  binary instead of linear search for the first unseen UID.
883              Binary search avoids downloading the UIDs  of  all  mails.  This
884              saves  time  (especially  in  daemon mode) where downloading the
885              same set of UIDs in each poll is a waste of bandwidth. The  num‐
886              ber  'n' indicates how rarely a linear search should be done. In
887              daemon mode, linear search  is  used  once  followed  by  binary
888              searches  in 'n-1' polls if 'n' is greater than 1; binary search
889              is always used if 'n' is 1; linear search is always used if  'n'
890              is  0.  In  non-daemon  mode, binary search is used if 'n' is 1;
891              otherwise linear search is used. The default value of 'n' is  4.
892              This option works with POP3 only.
893
894       -e <count> | --expunge <count>
895              (Keyword: expunge)
896              Arrange  for  deletions to be made final after a given number of
897              messages.  Under POP2 or POP3, fetchmail cannot  make  deletions
898              final  without  sending QUIT and ending the session -- with this
899              option on, fetchmail will break a long  mail  retrieval  session
900              into multiple sub-sessions, sending QUIT after each sub-session.
901              This is a good defense  against  line  drops  on  POP3  servers.
902              Under  IMAP,  fetchmail normally issues an EXPUNGE command after
903              each deletion in order to force the deletion to be done  immedi‐
904              ately.   This  is  safest  when your connection to the server is
905              flaky and expensive, as it avoids resending duplicate mail after
906              a  line  hit.   However,  on large mailboxes the overhead of re-
907              indexing after every message can slam the server pretty hard, so
908              if  your  connection  is reliable it is good to do expunges less
909              frequently.  Also note that some servers enforce a  delay  of  a
910              few seconds after each quit, so fetchmail may not be able to get
911              back in immediately after an expunge -- you may see "lock  busy"
912              errors if this happens. If you specify this option to an integer
913              N, it tells fetchmail  to  only  issue  expunges  on  every  Nth
914              delete.  An argument of zero suppresses expunges entirely (so no
915              expunges at all will be done until the end of run).  This option
916              does not work with ETRN or ODMR.
917
918
919   Authentication Options
920       -u <name> | --user <name> | --username <name>
921              (Keyword: user[name])
922              Specifies  the user identification to be used when logging in to
923              the mailserver.  The appropriate  user  identification  is  both
924              server  and  user-dependent.   The default is your login name on
925              the client machine that is running fetchmail.  See USER  AUTHEN‐
926              TICATION below for a complete description.
927
928       -I <specification> | --interface <specification>
929              (Keyword: interface)
930              Require  that  a specific interface device be up and have a spe‐
931              cific local or remote IPv4 (IPv6 is not supported by this option
932              yet) address (or range) before polling.  Frequently fetchmail is
933              used over a transient  point-to-point  TCP/IP  link  established
934              directly  to a mailserver via SLIP or PPP.  That is a relatively
935              secure channel.  But when other TCP/IP routes to the  mailserver
936              exist  (e.g.  when  the  link is connected to an alternate ISP),
937              your username and password may be vulnerable to snooping  (espe‐
938              cially when daemon mode automatically polls for mail, shipping a
939              clear password over the  net  at  predictable  intervals).   The
940              --interface option may be used to prevent this.  When the speci‐
941              fied link is not up  or  is  not  connected  to  a  matching  IP
942              address, polling will be skipped.  The format is:
943
944                   interface/iii.iii.iii.iii[/mmm.mmm.mmm.mmm]
945
946              The  field  before  the  first slash is the interface name (i.e.
947              sl0, ppp0 etc.).  The field  before  the  second  slash  is  the
948              acceptable  IP  address.   The field after the second slash is a
949              mask which specifies a range of IP addresses to accept.   If  no
950              mask  is  present  255.255.255.255  is  assumed  (i.e.  an exact
951              match).  This option is currently only supported under Linux and
952              FreeBSD.  Please  see  the monitor section for below for FreeBSD
953              specific information.
954
955              Note that this option may be removed  from  a  future  fetchmail
956              version.
957
958       -M <interface> | --monitor <interface>
959              (Keyword: monitor)
960              Daemon  mode  can  cause transient links which are automatically
961              taken down after a period of  inactivity  (e.g.  PPP  links)  to
962              remain  up indefinitely.  This option identifies a system TCP/IP
963              interface to be monitored for activity.  After each poll  inter‐
964              val, if the link is up but no other activity has occurred on the
965              link, then the poll will be skipped.  However, when fetchmail is
966              woken  up by a signal, the monitor check is skipped and the poll
967              goes through unconditionally.  This  option  is  currently  only
968              supported  under  Linux and FreeBSD.  For the monitor and inter‐
969              face options to work for  non  root  users  under  FreeBSD,  the
970              fetchmail  binary  must be installed SGID kmem.  This would be a
971              security hole, but fetchmail runs with the effective GID set  to
972              that  of  the  kmem group only when interface data is being col‐
973              lected.
974
975              Note that this option may be removed  from  a  future  fetchmail
976              version.
977
978       --auth <type>
979              (Keyword: auth[enticate])
980              This  option  permits you to specify an authentication type (see
981              USER AUTHENTICATION below for details).  The possible values are
982              any,  password,  kerberos_v5,  kerberos  (or,  for  excruciating
983              exactness, kerberos_v4), gssapi, cram-md5, otp, ntlm, msn  (only
984              for POP3), external (only IMAP) and ssh.  When any (the default)
985              is specified, fetchmail tries first methods that don't require a
986              password  (EXTERNAL,  GSSAPI,  KERBEROS IV, KERBEROS 5); then it
987              looks for methods that mask your password (CRAM-MD5, NTLM, X-OTP
988              - note that MSN is only supported for POP3, but not autoprobed);
989              and only if the server doesn't support any of those will it ship
990              your password en clair.  Other values may be used to force vari‐
991              ous authentication methods (ssh suppresses authentication and is
992              thus useful for IMAP PREAUTH).  (external suppresses authentica‐
993              tion and is thus useful for IMAP  EXTERNAL).   Any  value  other
994              than password, cram-md5, ntlm, msn or otp suppresses fetchmail's
995              normal inquiry for a password.  Specify ssh when you  are  using
996              an  end-to-end  secure connection such as an ssh tunnel; specify
997              external when you use TLS with client authentication and specify
998              gssapi  or  kerberos_v4 if you are using a protocol variant that
999              employs GSSAPI or  K4.   Choosing  KPOP  protocol  automatically
1000              selects Kerberos authentication.  This option does not work with
1001              ETRN.  GSSAPI service names are in line with RFC-2743  and  IANA
1002              registrations, see Generic Security Service Application Program
1003              Interface (GSSAPI)/Kerberos/Simple Authentication and Security
1004              Layer (SASL) Service Names ⟨https://www.iana.org/assignments/
1005              gssapi-service-names/⟩.
1006
1007   Miscellaneous Options
1008       -f <pathname> | --fetchmailrc <pathname>
1009              Specify a non-default name for the  ~/.fetchmailrc  run  control
1010              file.   The pathname argument must be either "-" (a single dash,
1011              meaning to read the configuration  from  standard  input)  or  a
1012              filename.   Unless the --version option is also on, a named file
1013              argument  must  have  permissions  no  more   open   than   0700
1014              (u=rwx,g=,o=) or else be /dev/null.
1015
1016       -i <pathname> | --idfile <pathname>
1017              (Keyword: idfile)
1018              Specify  an  alternate  name for the .fetchids file used to save
1019              message UIDs. NOTE: since fetchmail 6.3.0, write access  to  the
1020              directory containing the idfile is required, as fetchmail writes
1021              a temporary file and renames it  into  the  place  of  the  real
1022              idfile only if the temporary file has been written successfully.
1023              This avoids the truncation of idfiles when running out  of  disk
1024              space.
1025
1026       --pidfile <pathname>
1027              (Keyword: pidfile; since fetchmail v6.3.4)
1028              Override  the default location of the PID file that is used as a
1029              lock file.  Default: see "ENVIRONMENT"  below.  Note  that  many
1030              places  in  the  code and documentation, the term "lock file" is
1031              used.  This file contains the process ID of the  running  fetch‐
1032              mail  on the first line and potentially the daemon interval on a
1033              second line.
1034
1035       -n | --norewrite
1036              (Keyword: no rewrite)
1037              Normally, fetchmail edits RFC-822 address headers (To, From, Cc,
1038              Bcc, and Reply-To) in fetched mail so that any mail IDs local to
1039              the server are expanded to full addresses (@ and the  mailserver
1040              hostname  are  appended).  This enables replies on the client to
1041              get addressed correctly (otherwise your mailer might think  they
1042              should  be  addressed  to  local  users on the client machine!).
1043              This option disables the rewrite.  (This option is  provided  to
1044              pacify  people  who  are  paranoid about having an MTA edit mail
1045              headers and want to know they can prevent it, but it  is  gener‐
1046              ally  not a good idea to actually turn off rewrite.)  When using
1047              ETRN or ODMR, the rewrite option is ineffective.
1048
1049       -E <line> | --envelope <line>
1050              (Keyword: envelope; Multidrop only)
1051              In the configuration file, an enhanced syntax is used:
1052              envelope [<count>] <line>
1053
1054              This option changes the header fetchmail assumes  will  carry  a
1055              copy  of the mail's envelope address.  Normally this is 'X-Enve‐
1056              lope-To'.  Other  typically  found  headers  to  carry  envelope
1057              information  are 'X-Original-To' and 'Delivered-To'.  Now, since
1058              these headers are not standardized,  practice  varies.  See  the
1059              discussion  of  multidrop  address handling below.  As a special
1060              case, 'envelope "Received"' enables  parsing  of  sendmail-style
1061              Received lines.  This is the default, but discouraged because it
1062              is not fully reliable.
1063
1064              Note that fetchmail expects the Received-line to be  in  a  spe‐
1065              cific  format: It must contain "by host for address", where host
1066              must match one of the mailserver names that fetchmail recognizes
1067              for the account in question.
1068
1069              The optional count argument (only available in the configuration
1070              file) determines how many header lines of this kind are skipped.
1071              A  count of 1 means: skip the first, take the second. A count of
1072              2 means: skip the first and second, take the third, and so on.
1073
1074       -Q <prefix> | --qvirtual <prefix>
1075              (Keyword: qvirtual; Multidrop only)
1076              The string prefix assigned to this option will be  removed  from
1077              the  user  name  found in the header specified with the envelope
1078              option (before  doing  multidrop  name  mapping  or  localdomain
1079              checking, if either is applicable). This option is useful if you
1080              are using fetchmail to collect the mail for an entire domain and
1081              your  ISP  (or  your  mail redirection provider) is using qmail.
1082              One of the basic features of qmail is the Delivered-To:  message
1083              header.  Whenever qmail delivers a message to a local mailbox it
1084              puts the username and hostname of the envelope recipient on this
1085              line.   The  major reason for this is to prevent mail loops.  To
1086              set up qmail to batch mail for a disconnected site the ISP-mail‐
1087              host will have normally put that site in its 'Virtualhosts' con‐
1088              trol file so it will add a prefix to all mail addresses for this
1089              site.  This  results  in  mail  sent to 'username@userhost.user‐
1090              dom.dom.com' having a Delivered-To: line of the form:
1091
1092              Delivered-To: mbox-userstr-username@userhost.example.com
1093
1094              The ISP can make the 'mbox-userstr-' prefix anything they choose
1095              but  a  string  matching the user host name is likely.  By using
1096              the option 'envelope Delivered-To:' you can make fetchmail reli‐
1097              ably  identify  the original envelope recipient, but you have to
1098              strip the 'mbox-userstr-' prefix to deliver to the correct user.
1099              This is what this option is for.
1100
1101       --configdump
1102              Parse   the  ~/.fetchmailrc  file,  interpret  any  command-line
1103              options specified, and dump a configuration report  to  standard
1104              output.  The configuration report is a data structure assignment
1105              in the language Python.  This option is meant to be used with an
1106              interactive ~/.fetchmailrc editor like fetchmailconf, written in
1107              Python.
1108
1109       -y | --yydebug
1110              Enables parser debugging, this option is meant  to  be  used  by
1111              developers only.
1112
1113
1114   Removed Options
1115       -T | --netsec
1116              Removed before version 6.3.0, the required underlying inet6_apps
1117              library had been discontinued and is no longer available.
1118
1119

USER AUTHENTICATION AND ENCRYPTION

1121       All modes except ETRN require  authentication  of  the  client  to  the
1122       server.   Normal user authentication in fetchmail is very much like the
1123       authentication mechanism of ftp(1).  The correct user-id  and  password
1124       depend upon the underlying security system at the mailserver.
1125
1126       If  the mailserver is a Unix machine on which you have an ordinary user
1127       account, your regular login name and password are used with  fetchmail.
1128       If  you  use  the  same  login  name  on both the server and the client
1129       machines, you needn't worry about specifying  a  user-id  with  the  -u
1130       option  -- the default behavior is to use your login name on the client
1131       machine as the user-id on the server machine.  If you use  a  different
1132       login  name  on the server machine, specify that login name with the -u
1133       option.  e.g. if your login name is 'jsmith' on a machine named  'mail‐
1134       grunt', you would start fetchmail as follows:
1135
1136              fetchmail -u jsmith mailgrunt
1137
1138       The  default behavior of fetchmail is to prompt you for your mailserver
1139       password before the connection is established.  This is the safest  way
1140       to  use  fetchmail  and  ensures that your password will not be compro‐
1141       mised.  You may also specify your password in your ~/.fetchmailrc file.
1142       This is convenient when using fetchmail in daemon mode or with scripts.
1143
1144
1145   Using netrc files
1146       If you do not specify a password, and fetchmail cannot extract one from
1147       your ~/.fetchmailrc file, it will look for a ~/.netrc file in your home
1148       directory before requesting one interactively; if an entry matching the
1149       mailserver is found in that file, the password will be used.  Fetchmail
1150       first looks for a match on poll name; if it finds none, it checks for a
1151       match on via name.  See the ftp(1) man page for details of  the  syntax
1152       of the ~/.netrc file.  To show a practical example, a .netrc might look
1153       like this:
1154
1155              machine hermes.example.org
1156              login joe
1157              password topsecret
1158
1159       You can repeat this block with different user information if  you  need
1160       to provide more than one password.
1161
1162       This feature may allow you to avoid duplicating password information in
1163       more than one file.
1164
1165       On mailservers that do not provide ordinary user accounts, your user-id
1166       and  password are usually assigned by the server administrator when you
1167       apply for a mailbox on the server.  Contact your  server  administrator
1168       if  you  don't  know  the correct user-id and password for your mailbox
1169       account.
1170

POP3 VARIANTS

1172       Early versions of POP3 (RFC1081, RFC1225) supported  a  crude  form  of
1173       independent  authentication  using  the  .rhosts file on the mailserver
1174       side.  Under this RPOP variant, a fixed per-user  ID  equivalent  to  a
1175       password  was  sent  in  clear over a link to a reserved port, with the
1176       command RPOP rather than PASS to alert the server  that  it  should  do
1177       special  checking.   RPOP  is  supported  by fetchmail (you can specify
1178       'protocol RPOP' to have the program send 'RPOP' rather than 'PASS') but
1179       its  use  is  strongly  discouraged, and support will be removed from a
1180       future fetchmail version.  This facility was vulnerable to spoofing and
1181       was withdrawn in RFC1460.
1182
1183       RFC1460  introduced  APOP authentication.  In this variant of POP3, you
1184       register an APOP password on your server host  (on  some  servers,  the
1185       program to do this is called popauth(8)).  You put the same password in
1186       your ~/.fetchmailrc file.  Each time fetchmail logs in, it sends an MD5
1187       hash of your password and the server greeting time to the server, which
1188       can verify it by checking its authorization database.
1189
1190       Note that APOP is no longer considered  resistant  against  man-in-the-
1191       middle attacks.
1192
1193   RETR or TOP
1194       fetchmail  makes  some  efforts to make the server believe messages had
1195       not been retrieved, by using the TOP command with  a  large  number  of
1196       lines  when  possible.  TOP is a command that retrieves the full header
1197       and a fetchmail-specified amount of body  lines.  It  is  optional  and
1198       therefore  not implemented by all servers, and some are known to imple‐
1199       ment it improperly. On many servers however,  the  RETR  command  which
1200       retrieves  the  full message with header and body, sets the "seen" flag
1201       (for instance, in a web interface), whereas the TOP command does not do
1202       that.
1203
1204       fetchmail  will  always  use  the  RETR  command  if "fetchall" is set.
1205       fetchmail will also use the RETR command if "keep" is set and "uidl" is
1206       unset.   Finally,  fetchmail  will  use the RETR command on Maillennium
1207       POP3/PROXY servers (used by Comcast) to avoid a deliberate  TOP  misin‐
1208       terpretation in this server that causes message corruption.
1209
1210       In  all  other  cases, fetchmail will use the TOP command. This implies
1211       that in "keep" setups, "uidl" must be set if "TOP" is desired.
1212
1213       Note that this description is true for the current  version  of  fetch‐
1214       mail,  but  the  behavior may change in future versions. In particular,
1215       fetchmail may prefer the RETR command because the  TOP  command  causes
1216       much grief on some servers and is only optional.
1217

ALTERNATE AUTHENTICATION FORMS

1219       If  your fetchmail was built with Kerberos support and you specify Ker‐
1220       beros authentication (either with --auth  or  the  .fetchmailrc  option
1221       authenticate kerberos_v4) it will try to get a Kerberos ticket from the
1222       mailserver at the start of each query.  Note: if either the pollname or
1223       via  name  is 'hesiod', fetchmail will try to use Hesiod to look up the
1224       mailserver.
1225
1226       If you use POP3 or IMAP  with  GSSAPI  authentication,  fetchmail  will
1227       expect  the  server to have RFC1731- or RFC1734-conforming GSSAPI capa‐
1228       bility, and will use it.  Currently this has only been tested over Ker‐
1229       beros  V,  so you're expected to already have a ticket-granting ticket.
1230       You may pass a username different from your principal  name  using  the
1231       standard --user command or by the .fetchmailrc option user.
1232
1233       If  your IMAP daemon returns the PREAUTH response in its greeting line,
1234       fetchmail will notice this and skip  the  normal  authentication  step.
1235       This  can  be useful, e.g. if you start imapd explicitly using ssh.  In
1236       this case you can declare the authentication value 'ssh' on  that  site
1237       entry  to stop .fetchmail from asking you for a password when it starts
1238       up.
1239
1240       If you use client authentication with TLS1 and your IMAP daemon returns
1241       the AUTH=EXTERNAL response, fetchmail will notice this and will use the
1242       authentication shortcut and will not send the passphrase. In this  case
1243       you can declare the authentication value 'external'
1244        on  that site to stop fetchmail from asking you for a password when it
1245       starts up.
1246
1247       If you are using POP3, and the server issues a one-time-password  chal‐
1248       lenge conforming to RFC1938, fetchmail will use your password as a pass
1249       phrase to generate the required response. This avoids  sending  secrets
1250       over the net unencrypted.
1251
1252       Compuserve's  RPA  authentication  is  supported. If you compile in the
1253       support, fetchmail will try to perform an RPA  pass-phrase  authentica‐
1254       tion instead of sending over the password en clair if it detects "@com‐
1255       puserve.com" in the hostname.
1256
1257       If you are using IMAP, Microsoft's NTLM authentication (used by  Micro‐
1258       soft  Exchange)  is supported. If you compile in the support, fetchmail
1259       will try to perform an NTLM authentication (instead of sending over the
1260       password  en  clair) whenever the server returns AUTH=NTLM in its capa‐
1261       bility  response.  Specify  a  user  option  value  that   looks   like
1262       'user@domain':  the  part  to  the  left of the @ will be passed as the
1263       username and the part to the right as the NTLM domain.
1264
1265
1266   Secure Socket Layers (SSL) and Transport Layer Security (TLS)
1267       All retrieval protocols can use SSL or TLS wrapping for the  transport.
1268       Additionally,  POP3  and  IMAP  retrival  can also negotiate SSL/TLS by
1269       means of STARTTLS (or STLS).
1270
1271       Note that fetchmail currently uses the OpenSSL library,  which  is  se‐
1272       verely underdocumented, so failures may occur just because the program‐
1273       mers are not aware of OpenSSL's requirement of the day.  For  instance,
1274       since  v6.3.16,  fetchmail calls OpenSSL_add_all_algorithms(), which is
1275       necessary to support certificates using SHA256 on OpenSSL 0.9.8 -- this
1276       information  is deeply hidden in the documentation and not at all obvi‐
1277       ous.  Please do not hesitate to report subtle SSL failures.
1278
1279       You can access SSL encrypted services by specifying the options  start‐
1280       ing  with  --ssl,  such  as --ssl, --sslproto, --sslcertck, and others.
1281       You can also do this  using  the  corresponding  user  options  in  the
1282       .fetchmailrc  file.  Some services, such as POP3 and IMAP, have differ‐
1283       ent well known ports defined  for  the  SSL  encrypted  services.   The
1284       encrypted  ports will be selected automatically when SSL is enabled and
1285       no explicit port is specified.   Also, the --sslcertck command line  or
1286       sslcertck  run  control file option should be used to force strict cer‐
1287       tificate checking with older fetchmail versions - see below.
1288
1289       If SSL is not configured, fetchmail will usually opportunistically  try
1290       to  use STARTTLS. STARTTLS can be enforced by using --sslproto auto and
1291       defeated by using --sslproto ''.  TLS connections use the same port  as
1292       the  unencrypted  version of the protocol and negotiate TLS via special
1293       command. The --sslcertck command line or  sslcertck  run  control  file
1294       option should be used to force strict certificate checking - see below.
1295
1296       --sslcertck  is recommended: When connecting to an SSL or TLS encrypted
1297       server, the server presents a certificate to the client for validation.
1298       The  certificate  is checked to verify that the common name in the cer‐
1299       tificate matches the name of the server being contacted  and  that  the
1300       effective  and  expiration dates in the certificate indicate that it is
1301       currently valid.  If any of these checks fail,  a  warning  message  is
1302       printed, but the connection continues.  The server certificate does not
1303       need to be signed by any specific Certifying Authority  and  may  be  a
1304       "self-signed"  certificate.  If  the --sslcertck command line option or
1305       sslcertck run control file option is used, fetchmail will instead abort
1306       if  any  of  these  checks fail, because it must assume that there is a
1307       man-in-the-middle attack in this scenario,  hence  fetchmail  must  not
1308       expose  cleartext passwords. Use of the sslcertck or --sslcertck option
1309       is therefore advised; it has become the default in fetchmail 6.4.0.
1310
1311       Some SSL encrypted servers may request a client  side  certificate.   A
1312       client  side  public  SSL certificate and private SSL key may be speci‐
1313       fied.  If requested by the server, the client certificate  is  sent  to
1314       the  server  for  validation.   Some servers may require a valid client
1315       certificate and may refuse connections if a certificate is not provided
1316       or  if  the  certificate is not valid.  Some servers may require client
1317       side certificates be signed by a recognized Certifying Authority.   The
1318       format  for the key files and the certificate files is that required by
1319       the underlying SSL libraries (OpenSSL in the general case).
1320
1321       A word of care about the use of SSL: While above mentioned  setup  with
1322       self-signed  server  certificates  retrieved over the wires can protect
1323       you from a passive eavesdropper, it  doesn't  help  against  an  active
1324       attacker.  It's  clearly  an  improvement over sending the passwords in
1325       clear, but you should be aware that a man-in-the-middle attack is triv‐
1326       ially possible (in particular with tools such as dsniff ⟨https://
1327       monkey.org/~dugsong/dsniff/⟩, ).  Use of  strict  certificate  checking
1328       with a certification authority recognized by server and client, or per‐
1329       haps of an SSH tunnel (see below for some examples)  is  preferable  if
1330       you care seriously about the security of your mailbox and passwords.
1331
1332
1333   ESMTP AUTH
1334       fetchmail  also  supports  authentication  to  the  ESMTP server on the
1335       client side according to RFC 2554.  You  can  specify  a  name/password
1336       pair  to be used with the keywords 'esmtpname' and 'esmtppassword'; the
1337       former defaults to the username of the calling user.
1338
1339

DAEMON MODE

1341   Introducing the daemon mode
1342       In daemon mode, fetchmail puts itself into the background and runs for‐
1343       ever,  querying  each  specified  host  and  then  sleeping for a given
1344       polling interval.
1345
1346   Starting the daemon mode
1347       There are several ways to make fetchmail work in daemon  mode.  On  the
1348       command  line,  --daemon <interval> or -d <interval> option runs fetch‐
1349       mail in daemon mode.  You must specify a numeric argument  which  is  a
1350       polling interval (time to wait after completing a whole poll cycle with
1351       the last server and before starting the next poll cycle with the  first
1352       server) in seconds.
1353
1354       Example: simply invoking
1355
1356              fetchmail -d 900
1357
1358       will,  therefore,  poll  all the hosts described in your ~/.fetchmailrc
1359       file (except those explicitly excluded with the 'skip' verb) a bit less
1360       often  than  once every 15 minutes (exactly: 15 minutes + time that the
1361       poll takes).
1362
1363       It is also possible to set a polling interval  in  your  ~/.fetchmailrc
1364       file  by saying 'set daemon <interval>', where <interval> is an integer
1365       number of seconds.  If you do this, fetchmail will always start in dae‐
1366       mon mode unless you override it with the command-line option --daemon 0
1367       or -d0.
1368
1369       Only one daemon process is permitted per user; in daemon  mode,  fetch‐
1370       mail  sets  up a per-user lockfile to guarantee this.  (You can however
1371       cheat and set the FETCHMAILHOME environment variable to  overcome  this
1372       setting,  but  in that case, it is your responsibility to make sure you
1373       aren't polling the same server with two processes at the same time.)
1374
1375   Awakening the background daemon
1376       Normally, calling fetchmail with a daemon in  the  background  sends  a
1377       wake-up  signal  to the daemon and quits without output. The background
1378       daemon then starts its next poll cycle immediately.  The  wake-up  sig‐
1379       nal, SIGUSR1, can also be sent manually. The wake-up action also clears
1380       any 'wedged' flags indicating  that  connections  have  wedged  due  to
1381       failed authentication or multiple timeouts.
1382
1383   Terminating the background daemon
1384       The  option  -q or --quit will kill a running daemon process instead of
1385       waking it up (if there is no such process, fetchmail will notify  you).
1386       If  the  --quit option appears last on the command line, fetchmail will
1387       kill the running daemon process and  then  quit.  Otherwise,  fetchmail
1388       will first kill a running daemon process and then continue running with
1389       the other options.
1390
1391   Useful options for daemon mode
1392       The -L <filename> or --logfile <filename> option (keyword: set logfile)
1393       is  only  effective when fetchmail is detached and in daemon mode. Note
1394       that the logfile must exist before fetchmail is run, you  can  use  the
1395       touch(1) command with the filename as its sole argument to create it.
1396       This  option  allows  you  to redirect status messages into a specified
1397       logfile (follow the option with the  logfile  name).   The  logfile  is
1398       opened  for  append, so previous messages aren't deleted.  This is pri‐
1399       marily useful for debugging configurations. Note  that  fetchmail  does
1400       not  detect  if the logfile is rotated, the logfile is only opened once
1401       when fetchmail starts. You need to restart fetchmail after rotating the
1402       logfile and before compressing it (if applicable).
1403
1404       The --syslog option (keyword: set syslog) allows you to redirect status
1405       and error messages emitted to the syslog(3) system daemon if available.
1406       Messages are logged with an id of fetchmail, the facility LOG_MAIL, and
1407       priorities LOG_ERR, LOG_ALERT or LOG_INFO.  This option is intended for
1408       logging status and error messages which indicate the status of the dae‐
1409       mon and the results while fetching mail from the server(s).  Error mes‐
1410       sages  for  command  line options and parsing the .fetchmailrc file are
1411       still written to stderr, or to the specified log file.  The  --nosyslog
1412       option  turns  off  use  of  syslog(3),  assuming it's turned on in the
1413       ~/.fetchmailrc file.  This option is overridden, in certain situations,
1414       by --logfile (which see).
1415
1416       The  -N or --nodetach option suppresses backgrounding and detachment of
1417       the daemon process from its  control  terminal.   This  is  useful  for
1418       debugging  or  when fetchmail runs as the child of a supervisor process
1419       such as init(8) or Gerrit Pape's runit(8).  Note that this also  causes
1420       the logfile option to be ignored.
1421
1422       Note  that  while  running  in  daemon  mode polling a POP2 or IMAP2bis
1423       server, transient errors (such as DNS  failures  or  sendmail  delivery
1424       refusals) may force the fetchall option on for the duration of the next
1425       polling cycle.  This is a robustness feature.  It means that if a  mes‐
1426       sage is fetched (and thus marked seen by the mailserver) but not deliv‐
1427       ered locally due to some transient error, it will be re-fetched  during
1428       the  next  poll  cycle.   (The IMAP logic doesn't delete messages until
1429       they're delivered, so this problem does not arise.)
1430
1431       If you touch or change the ~/.fetchmailrc file while fetchmail is  run‐
1432       ning in daemon mode, this will be detected at the beginning of the next
1433       poll cycle.  When  a  changed  ~/.fetchmailrc  is  detected,  fetchmail
1434       rereads  it and restarts from scratch (using exec(2); no state informa‐
1435       tion is retained in the new instance).  Note that if fetchmail needs to
1436       query  for  passwords,  of  that if you break the ~/.fetchmailrc file's
1437       syntax, the new instance  will  softly  and  silently  vanish  away  on
1438       startup.
1439
1440

ADMINISTRATIVE OPTIONS

1442       The  --postmaster <name> option (keyword: set postmaster) specifies the
1443       last-resort username to which multidrop mail is to be forwarded  if  no
1444       matching  local  recipient can be found. It is also used as destination
1445       of undeliverable mail if the 'bouncemail'  global  option  is  off  and
1446       additionally for spam-blocked mail if the 'bouncemail' global option is
1447       off and the 'spambounce' global option is on. This option  defaults  to
1448       the user who invoked fetchmail.  If the invoking user is root, then the
1449       default of this option is the user 'postmaster'.  Setting postmaster to
1450       the  empty string causes such mail as described above to be discarded -
1451       this however is usually a bad idea.  See also the  description  of  the
1452       'FETCHMAILUSER' environment variable in the ENVIRONMENT section below.
1453
1454       The  --nobounce  behaves  like  the  "set no bouncemail" global option,
1455       which see.
1456
1457       The --invisible option (keyword: set invisible) tries to make fetchmail
1458       invisible.   Normally, fetchmail behaves like any other MTA would -- it
1459       generates a Received header into each message describing its  place  in
1460       the  chain  of  transmission, and tells the MTA it forwards to that the
1461       mail came from the machine fetchmail itself  is  running  on.   If  the
1462       invisible option is on, the Received header is suppressed and fetchmail
1463       tries to spoof the MTA it forwards to into thinking  it  came  directly
1464       from the mailserver host.
1465
1466       The  --showdots option (keyword: set showdots) forces fetchmail to show
1467       progress dots even if the output goes to a file or fetchmail is not  in
1468       verbose  mode.   Fetchmail shows the dots by default when run in --ver‐
1469       bose mode and output  goes  to  console.  This  option  is  ignored  in
1470       --silent mode.
1471
1472       By  specifying  the  --tracepolls  option, you can ask fetchmail to add
1473       information to the Received header on the form "polling {label} account
1474       {user}", where {label} is the account label (from the specified rcfile,
1475       normally ~/.fetchmailrc) and {user} is the username which  is  used  to
1476       log  on  to  the mail server. This header can be used to make filtering
1477       email where no useful header information is available and you want mail
1478       from  different  accounts  sorted into different mailboxes (this could,
1479       for example, occur if you have an account on the same server running  a
1480       mailing  list,  and are subscribed to the list using that account). The
1481       default is not adding any such header.  In .fetchmailrc, this is called
1482       'tracepolls'.
1483
1484

RETRIEVAL FAILURE MODES

1486       The protocols fetchmail uses to talk to mailservers are next to bullet‐
1487       proof.  In normal operation forwarding to port 25, no message  is  ever
1488       deleted  (or  even marked for deletion) on the host until the SMTP lis‐
1489       tener on the client side has acknowledged to fetchmail that the message
1490       has been either accepted for delivery or rejected due to a spam block.
1491
1492       When forwarding to an MDA, however, there is more possibility of error.
1493       Some MDAs are 'safe' and reliably return a nonzero status on any deliv‐
1494       ery  error, even one due to temporary resource limits.  The maildrop(1)
1495       program is like this; so are most programs designed as  mail  transport
1496       agents,  such as sendmail(1), including the sendmail wrapper of Postfix
1497       and exim(1).  These programs give back a reliable positive acknowledge‐
1498       ment  and  can  be  used with the mda option with no risk of mail loss.
1499       Unsafe MDAs, though, may return 0 even on delivery  failure.   If  this
1500       happens, you will lose mail.
1501
1502       The normal mode of fetchmail is to try to download only 'new' messages,
1503       leaving untouched  (and  undeleted)  messages  you  have  already  read
1504       directly  on  the server (or fetched with a previous fetchmail --keep).
1505       But you may find that messages you've already read on  the  server  are
1506       being  fetched  (and deleted) even when you don't specify --all.  There
1507       are several reasons this can happen.
1508
1509       One could be that you're using POP2.  The  POP2  protocol  includes  no
1510       representation  of  'new' or 'old' state in messages, so fetchmail must
1511       treat all messages as new all the time.  But POP2 is obsolete, so  this
1512       is unlikely.
1513
1514       A  potential  POP3 problem might be servers that insert messages in the
1515       middle of mailboxes (some VMS implementations of mail are rumored to do
1516       this).   The  fetchmail  code assumes that new messages are appended to
1517       the end of the mailbox; when this is not true it  may  treat  some  old
1518       messages  as  new and vice versa.  Using UIDL whilst setting fastuidl 0
1519       might fix this, otherwise, consider switching to IMAP.
1520
1521       Yet another POP3 problem is that if they can't make  tempfiles  in  the
1522       user's home directory, some POP3 servers will hand back an undocumented
1523       response that causes fetchmail to spuriously report "No mail".
1524
1525       The IMAP code uses the presence or absence of the server flag \Seen  to
1526       decide  whether or not a message is new.  This isn't the right thing to
1527       do, fetchmail should check the UIDVALIDITY and use UID, but it  doesn't
1528       do  that  yet.  Under Unix, it counts on your IMAP server to notice the
1529       BSD-style Status flags set by mail user agents and set the  \Seen  flag
1530       from  them when appropriate.  All Unix IMAP servers we know of do this,
1531       though it's not specified by the IMAP RFCs.  If you ever  trip  over  a
1532       server that doesn't, the symptom will be that messages you have already
1533       read on your host will look new to  the  server.   In  this  (unlikely)
1534       case,  only  messages  you  fetched  with fetchmail --keep will be both
1535       undeleted and marked old.
1536
1537       In ETRN and ODMR modes, fetchmail does not actually retrieve  messages;
1538       instead,  it  asks the server's SMTP listener to start a queue flush to
1539       the client via SMTP.  Therefore it sends only undelivered messages.
1540
1541

SPAM FILTERING

1543       Many SMTP listeners allow administrators to set up 'spam filters'  that
1544       block  unsolicited  email  from specified domains.  A MAIL FROM or DATA
1545       line that triggers this feature will  elicit  an  SMTP  response  which
1546       (unfortunately) varies according to the listener.
1547
1548       Newer versions of sendmail return an error code of 571.
1549
1550       According  to RFC2821, the correct thing to return in this situation is
1551       550 "Requested action not taken: mailbox unavailable" (the  draft  adds
1552       "[E.g.,  mailbox  not  found, no access, or command rejected for policy
1553       reasons].").
1554
1555       Older versions of the exim MTA return 501 "Syntax error  in  parameters
1556       or arguments".
1557
1558       The postfix MTA runs 554 as an antispam response.
1559
1560       Zmailer  may  reject  code with a 500 response (followed by an enhanced
1561       status code that contains more information).
1562
1563       Return codes which fetchmail treats as antispam responses and  discards
1564       the  message can be set with the 'antispam' option.  This is one of the
1565       only three circumstance under which fetchmail ever discards  mail  (the
1566       others  are the 552 and 553 errors described below, and the suppression
1567       of multidropped messages with a message-ID already seen).
1568
1569       If fetchmail is fetching from an IMAP  server,  the  antispam  response
1570       will be detected and the message rejected immediately after the headers
1571       have been fetched, without reading the message body.  Thus,  you  won't
1572       pay for downloading spam message bodies.
1573
1574       By default, the list of antispam responses is empty.
1575
1576       If  the spambounce global option is on, mail that is spam-blocked trig‐
1577       gers an RFC1892/RFC1894 bounce message informing the originator that we
1578       do not accept mail from it. See also BUGS.
1579
1580

SMTP/ESMTP ERROR HANDLING

1582       Besides  the  spam-blocking  described  above,  fetchmail takes special
1583       actions — that may be modified by the --softbounce option — on the fol‐
1584       lowing SMTP/ESMTP error response codes
1585
1586       452 (insufficient system storage)
1587            Leave the message in the server mailbox for later retrieval.
1588
1589       552 (message exceeds fixed maximum message size)
1590            Delete the message from the server.  Send bounce-mail to the orig‐
1591            inator.
1592
1593       553 (invalid sending domain)
1594            Delete the message from  the  server.   Don't  even  try  to  send
1595            bounce-mail to the originator.
1596
1597       Other  errors  greater  or equal to 500 trigger bounce mail back to the
1598       originator, unless suppressed by --softbounce. See also BUGS.
1599
1600

THE RUN CONTROL FILE

1602       The preferred way to set up fetchmail is to write a  .fetchmailrc  file
1603       in  your  home directory (you may do this directly, with a text editor,
1604       or indirectly via fetchmailconf).  When there is a conflict between the
1605       command-line arguments and the arguments in this file, the command-line
1606       arguments take precedence.
1607
1608       To protect the security of your passwords, your ~/.fetchmailrc may  not
1609       normally  have more than 0700 (u=rwx,g=,o=) permissions; fetchmail will
1610       complain and exit otherwise (this check is suppressed when --version is
1611       on).
1612
1613       You may read the .fetchmailrc file as a list of commands to be executed
1614       when fetchmail is called with no arguments.
1615
1616   Run Control Syntax
1617       Comments begin with a '#' and extend through the end of the line.  Oth‐
1618       erwise the file consists of a series of server entries or global option
1619       statements in a free-format, token-oriented syntax.
1620
1621       There are four kinds of tokens: grammar keywords, numbers (i.e. decimal
1622       digit  sequences),  unquoted  strings,  and  quoted  strings.  A quoted
1623       string is bounded by double quotes  and  may  contain  whitespace  (and
1624       quoted  digits are treated as a string).  Note that quoted strings will
1625       also contain line feed characters if they run across two or more lines,
1626       unless  you  use  a  backslash  to join lines (see below).  An unquoted
1627       string is any  whitespace-delimited  token  that  is  neither  numeric,
1628       string  quoted  nor  contains  the special characters ',', ';', ':', or
1629       '='.
1630
1631       Any amount of whitespace separates tokens in  server  entries,  but  is
1632       otherwise  ignored.  You may use backslash escape sequences (\n for LF,
1633       \t for HT, \b for BS, \r for CR, \nnn for  decimal  (where  nnn  cannot
1634       start with a 0), \0ooo for octal, and \xhh for hex) to embed non-print‐
1635       able characters or string delimiters in strings.  In quoted strings,  a
1636       backslash at the very end of a line will cause the backslash itself and
1637       the line feed (LF or NL, new line) character to be ignored, so that you
1638       can  wrap long strings. Without the backslash at the line end, the line
1639       feed character would become part of the string.
1640
1641       Warning: while these resemble C-style escape sequences,  they  are  not
1642       the  same.  fetchmail only supports these eight styles. C supports more
1643       escape sequences that consist of backslash (\) and a single  character,
1644       but  does  not support decimal codes and does not require the leading 0
1645       in octal notation.  Example: fetchmail interprets \233 the same as \xE9
1646       (Latin  small  letter  e  with  acute), where C would interpret \233 as
1647       octal 0233 = \x9B (CSI, control sequence introducer).
1648
1649       Each server entry consists of one of the  keywords  'poll'  or  'skip',
1650       followed  by a server name, followed by server options, followed by any
1651       number of user (or username) descriptions, followed  by  user  options.
1652       Note:  the  most  common  cause  of syntax errors is mixing up user and
1653       server options or putting user options before the user descriptions.
1654
1655       For backward compatibility, the word 'server' is a synonym for 'poll'.
1656
1657       You can use the noise  keywords  'and',  'with',  'has',  'wants',  and
1658       'options'  anywhere  in  an entry to make it resemble English.  They're
1659       ignored, but but can make entries much easier to read at a glance.  The
1660       punctuation characters ':', ';' and ',' are also ignored.
1661
1662   Poll vs. Skip
1663       The  'poll' verb tells fetchmail to query this host when it is run with
1664       no arguments.  The 'skip' verb tells fetchmail not to  poll  this  host
1665       unless  it  is  explicitly named on the command line.  (The 'skip' verb
1666       allows you to experiment with test entries safely,  or  easily  disable
1667       entries for hosts that are temporarily down.)
1668
1669   Keyword/Option Summary
1670       Here are the legal options.  Keyword suffixes enclosed in square brack‐
1671       ets are optional.  Those corresponding to  short  command-line  options
1672       are  followed  by  '-' and the appropriate option letter.  If option is
1673       only relevant to a single mode of operation, it is noted as 's' or  'm'
1674       for singledrop- or multidrop-mode, respectively.
1675
1676       Here are the legal global options:
1677
1678
1679       Keyword             Opt   Mode   Function
1680       ────────────────────────────────────────────────────────────────────
1681       set daemon          -d           Set  a background poll interval in
1682                                        seconds.
1683       set postmaster                   Give the name of  the  last-resort
1684                                        mail recipient (default: user run‐
1685                                        ning  fetchmail,  "postmaster"  if
1686                                        run by the root user)
1687       set    bouncemail                Direct  error  mail  to the sender
1688                                        (default)
1689       set no bouncemail                Direct error  mail  to  the  local
1690                                        postmaster  (as  per the 'postmas‐
1691                                        ter' global option above).
1692       set no spambounce                Do not  bounce  spam-blocked  mail
1693                                        (default).
1694       set    spambounce                Bounce  blocked  spam-blocked mail
1695                                        (as  per   the   'antispam'   user
1696                                        option) back to the destination as
1697                                        indicated  by   the   'bouncemail'
1698                                        global  option.   Warning:  Do not
1699                                        use this to bounce  spam  back  to
1700                                        the  sender  -  most  spam is sent
1701                                        with false sender address and thus
1702                                        this    option    hurts   innocent
1703                                        bystanders.
1704       set no softbounce                Delete  permanently  undeliverable
1705                                        mail.  It  is  recommended  to use
1706                                        this option if  the  configuration
1707                                        has been thoroughly tested.
1708       set    softbounce                Keep   permanently   undeliverable
1709                                        mail as though a  temporary  error
1710                                        had occurred (default).
1711
1712
1713       set logfile         -L           Name of a file to append error and
1714                                        status messages to.   Only  effec‐
1715                                        tive  in daemon mode and if fetch‐
1716                                        mail  detaches.    If   effective,
1717                                        overrides set syslog.
1718       set pidfile         -p           Name of the PID file.
1719       set idfile          -i           Name  of  the  file  to  store UID
1720                                        lists in.
1721       set    syslog                    Do  error  logging  through   sys‐
1722                                        log(3).  May  be overridden by set
1723                                        logfile.
1724       set no syslog                    Turn  off  error  logging  through
1725                                        syslog(3). (default)
1726       set properties                   String  value  that  is ignored by
1727                                        fetchmail (may be used  by  exten‐
1728                                        sion scripts).
1729
1730       Here are the legal server options:
1731
1732
1733       Keyword          Opt   Mode   Function
1734       ─────────────────────────────────────────────────────────────────
1735       via                           Specify  DNS  name  of mailserver,
1736                                     overriding poll name
1737       proto[col]       -p           Specify  protocol  (case  insensi‐
1738                                     tive):  POP2,  POP3,  IMAP,  APOP,
1739                                     KPOP
1740       local[domains]         m      Specify domain(s) to  be  regarded
1741                                     as local
1742       port                          Specify TCP/IP service port (obso‐
1743                                     lete, use 'service' instead).
1744       service          -P           Specify service  name  (a  numeric
1745                                     value  is also allowed and consid‐
1746                                     ered a TCP/IP port number).
1747       auth[enticate]                Set authentication  type  (default
1748                                     'any')
1749       timeout          -t           Server  inactivity timeout in sec‐
1750                                     onds (default 300)
1751       envelope         -E    m      Specify  envelope-address   header
1752                                     name
1753       no envelope            m      Disable   looking   for   envelope
1754                                     address
1755       qvirtual         -Q    m      Qmail  virtual  domain  prefix  to
1756                                     remove from user name
1757       aka                    m      Specify  alternate  DNS  names  of
1758                                     mailserver
1759       interface        -I           specify IP interface(s) that  must
1760                                     be  up  for  server  poll  to take
1761                                     place
1762       monitor          -M           Specify IP address to monitor  for
1763                                     activity
1764       plugin                        Specify  command  through which to
1765                                     make server connections.
1766       plugout                       Specify command through  which  to
1767                                     make listener connections.
1768       dns                    m      Enable  DNS  lookup  for multidrop
1769                                     (default)
1770       no dns                 m      Disable DNS lookup for multidrop
1771       checkalias             m      Do comparison by  IP  address  for
1772                                     multidrop
1773       no checkalias          m      Do  comparison  by  name  for mul‐
1774                                     tidrop (default)
1775       uidl             -U           Force  POP3  to  use   client-side
1776                                     UIDLs (recommended)
1777       no uidl                       Turn  off  POP3 use of client-side
1778                                     UIDLs (default)
1779       interval                      Only check this site every N  poll
1780                                     cycles; N is a numeric argument.
1781       tracepolls                    Add  poll  tracing  information to
1782                                     the Received header
1783       principal                     Set Kerberos principal (only  use‐
1784                                     ful with IMAP and kerberos)
1785       esmtpname                     Set  name  for RFC2554 authentica‐
1786                                     tion to the ESMTP server.
1787       esmtppassword                 Set password for RFC2554 authenti‐
1788                                     cation to the ESMTP server.
1789
1790       bad-header                    How  to  treat messages with a bad
1791                                     header. Can be reject (default) or
1792                                     accept.
1793
1794       Here are the legal user descriptions and options:
1795
1796
1797       Keyword            Opt       Mode   Function
1798       ───────────────────────────────────────────────────────────────────────
1799       user[name]         -u               This  is  the user description and
1800                                           must  come  first   after   server
1801                                           description   and  after  possible
1802                                           server options,  and  before  user
1803                                           options.
1804
1805                                           It sets the remote user name if by
1806                                           itself or followed by 'there',  or
1807                                           the local user name if followed by
1808                                           'here'.
1809       is                                  Connect  local  and  remote   user
1810                                           names
1811       to                                  Connect   local  and  remote  user
1812                                           names
1813       pass[word]                          Specify remote account password
1814       ssl                                 Connect to server over the  speci‐
1815                                           fied   base   protocol  using  SSL
1816                                           encryption
1817       sslcert                             Specify file for client side  pub‐
1818                                           lic SSL certificate
1819       sslcertck                           Enable strict certificate checking
1820                                           and abort connection  on  failure.
1821                                           Default   only   since   fetchmail
1822                                           v6.4.0.
1823       no sslcertck                        Disable strict certificate  check‐
1824                                           ing and permit connections to con‐
1825                                           tinue on failed verification. Dis‐
1826                                           couraged.   Should  only  be  used
1827                                           together with sslfingerprint.
1828       sslcertfile                         Specify file with trusted CA  cer‐
1829                                           tificates
1830       sslcertpath                         Specify c_rehash-ed directory with
1831                                           trusted CA certificates.
1832       sslfingerprint     <HASH>           Specify the expected  server  cer‐
1833                                           tificate  finger print from an MD5
1834                                           hash.  Fetchmail  will  disconnect
1835                                           and  log  an  error if it does not
1836                                           match.
1837       sslkey                              Specify file for client side  pri‐
1838                                           vate SSL key
1839       sslproto                            Force ssl protocol for connection
1840       folder             -r               Specify remote folder to query
1841       smtphost           -S               Specify smtp host(s) to forward to
1842       fetchdomains                 m      Specify  domains  for  which  mail
1843                                           should be fetched
1844       smtpaddress        -D               Specify the domain to  be  put  in
1845                                           RCPT TO lines
1846       smtpname                            Specify  the user and domain to be
1847                                           put in RCPT TO lines
1848       antispam           -Z               Specify  what  SMTP  returns   are
1849                                           interpreted as spam-policy blocks
1850       mda                -m               Specify MDA for local delivery
1851       bsmtp                               Specify BSMTP batch file to append
1852                                           to
1853       preconnect                          Command to be executed before each
1854                                           connection
1855       postconnect                         Command  to be executed after each
1856                                           connection
1857       keep               -k               Don't delete  seen  messages  from
1858                                           server  (for  POP3, uidl is recom‐
1859                                           mended)
1860       flush              -F               Flush  all  seen  messages  before
1861                                           querying (DANGEROUS)
1862       limitflush                          Flush   all   oversized   messages
1863                                           before querying
1864       fetchall           -a               Fetch all messages whether seen or
1865                                           not
1866
1867       rewrite                             Rewrite  destination addresses for
1868                                           reply (default)
1869       stripcr                             Strip carriage returns  from  ends
1870                                           of lines
1871       forcecr                             Force  carriage returns at ends of
1872                                           lines
1873       pass8bits                           Force BODY=8BITMIME to ESMTP  lis‐
1874                                           tener
1875       dropstatus                          Strip  Status and X-Mozilla-Status
1876                                           lines out of incoming mail
1877       dropdelivered                       Strip Delivered-To  lines  out  of
1878                                           incoming mail
1879       mimedecode                          Convert  quoted-printable to 8-bit
1880                                           in MIME messages
1881       idle                                Idle  waiting  for  new   messages
1882                                           after each poll (IMAP only)
1883       no keep            -K               Delete  seen  messages from server
1884                                           (default)
1885       no flush                            Don't  flush  all  seen   messages
1886                                           before querying (default)
1887       no fetchall                         Retrieve    only    new   messages
1888                                           (default)
1889       no rewrite                          Don't rewrite headers
1890       no stripcr                          Don't   strip   carriage   returns
1891                                           (default)
1892       no forcecr                          Don't  force  carriage  returns at
1893                                           EOL (default)
1894       no pass8bits                        Don't force BODY=8BITMIME to ESMTP
1895                                           listener (default)
1896       no dropstatus                       Don't    drop    Status    headers
1897                                           (default)
1898       no dropdelivered                    Don't  drop  Delivered-To  headers
1899                                           (default)
1900       no mimedecode                       Don't  convert quoted-printable to
1901                                           8-bit in MIME messages (default)
1902       no idle                             Don't idle waiting  for  new  mes‐
1903                                           sages after each poll (IMAP only)
1904       limit              -l               Set message size limit
1905       warnings           -w               Set message size warning interval
1906       batchlimit         -b               Max  # messages to forward in sin‐
1907                                           gle connect
1908       fetchlimit         -B               Max # messages to fetch in  single
1909                                           connect
1910       fetchsizelimit                      Max  #  message  sizes to fetch in
1911                                           single transaction
1912       fastuidl                            Use binary search for first unseen
1913                                           message (POP3 only)
1914       expunge            -e               Perform  an  expunge  on every #th
1915                                           message (IMAP and POP3 only)
1916       properties                          String value is ignored by  fetch‐
1917                                           mail  (may  be  used  by extension
1918                                           scripts)
1919
1920       All user options must begin with a user description (user  or  username
1921       option) and follow all server descriptions and options.
1922
1923       In  the  .fetchmailrc  file, the 'envelope' string argument may be pre‐
1924       ceded by a whitespace-separated number.  This number, if specified,  is
1925       the  number  of  such  headers  to skip over (that is, an argument of 1
1926       selects the second header of the given type).  This is sometime  useful
1927       for  ignoring bogus envelope headers created by an ISP's local delivery
1928       agent or  internal  forwards  (through  mail  inspection  systems,  for
1929       instance).
1930
1931   Keywords Not Corresponding To Option Switches
1932       The  'folder' and 'smtphost' options (unlike their command-line equiva‐
1933       lents) can take a space- or comma-separated  list  of  names  following
1934       them.
1935
1936       All  options  correspond  to the obvious command-line arguments, except
1937       the following: 'via', 'interval', 'aka', 'is',  'to',  'dns'/'no  dns',
1938       'checkalias'/'no  checkalias', 'password', 'preconnect', 'postconnect',
1939       'localdomains',   'stripcr'/'no   stripcr',   'forcecr'/'no   forcecr',
1940       'pass8bits'/'no   pass8bits'  'dropstatus/no  dropstatus',  'dropdeliv‐
1941       ered/no dropdelivered', 'mimedecode/no mimedecode', 'no idle', and  'no
1942       envelope'.
1943
1944       The 'via' option is for if you want to have more than one configuration
1945       pointing at the same site.  If it is present, the string argument  will
1946       be  taken as the actual DNS name of the mailserver host to query.  This
1947       will override the argument of poll, which can then simply be a distinct
1948       label  for  the  configuration (e.g. what you would give on the command
1949       line to explicitly query this host).
1950
1951       The 'interval' option (which takes a numeric argument)  allows  you  to
1952       poll a server less frequently than the basic poll interval.  If you say
1953       'interval N' the server this option is attached to will only be queried
1954       every N poll intervals.
1955
1956   Singledrop vs. Multidrop options
1957       Please  ensure  you  read  the section titled THE USE AND ABUSE OF MUL‐
1958       TIDROP MAILBOXES if you intend to use multidrop mode.
1959
1960       The 'is' or  'to'  keywords  associate  the  following  local  (client)
1961       name(s)  (or  server-name  to client-name mappings separated by =) with
1962       the mailserver user name in the entry.  If an is/to list has '*' as its
1963       last  name,  unrecognized  names  are  simply passed through. Note that
1964       until fetchmail version 6.3.4 inclusively, these lists could only  con‐
1965       tain  local  parts of user names (fetchmail would only look at the part
1966       before the @ sign). fetchmail versions 6.3.5  and  newer  support  full
1967       addresses on the left hand side of these mappings, and they take prece‐
1968       dence over any 'localdomains', 'aka', 'via' or similar mappings.
1969
1970       A single local name can be used to support redirecting your  mail  when
1971       your  username on the client machine is different from your name on the
1972       mailserver.  When there is only a single local name, mail is  forwarded
1973       to  that  local  username regardless of the message's Received, To, Cc,
1974       and Bcc headers.  In this case, fetchmail never does DNS lookups.
1975
1976       When there is more than one local name  (or  name  mapping),  fetchmail
1977       looks  at  the  envelope  header,  if  configured, and otherwise at the
1978       Received, To, Cc, and Bcc headers of retrieved mail (this is 'multidrop
1979       mode').   It  looks  for  addresses with hostname parts that match your
1980       poll name or your 'via', 'aka' or 'localdomains' options,  and  usually
1981       also  for  hostname  parts  which  DNS  tells  it  are  aliases  of the
1982       mailserver.  See the discussion of 'dns', 'checkalias', 'localdomains',
1983       and 'aka' for details on how matching addresses are handled.
1984
1985       If  fetchmail  cannot  match  any  mailserver  usernames or localdomain
1986       addresses, the mail will be bounced.  Normally it will  be  bounced  to
1987       the sender, but if the 'bouncemail' global option is off, the mail will
1988       go to the local  postmaster  instead.   (see  the  'postmaster'  global
1989       option). See also BUGS.
1990
1991       The  'dns'  option  (normally  on) controls the way addresses from mul‐
1992       tidrop mailboxes are checked.  On, it enables logic to check each  host
1993       address  that  does not match an 'aka' or 'localdomains' declaration by
1994       looking it up with DNS.   When  a  mailserver  username  is  recognized
1995       attached to a matching hostname part, its local mapping is added to the
1996       list of local recipients.
1997
1998       The 'checkalias' option (normally off) extends the lookups performed by
1999       the  'dns'  keyword  in  multidrop  mode,  providing a way to cope with
2000       remote MTAs that identify themselves using their canonical name,  while
2001       they're polled using an alias.  When such a server is polled, checks to
2002       extract the envelope address fail, and fetchmail  reverts  to  delivery
2003       using   the   To/Cc/Bcc   headers   (See  below  'Header  vs.  Envelope
2004       addresses').  Specifying this option instructs  fetchmail  to  retrieve
2005       all  the  IP  addresses associated with both the poll name and the name
2006       used by the remote MTA and to do a  comparison  of  the  IP  addresses.
2007       This  comes  in  handy  in situations where the remote server undergoes
2008       frequent canonical name changes, that would otherwise require modifica‐
2009       tions  to the rcfile.  'checkalias' has no effect if 'no dns' is speci‐
2010       fied in the rcfile.
2011
2012       The 'aka' option is for use with multidrop mailboxes.  It allows you to
2013       pre-declare  a  list of DNS aliases for a server.  This is an optimiza‐
2014       tion hack that allows you to trade space for  speed.   When  fetchmail,
2015       while  processing  a multidrop mailbox, grovels through message headers
2016       looking for names of the mailserver, pre-declaring common ones can save
2017       it  from  having  to do DNS lookups.  Note: the names you give as argu‐
2018       ments to 'aka' are matched as suffixes -- if  you  specify  (say)  'aka
2019       netaxs.com',  this  will  match not just a hostname netaxs.com, but any
2020       hostname that ends with '.netaxs.com'; such  as  (say)  pop3.netaxs.com
2021       and mail.netaxs.com.
2022
2023       The 'localdomains' option allows you to declare a list of domains which
2024       fetchmail should consider local.  When  fetchmail  is  parsing  address
2025       lines in multidrop modes, and a trailing segment of a host name matches
2026       a declared local domain, that address is passed through to the listener
2027       or MDA unaltered (local-name mappings are not applied).
2028
2029       If you are using 'localdomains', you may also need to specify 'no enve‐
2030       lope', which disables fetchmail's normal attempt to deduce an  envelope
2031       address  from  the  Received  line  or X-Envelope-To header or whatever
2032       header has been previously set by 'envelope'.  If you set 'no envelope'
2033       in the defaults entry it is possible to undo that in individual entries
2034       by using 'envelope <string>'.  As a special case, 'envelope "Received"'
2035       restores the default parsing of Received lines.
2036
2037       The  password  option requires a string argument, which is the password
2038       to be used with the entry's server.
2039
2040       The 'preconnect' keyword allows you to specify a shell  command  to  be
2041       executed  just before each time fetchmail establishes a mailserver con‐
2042       nection.  This may be useful if you are attempting to set up secure POP
2043       connections  with  the aid of ssh(1).  If the command returns a nonzero
2044       status, the poll of that mailserver will be aborted.
2045
2046       Similarly, the 'postconnect' keyword similarly allows you to specify  a
2047       shell  command to be executed just after each time a mailserver connec‐
2048       tion is taken down.
2049
2050       The 'forcecr' option controls whether lines terminated by LF  only  are
2051       given  CRLF  termination  before  forwarding.  Strictly speaking RFC821
2052       requires this, but few MTAs enforce the requirement so this  option  is
2053       normally  off  (only one such MTA, qmail, is in significant use at time
2054       of writing).
2055
2056       The 'stripcr' option controls whether carriage returns are stripped out
2057       of retrieved mail before it is forwarded.  It is normally not necessary
2058       to set this, because it defaults to 'on' (CR  stripping  enabled)  when
2059       there  is  an  MDA declared but 'off' (CR stripping disabled) when for‐
2060       warding is via SMTP.  If 'stripcr' and 'forcecr' are both on, 'stripcr'
2061       will override.
2062
2063       The 'pass8bits' option exists to cope with Microsoft mail programs that
2064       stupidly slap a "Content-Transfer-Encoding: 7bit" on everything.   With
2065       this  option  off  (the  default)  and such a header present, fetchmail
2066       declares BODY=7BIT to an ESMTP-capable listener; this  causes  problems
2067       for  messages  actually  using 8-bit ISO or KOI-8 character sets, which
2068       will be garbled by having the high bits of all characters stripped.  If
2069       'pass8bits'  is on, fetchmail is forced to declare BODY=8BITMIME to any
2070       ESMTP-capable listener.  If the listener is  8-bit-clean  (as  all  the
2071       major ones now are) the right thing will probably result.
2072
2073       The 'dropstatus' option controls whether nonempty Status and X-Mozilla-
2074       Status lines are retained in fetched mail (the default)  or  discarded.
2075       Retaining  them  allows  your  MUA  to  see what messages (if any) were
2076       marked seen on the server.  On the other hand, it can confuse some new-
2077       mail notifiers, which assume that anything with a Status line in it has
2078       been seen.  (Note: the empty Status lines inserted by  some  buggy  POP
2079       servers are unconditionally discarded.)
2080
2081       The  'dropdelivered'  option controls whether Delivered-To headers will
2082       be kept in fetched mail (the default) or discarded. These  headers  are
2083       added by Qmail and Postfix mailservers in order to avoid mail loops but
2084       may get in your way if you try to "mirror" a mailserver within the same
2085       domain. Use with caution.
2086
2087       The  'mimedecode'  option  controls  whether  MIME  messages  using the
2088       quoted-printable encoding are automatically converted into  pure  8-bit
2089       data.  If you are delivering mail to an ESMTP-capable, 8-bit-clean lis‐
2090       tener (that includes all of the major MTAs like  sendmail),  then  this
2091       will  automatically  convert  quoted-printable message headers and data
2092       into 8-bit data, making it easier to understand when reading  mail.  If
2093       your  e-mail  programs  know  how to deal with MIME messages, then this
2094       option is not needed.  The mimedecode option is off by default, because
2095       doing  RFC2047 conversion on headers throws away character-set informa‐
2096       tion and can lead to bad results if the encoding of the headers differs
2097       from the body encoding.
2098
2099       The  'idle'  option is intended to be used with IMAP servers supporting
2100       the RFC2177 IDLE command extension, but does not strictly  require  it.
2101       If it is enabled, and fetchmail detects that IDLE is supported, an IDLE
2102       will be issued at the end of each poll.  This will tell the IMAP server
2103       to  hold  the  connection  open  and notify the client when new mail is
2104       available.  If IDLE is not supported, fetchmail  will  simulate  it  by
2105       periodically  issuing NOOP. If you need to poll a link frequently, IDLE
2106       can save bandwidth by  eliminating  TCP/IP  connects  and  LOGIN/LOGOUT
2107       sequences. On the other hand, an IDLE connection will eat almost all of
2108       your fetchmail's time, because it will never drop  the  connection  and
2109       allow  other  polls  to occur unless the server times out the IDLE.  It
2110       also doesn't work with multiple folders; only  the  first  folder  will
2111       ever be polled.
2112
2113       The  'properties'  option is an extension mechanism.  It takes a string
2114       argument, which is ignored by fetchmail itself.   The  string  argument
2115       may  be  used  to  store  configuration  information  for scripts which
2116       require it.  In particular, the output of  '--configdump'  option  will
2117       make  properties  associated  with  a user entry readily available to a
2118       Python script.
2119
2120   Miscellaneous Run Control Options
2121       The words 'here' and 'there'  have  useful  English-like  significance.
2122       Normally  'user  eric  is esr' would mean that mail for the remote user
2123       'eric' is to be delivered to 'esr', but you can make  this  clearer  by
2124       saying 'user eric there is esr here', or reverse it by saying 'user esr
2125       here is eric there'
2126
2127       Legal protocol identifiers for use with the 'protocol' keyword are:
2128
2129           auto (or AUTO) (legacy, to be removed from future release)
2130           pop2 (or POP2) (legacy, to be removed from future release)
2131           pop3 (or POP3)
2132           sdps (or SDPS)
2133           imap (or IMAP)
2134           apop (or APOP)
2135           kpop (or KPOP)
2136
2137
2138       Legal authentication types are  'any',  'password',  'kerberos',  'ker‐
2139       beros_v4',  'kerberos_v5'  and 'gssapi', 'cram-md5', 'otp', 'msn' (only
2140       for POP3), 'ntlm', 'ssh', 'external' (only IMAP).  The 'password'  type
2141       specifies  authentication  by  normal  transmission  of a password (the
2142       password may be plain text or subject to  protocol-specific  encryption
2143       as  in  CRAM-MD5);  'kerberos' tells fetchmail to try to get a Kerberos
2144       ticket at the start of each query instead, and send an arbitrary string
2145       as the password; and 'gssapi' tells fetchmail to use GSSAPI authentica‐
2146       tion.  See the description of the 'auth' keyword for more.
2147
2148       Specifying 'kpop' sets POP3 protocol over port 1109  with  Kerberos  V4
2149       authentication.  These defaults may be overridden by later options.
2150
2151       There  are  some  global option statements: 'set logfile' followed by a
2152       string sets the same global specified  by  --logfile.   A  command-line
2153       --logfile option will override this. Note that --logfile is only effec‐
2154       tive if fetchmail detaches itself from the  terminal  and  the  logfile
2155       already  exists  before  fetchmail is run, and it overrides --syslog in
2156       this case.  Also, 'set daemon' sets the poll interval as --daemon does.
2157       This can be overridden by a command-line --daemon option; in particular
2158       --daemon 0 can be used to force foreground operation. The 'set postmas‐
2159       ter'  statement  sets  the  address to which multidrop mail defaults if
2160       there are no local matches.  Finally, 'set syslog' sends  log  messages
2161       to syslogd(8).
2162
2163

DEBUGGING FETCHMAIL

2165   Fetchmail crashing
2166       There are various ways in that fetchmail may "crash", i. e. stop opera‐
2167       tion suddenly and unexpectedly. A "crash" usually refers  to  an  error
2168       condition  that  the  software  did  not handle by itself. A well-known
2169       failure mode is the "segmentation fault" or "signal 11" or "SIGSEGV" or
2170       just  "segfault" for short. These can be caused by hardware or by soft‐
2171       ware problems. Software-induced segfaults  can  usually  be  reproduced
2172       easily and in the same place, whereas hardware-induced segfaults can go
2173       away if the computer is rebooted, or powered off for a few  hours,  and
2174       can  happen  in  random locations even if you use the software the same
2175       way.
2176
2177       For solving hardware-induced segfaults, find the faulty  component  and
2178       repair  or replace it.  The Sig11 FAQ ⟨https://www.bitwizard.nl/sig11/
2179       may help you with details.
2180
2181       For solving software-induced  segfaults,  the  developers  may  need  a
2182       "stack backtrace".
2183
2184
2185   Enabling fetchmail core dumps
2186       By  default,  fetchmail  suppresses  core  dumps as these might contain
2187       passwords and other  sensitive  information.  For  debugging  fetchmail
2188       crashes,  obtaining  a  "stack backtrace" from a core dump is often the
2189       quickest way to solve the problem, and when posting your problem  on  a
2190       mailing list, the developers may ask you for a "backtrace".
2191
2192       1.  To  get  useful backtraces, fetchmail needs to be installed without
2193       getting stripped  of  its  compilation  symbols.   Unfortunately,  most
2194       binary  packages  that  are installed are stripped, and core files from
2195       symbol-stripped programs are worthless. So you may  need  to  recompile
2196       fetchmail. On many systems, you can type
2197
2198               file `which fetchmail`
2199
2200       to  find  out  if  fetchmail  was  symbol-stripped or not. If yours was
2201       unstripped, fine, proceed, if it was stripped, you  need  to  recompile
2202       the  source code first. You do not usually need to install fetchmail in
2203       order to debug it.
2204
2205       2. The shell environment that starts fetchmail  needs  to  enable  core
2206       dumps.  The  key  is the "maximum core (file) size" that can usually be
2207       configured with a tool named "limit" or "ulimit". See the documentation
2208       for  your  shell  for  details.  In the popular bash shell, "ulimit -Sc
2209       unlimited" will allow the core dump.
2210
2211       3. You need to tell fetchmail, too, to allow core dumps.  To  do  this,
2212       run  fetchmail with the -d0 -v options.  It is often easier to also add
2213       --nosyslog -N as well.
2214
2215       Finally, you need to reproduce the crash. You can just start  fetchmail
2216       from  the directory where you compiled it by typing ./fetchmail, so the
2217       complete command line will start with ./fetchmail -Nvd0 --nosyslog  and
2218       perhaps list your other options.
2219
2220       After the crash, run your debugger to obtain the core dump.  The debug‐
2221       ger will often be GNU GDB, you can then type (adjust  paths  as  neces‐
2222       sary) gdb ./fetchmail fetchmail.core and then, after GDB has started up
2223       and read all its files, type backtrace full, save the  output  (copy  &
2224       paste  will  do,  the  backtrace will be read by a human) and then type
2225       quit to leave gdb.  Note: on some systems, the core files have  differ‐
2226       ent  names, they might contain a number instead of the program name, or
2227       number and name, but it will usually have "core" as part of their name.
2228
2229

INTERACTION WITH RFC 822

2231       When trying to determine the originating address of a  message,  fetch‐
2232       mail looks through headers in the following order:
2233
2234               Return-Path:
2235               Resent-Sender: (ignored if it doesn't contain an @ or !)
2236               Sender: (ignored if it doesn't contain an @ or !)
2237               Resent-From:
2238               From:
2239               Reply-To:
2240               Apparently-From:
2241
2242       The  originating  address is used for logging, and to set the MAIL FROM
2243       address when forwarding to SMTP.  This order is intended to cope grace‐
2244       fully  with  receiving  mailing  list  messages  in multidrop mode. The
2245       intent is that if a local address doesn't  exist,  the  bounce  message
2246       won't  be  returned  blindly  to  the author or to the list itself, but
2247       rather to the list manager (which is less annoying).
2248
2249       In multidrop mode, destination headers are processed as follows: First,
2250       fetchmail  looks  for  the header specified by the 'envelope' option in
2251       order to  determine  the  local  recipient  address.  If  the  mail  is
2252       addressed  to  more than one recipient, the Received line won't contain
2253       any information regarding recipient addresses.
2254
2255       Then fetchmail looks for the Resent-To:,  Resent-Cc:,  and  Resent-Bcc:
2256       lines.   If  they  exist,  they should contain the final recipients and
2257       have precedence over their To:/Cc:/Bcc: counterparts.  If the  Resent-*
2258       lines  don't  exist,  the  To:,  Cc:, Bcc: and Apparently-To: lines are
2259       looked for. (The presence of a Resent-To: is taken to  imply  that  the
2260       person  referred  by  the To: address has already received the original
2261       copy of the mail.)
2262
2263

CONFIGURATION EXAMPLES

2265       Note that although there are password declarations in a  good  many  of
2266       the  examples below, this is mainly for illustrative purposes.  We rec‐
2267       ommend stashing account/password pairs in your $HOME/.netrc file, where
2268       they  can  be  used  not just by fetchmail but by ftp(1) and other pro‐
2269       grams.
2270
2271       The basic format is:
2272
2273
2274              poll SERVERNAME protocol PROTOCOL username NAME  password  PASS‐
2275              WORD
2276
2277
2278       Example:
2279
2280
2281              poll pop.provider.net protocol pop3 username "jsmith" password "secret1"
2282
2283
2284       Or, using some abbreviations:
2285
2286
2287              poll pop.provider.net proto pop3 user "jsmith" password "secret1"
2288
2289
2290       Multiple servers may be listed:
2291
2292
2293              poll pop.provider.net proto pop3 user "jsmith" pass "secret1"
2294              poll other.provider.net proto pop2 user "John.Smith" pass "My^Hat"
2295
2296
2297       Here's the same version with more whitespace and some noise words:
2298
2299
2300              poll pop.provider.net proto pop3
2301                   user "jsmith", with password secret1, is "jsmith" here;
2302              poll other.provider.net proto pop2:
2303                   user "John.Smith", with password "My^Hat", is "John.Smith" here;
2304
2305
2306       If  you  need  to include whitespace in a parameter string or start the
2307       latter with a number, enclose the string in double quotes.  Thus:
2308
2309
2310              poll mail.provider.net with proto pop3:
2311                   user "jsmith" there has password "4u but u can't krak this"
2312                   is jws here and wants mda "/bin/mail"
2313
2314
2315       You may have an  initial  server  description  headed  by  the  keyword
2316       'defaults'  instead  of  'poll'  followed  by a name.  Such a record is
2317       interpreted as defaults for all queries to use. It may  be  overwritten
2318       by individual server descriptions.  So, you could write:
2319
2320
2321              defaults proto pop3
2322                   user "jsmith"
2323              poll pop.provider.net
2324                   pass "secret1"
2325              poll mail.provider.net
2326                   user "jjsmith" there has password "secret2"
2327
2328
2329       It's  possible  to  specify  more than one user per server.  The 'user'
2330       keyword leads off a user description, and every user specification in a
2331       multi-user entry must include it.  Here's an example:
2332
2333
2334              poll pop.provider.net proto pop3 port 3111
2335                   user "jsmith" with pass "secret1" is "smith" here
2336                   user jones with pass "secret2" is "jjones" here keep
2337
2338
2339       This  associates  the  local username 'smith' with the pop.provider.net
2340       username  'jsmith'  and  the   local   username   'jjones'   with   the
2341       pop.provider.net  username  'jones'.   Mail  for 'jones' is kept on the
2342       server after download.
2343
2344
2345       Here's what a simple retrieval configuration for  a  multidrop  mailbox
2346       looks like:
2347
2348
2349              poll pop.provider.net:
2350                   user maildrop with pass secret1 to golux 'hurkle'='happy' snark here
2351
2352
2353       This  says  that  the  mailbox of account 'maildrop' on the server is a
2354       multidrop box, and that messages in it should be parsed for the  server
2355       user  names  'golux', 'hurkle', and 'snark'.  It further specifies that
2356       'golux' and 'snark' have the same name on the client as on the  server,
2357       but  mail  for  server user 'hurkle' should be delivered to client user
2358       'happy'.
2359
2360
2361       Note  that  fetchmail,  until  version  6.3.4,  did  NOT   allow   full
2362       user@domain  specifications  here,  these would never match.  Fetchmail
2363       6.3.5 and newer support user@domain  specifications  on  the  left-hand
2364       side of a user mapping.
2365
2366
2367       Here's an example of another kind of multidrop connection:
2368
2369
2370              poll pop.provider.net localdomains loonytoons.org toons.org
2371                   envelope X-Envelope-To
2372                   user maildrop with pass secret1 to * here
2373
2374
2375       This  also says that the mailbox of account 'maildrop' on the server is
2376       a multidrop box.  It tells fetchmail that any  address  in  the  loony‐
2377       toons.org  or  toons.org  domains  (including sub-domain addresses like
2378       'joe@daffy.loonytoons.org') should be passed through to the local  SMTP
2379       listener  without  modification.   Be  careful  of mail loops if you do
2380       this!
2381
2382
2383       Here's an example configuration using ssh and the plugin  option.   The
2384       queries  are  made  directly  on the stdin and stdout of imapd via ssh.
2385       Note that in this setup, IMAP authentication can be skipped.
2386
2387
2388              poll mailhost.net with proto imap:
2389                   plugin "ssh %h /usr/sbin/imapd" auth ssh;
2390                   user esr is esr here
2391
2392

THE USE AND ABUSE OF MULTIDROP MAILBOXES

2394       Use the multiple-local-recipients feature with caution -- it can  bite.
2395       All multidrop features are ineffective in ETRN and ODMR modes.
2396
2397       Also, note that in multidrop mode duplicate mails may be suppressed.  A
2398       piece of mail is considered duplicate if it does not have a discernable
2399       envelope  recipient address, has the same header as the message immedi‐
2400       ately preceding and more than one addressee.  Such runs of messages may
2401       be  generated  when copies of a message addressed to multiple users are
2402       delivered to a multidrop box. (To be precise, fetchmail  6.2.5  through
2403       6.4.X  use  an  MD5  hash of the raw message header, and only fetchmail
2404       6.4.16+ document this properly.  Fetchmail 5.0.8  (1999-09-14)  through
2405       6.2.4  used  only  the Message-ID header.  5.0.7 and older did not sup‐
2406       press duplicates.)
2407
2408       Note that this duplication killer code checking the  entire  header  is
2409       very restrictive and may not suppress many duplicates in practice - for
2410       instance, if some X-Original-To or Delivered-To header  differs.   This
2411       is intentional and correct in such situations: wherever envelope infor‐
2412       mation is available, it should be used for reliable delivery of mailing
2413       list and blind carbon copy (Bcc) messages. See the subsection Duplicate
2414       suppression below for suggestions.
2415
2416
2417   Header vs. Envelope addresses
2418       The fundamental problem is that by having your mailserver toss  several
2419       peoples' mail in a single maildrop box, you may have thrown away poten‐
2420       tially vital information about who each  piece  of  mail  was  actually
2421       addressed  to  (the  'envelope  address',  as  opposed  to  the  header
2422       addresses in the RFC822 To/Cc headers - the Bcc is not available at the
2423       receiving  end).   This  'envelope  address' is the address you need in
2424       order to reroute mail properly.
2425
2426       Sometimes fetchmail can deduce the envelope address.  If the mailserver
2427       MTA  is  sendmail  and the item of mail had just one recipient, the MTA
2428       will have written a 'by/for' clause that gives the  envelope  addressee
2429       into  its  Received  header.  But  this doesn't work reliably for other
2430       MTAs, nor if there is more than one recipient.  By  default,  fetchmail
2431       looks  for  envelope  addresses  in  these  lines; you can restore this
2432       default with -E "Received" or 'envelope Received'.
2433
2434       As a better alternative, some SMTP listeners and/or mail servers insert
2435       a  header  in each message containing a copy of the envelope addresses.
2436       This header (when it exists) is often  'X-Original-To',  'Delivered-To'
2437       or  'X-Envelope-To'.   Fetchmail's assumption about this can be changed
2438       with the -E or 'envelope' option.  Note that writing an envelope header
2439       of  this  kind  exposes  the  names of recipients (including blind-copy
2440       recipients) to all receivers of the  messages,  so  the  upstream  must
2441       store one copy of the message per recipient to avoid becoming a privacy
2442       problem.
2443
2444       Postfix, since version 2.0, writes an X-Original-To: header which  con‐
2445       tains a copy of the envelope as it was received.
2446
2447       Qmail and Postfix generally write a 'Delivered-To' header upon deliver‐
2448       ing the message to the mail spool and  use  it  to  avoid  mail  loops.
2449       Qmail  virtual  domains however will prefix the user name with a string
2450       that normally matches the user's domain. To remove this prefix you  can
2451       use the -Q or 'qvirtual' option.
2452
2453       Sometimes,  unfortunately, neither of these methods works.  That is the
2454       point when you should contact your ISP and ask them to provide such  an
2455       envelope  header,  and  you should not use multidrop in this situation.
2456       When they all fail, fetchmail must fall back on the contents  of  To/Cc
2457       headers (Bcc headers are not available - see below) to try to determine
2458       recipient addressees -- and these are unreliable.  In particular, mail‐
2459       ing-list software often ships mail with only the list broadcast address
2460       in the To header.
2461
2462       Note that a future version of fetchmail may remove To/Cc parsing!
2463
2464       When fetchmail cannot deduce a recipient address that is local, and the
2465       intended  recipient  address was anyone other than fetchmail's invoking
2466       user, mail will get lost.  This is what  makes  the  multidrop  feature
2467       risky without proper envelope information.
2468
2469       A  related  problem is that when you blind-copy a mail message, the Bcc
2470       information is carried only as envelope address (it's removed from  the
2471       headers  by  the  sending  mail server, so fetchmail can see it only if
2472       there is an X-Envelope-To header).  Thus, blind-copying to someone  who
2473       gets  mail  over  a  fetchmail  multidrop link will fail unless the the
2474       mailserver host routinely writes X-Envelope-To or an equivalent  header
2475       into messages in your maildrop.
2476
2477       In conclusion, mailing lists and Bcc'd mail can only work if the server
2478       you're fetching from
2479
2480       (1)    stores one copy of the message per recipient in your domain and
2481
2482       (2)    records the envelope information in a special  header  (X-Origi‐
2483              nal-To, Delivered-To, X-Envelope-To).
2484
2485
2486   Good Ways To Use Multidrop Mailboxes
2487       Multiple  local names can be used to administer a mailing list from the
2488       client side of a fetchmail collection.  Suppose your name is 'esr', and
2489       you  want  to  both  pick  up your own mail and maintain a mailing list
2490       called (say) "fetchmail-friends", and you want to keep the  alias  list
2491       on your client machine.
2492
2493       On  your  server,  you can alias 'fetchmail-friends' to 'esr'; then, in
2494       your .fetchmailrc, declare 'to esr fetchmail-friends here'.  Then, when
2495       mail including 'fetchmail-friends' as a local address gets fetched, the
2496       list name will be appended to the list of recipients your SMTP listener
2497       sees.   Therefore  it will undergo alias expansion locally.  Be sure to
2498       include 'esr' in the local alias  expansion  of  fetchmail-friends,  or
2499       you'll  never  see  mail sent only to the list.  Also be sure that your
2500       listener has the "me-too"  option  set  (sendmail's  -oXm  command-line
2501       option or OXm declaration) so your name isn't removed from alias expan‐
2502       sions in messages you send.
2503
2504       This trick is not without its problems, however.  You'll begin  to  see
2505       this  when  a message comes in that is addressed only to a mailing list
2506       you do not have declared as a local name.  Each such message will  fea‐
2507       ture  an 'X-Fetchmail-Warning' header which is generated because fetch‐
2508       mail cannot find a valid local name in the recipient  addresses.   Such
2509       messages  default  (as  was described above) to being sent to the local
2510       user running fetchmail, but the program has no way to know that  that's
2511       actually the right thing.
2512
2513
2514   Bad Ways To Abuse Multidrop Mailboxes
2515       Multidrop mailboxes and fetchmail serving multiple users in daemon mode
2516       do not mix.  The problem, again, is mail from mailing lists, which typ‐
2517       ically  does  not  have an individual recipient address on it.   Unless
2518       fetchmail can deduce an envelope address, such mail will only go to the
2519       account  running  fetchmail  (probably root).  Also, blind-copied users
2520       are very likely never to see their mail at all.
2521
2522       If you're tempted to use fetchmail to retrieve mail for multiple  users
2523       from  a  single  mail drop via POP or IMAP, think again (and reread the
2524       section on header and envelope addresses above).  It would  be  smarter
2525       to  just let the mail sit in the mailserver's queue and use fetchmail's
2526       ETRN or ODMR modes to trigger SMTP sends periodically (of course,  this
2527       means  you  have  to  poll more frequently than the mailserver's expiry
2528       period).  If you can't arrange this, try setting up a UUCP feed.
2529
2530       If you absolutely must use multidrop for this purpose, make  sure  your
2531       mailserver  writes  an  envelope-address header that fetchmail can see.
2532       Otherwise you will lose mail and it will come back to haunt you.
2533
2534
2535   Speeding Up Multidrop Checking
2536       Normally, when multiple users are declared fetchmail extracts recipient
2537       addresses  as described above and checks each host part with DNS to see
2538       if it's an alias of the mailserver.  If so, the name mappings described
2539       in  the  "to ... here" declaration are done and the mail locally deliv‐
2540       ered.
2541
2542       This is a convenient but also slow method.  To speed it up, pre-declare
2543       mailserver aliases with 'aka'; these are checked before DNS lookups are
2544       done.  If you're certain your aka list contains all DNS aliases of  the
2545       mailserver (and all MX names pointing at it - note this may change in a
2546       future version) you can  declare  'no  dns'  to  suppress  DNS  lookups
2547       entirely and only match against the aka list.
2548
2549
2550   Duplicate suppression on multidrop
2551       If  fetchmail's  duplicate  suppression  code does not kick in for your
2552       multidrop mail account, other options is using sieve, or  for  instance
2553       Courier's  maildrop  package  (and in particular, its reformail program
2554       with the -D option) as the delivery agent (either  from  fetchmail,  or
2555       from your local mail server that fetchmail injects into).
2556
2557

SOCKS

2559       Support  for socks4/5 is a compile time configuration option. Once com‐
2560       piled in, fetchmail will always use the socks libraries and  configura‐
2561       tion  on your system, there are no run-time switches in fetchmail - but
2562       you can still configure SOCKS: you can specify which  SOCKS  configura‐
2563       tion file is used in the SOCKS_CONF environment variable.
2564
2565       For  instance,  if  you wanted to bypass the SOCKS proxy altogether and
2566       have   fetchmail   connect    directly,    you    could    just    pass
2567       SOCKS_CONF=/dev/null  in  the  environment, for example (add your usual
2568       command line options - if any - to the end of this line):
2569
2570       env SOCKS_CONF=/dev/null fetchmail
2571
2572

EXIT CODES

2574       To facilitate the use of fetchmail in  shell  scripts,  an  exit status
2575       code  is returned to give an indication of what occurred during a given
2576       connection.
2577
2578       The exit codes returned by fetchmail are as follows:
2579
2580       0      One or more messages were successfully retrieved (or, if the  -c
2581              option was selected, were found waiting but not retrieved).
2582
2583       1      There  was no mail awaiting retrieval.  (There may have been old
2584              mail still on the server but not selected for retrieval.) If you
2585              do  not  want  "no mail" to be an error condition (for instance,
2586              for cron jobs), use a POSIX-compliant shell and add
2587
2588              || [ $? -eq 1 ]
2589
2590              to the end of the fetchmail command line, note that this  leaves
2591              0  untouched,  maps  1  to 0, and maps all other codes to 1. See
2592              also item #C8 in the FAQ.
2593
2594       2      An error was encountered when attempting to  open  a  socket  to
2595              retrieve  mail.  If you don't know what a socket is, don't worry
2596              about it -- just treat this as an 'unrecoverable  error'.   This
2597              error  can  also be because a protocol fetchmail wants to use is
2598              not listed in /etc/services.
2599
2600       3      The user authentication step failed.  This usually means that  a
2601              bad user-id, password, or APOP id was specified.  Or it may mean
2602              that you tried to run fetchmail under circumstances where it did
2603              not  have  standard  input  attached to a terminal and could not
2604              prompt for a missing password.
2605
2606       4      Some sort of fatal protocol error was detected.
2607
2608       5      There was a syntax error in the arguments  to  fetchmail,  or  a
2609              pre- or post-connect command failed.
2610
2611       6      The run control file had bad permissions.
2612
2613       7      There  was  an error condition reported by the server.  Can also
2614              fire if fetchmail timed out while waiting for the server.
2615
2616       8      Client-side exclusion error.  This means fetchmail either  found
2617              another  copy of itself already running, or failed in such a way
2618              that it isn't sure whether another copy is running.
2619
2620       9      The user authentication step failed because the server responded
2621              "lock  busy".  Try again after a brief pause!  This error is not
2622              implemented for all protocols, nor  for  all  servers.   If  not
2623              implemented  for  your server, "3" will be returned instead, see
2624              above.  May be returned when talking to qpopper or other servers
2625              that  can respond with "lock busy" or some similar text contain‐
2626              ing the word "lock".
2627
2628       10     The fetchmail run failed while trying to do an SMTP port open or
2629              transaction.
2630
2631       11     Fatal  DNS error.  Fetchmail encountered an error while perform‐
2632              ing a DNS lookup at startup and could not proceed.
2633
2634       12     BSMTP batch file could not be opened.
2635
2636       13     Poll terminated by a fetch limit (see the --fetchlimit option).
2637
2638       14     Server busy indication.
2639
2640       23     Internal error.  You should see a message on standard error with
2641              details.
2642
2643       24 - 26, 28, 29
2644              These are internal codes and should not appear externally.
2645
2646       When  fetchmail  queries  more than one host, return status is 0 if any
2647       query successfully retrieved mail. Otherwise the returned error  status
2648       is that of the last host queried.
2649
2650

FILES

2652       ~/.fetchmailrc, $HOME/.fetchmailrc, $HOME_ETC/.fetchmailrc, $FETCHMAIL‐
2653       HOME/fetchmailrc
2654            default run control file (location can be overridden with environ‐
2655            ment variables)
2656
2657       ~/.fetchids,    $HOME/.fetchids,    $HOME_ETC/.fetchids,    $FETCHMAIL‐
2658       HOME/.fetchids
2659            default location of file recording  last  message  UIDs  seen  per
2660            host.  (location can be overridden with environment variables)
2661
2662       ~/.fetchmail.pid,    $HOME/.fetchmail.pid,    $HOME_ETC/.fetchmail.pid,
2663       $FETCHMAILHOME/fetchmail.pid
2664            default location of lock file (sometimes  called  pidfile  or  PID
2665            file,  see  option  pidfile) to help prevent concurrent runs (non-
2666            root mode).  (location can be overridden  with  environment  vari‐
2667            ables)
2668
2669       ~/.netrc, $HOME/.netrc, $HOME_ETC/.netrc
2670            your FTP run control file, which (if present) will be searched for
2671            passwords as a last resort before prompting for one interactively.
2672            (location can be overridden with environment variables)
2673
2674       /var/run/fetchmail.pid
2675            lock  file  (pidfile)  to help prevent concurrent runs (root mode,
2676            Linux systems).
2677
2678       /etc/fetchmail.pid
2679            lock file (pidfile) to help prevent concurrent  runs  (root  mode,
2680            systems without /var/run).
2681
2682

ENVIRONMENT

2684       Fetchmail's  behavior  can  be altered by providing it with environment
2685       variables. Some may alter the operation  of  libraries  that  fetchmail
2686       links  against,  for  instance, OpenSSL.  Note that in daemon mode, you
2687       will need to quit the background daemon process and start a new  fetch‐
2688       mail daemon for environment changes to take effect.
2689
2690       FETCHMAILHOME
2691              If  this  environment  variable  is  set to a valid and existing
2692              directory name, fetchmail will  read  $FETCHMAILHOME/fetchmailrc
2693              (the  dot  is  missing  in  this case), $FETCHMAILHOME/.fetchids
2694              (keeping its dot) and $FETCHMAILHOME/fetchmail.pid (without dot)
2695              rather  than from the user's home directory.  The .netrc file is
2696              always looked for in the the invoking user's home directory  (or
2697              $HOME_ETC) regardless of FETCHMAILHOME's setting.
2698
2699
2700       FETCHMAILUSER
2701              If  this  environment variable is set, it is used as the name of
2702              the calling user (default local name) for purposes such as mail‐
2703              ing  error  notifications.   Otherwise, if either the LOGNAME or
2704              USER variable is  correctly  set  (e.g.  the  corresponding  UID
2705              matches  the  session  user  ID)  then  that name is used as the
2706              default local name.   Otherwise  getpwuid(3)  must  be  able  to
2707              retrieve  a  password  entry  for the session ID (this elaborate
2708              logic is designed to handle  the  case  of  multiple  names  per
2709              userid gracefully).
2710
2711
2712       FETCHMAIL_DISABLE_CBC_IV_COUNTERMEASURE
2713              (since  v6.3.22):  If  this  environment variable is set and not
2714              empty, fetchmail will disable a countermeasure  against  an  SSL
2715              CBC  IV  attack (by setting SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS).
2716              This is a security risk, but may be necessary for connecting  to
2717              certain  non-standards-conforming servers.  See fetchmail's NEWS
2718              file and fetchmail-SA-2012-01.txt for details.   Earlier  fetch‐
2719              mail  versions (v6.3.21 and older) used to disable this counter‐
2720              measure, but v6.3.22 no longer does that as a safety precaution.
2721
2722
2723       FETCHMAIL_POP3_FORCE_RETR
2724              (since v6.3.9): If this environment variable is defined  at  all
2725              (even  if  empty), fetchmail will forgo the POP3 TOP command and
2726              always use RETR. This can be used as a workaround when TOP  does
2727              not work properly.
2728
2729
2730       FETCHMAIL_INCLUDE_DEFAULT_X509_CA_CERTS
2731              (since  v6.3.17):  If  this  environment variable is set and not
2732              empty, fetchmail will always load the default X.509 trusted cer‐
2733              tificate   locations   for  SSL/TLS  CA  certificates,  even  if
2734              --sslcertfile and --sslcertpath are given.  The latter locations
2735              take precedence over the system default locations.  This is use‐
2736              ful in case there are broken certificates in the system directo‐
2737              ries  and the user has no administrator privileges to remedy the
2738              problem.
2739
2740
2741       HOME   (documented since 6.4.1): This variable is nomally  set  to  the
2742              user's  home  directory.  If  it is set to a different directory
2743              than what is in the password database, HOME takes precedence.
2744
2745
2746       HOME_ETC
2747              (documentation corrected to match behaviour code  since  6.4.1):
2748              If  the  HOME_ETC  variable is set, it will override fetchmail's
2749              idea  of  $HOME,  i.  e.  fetchmail  will   read   .fetchmailrc,
2750              .fetchids,  .fetchmail.pid  and .netrc from $HOME_ETC instead of
2751              $HOME (or if HOME is also unset, from  the  passwd  file's  home
2752              directory location).
2753
2754              If  HOME_ETC and FETCHMAILHOME are both set, FETCHMAILHOME takes
2755              prececence and HOME_ETC will be ignored.
2756
2757
2758       SOCKS_CONF
2759              (only if SOCKS support is compiled in) this variable is used  by
2760              the socks library to find out which configuration file it should
2761              read. Set this to /dev/null to bypass the SOCKS proxy.
2762
2763
2764       SSL_CERT_DIR
2765              (with  truly  OpenSSL  1.1.1  compatible   library):   overrides
2766              OpenSSL's  idea  of  the  default trust directory or path (which
2767              contains individual certificate files and hashed symlinks),  see
2768              the SSL_CTX_set_default_verify_paths(3) manual page for details,
2769              it may be in the openssl development package.  If using  another
2770              library's  OpenSSL  compatibility  interface, this may not work.
2771              Since this variable only specifies a default value,  the  option
2772              --sslcertpath takes precedence if given.
2773
2774
2775       SSL_CERT_FILE
2776              (with   truly   OpenSSL  1.1.1  compatible  library):  overrides
2777              OpenSSL's idea of the  default  trust  certificate  bundle  file
2778              (which  contains  a concatenation of base64-encoded certificates
2779              in PEM format), see the SSL_CTX_set_default_verify_paths(3) man‐
2780              ual page for details, it may be in the openssl development pack‐
2781              age.  If using another library's  OpenSSL  compatibility  inter‐
2782              face,  this  may not work.  Since this variable only specifies a
2783              default value, the  option  --sslcertfile  takes  precedence  if
2784              given.
2785
2786

SIGNALS

2788       If  a fetchmail daemon is running as root, SIGUSR1 wakes it up from its
2789       sleep phase and forces a poll of all non-skipped servers. For  compati‐
2790       bility  reasons, SIGHUP can also be used in 6.3.X but may not be avail‐
2791       able in future fetchmail versions.
2792
2793       If fetchmail is running in daemon mode as non-root, use SIGUSR1 to wake
2794       it  (this  is  so SIGHUP due to logout can retain the default action of
2795       killing it).
2796
2797       Running fetchmail in foreground while a background fetchmail is running
2798       will do whichever of these is appropriate to wake it up.
2799
2800

BUGS, LIMITATIONS, AND KNOWN PROBLEMS

2802       Please  check  the NEWS file that shipped with fetchmail for more known
2803       bugs than those listed here.
2804
2805       Fetchmail cannot handle user names that  contain  blanks  after  a  "@"
2806       character, for instance "demonstr@ti on". These are rather uncommon and
2807       only hurt when using UID-based --keep setups, so the 6.3.X versions  of
2808       fetchmail won't be fixed.
2809
2810       Fetchmail cannot handle configurations where you have multiple accounts
2811       that use the same server name and the same login. Any user@server  com‐
2812       bination must be unique.
2813
2814       The  assumptions  that the DNS and in particular the checkalias options
2815       make are not often sustainable. For instance, it  has  become  uncommon
2816       for  an  MX server to be a POP3 or IMAP server at the same time. There‐
2817       fore the MX lookups may go away in a future release.
2818
2819       The mda and plugin options interact badly.  In order to  collect  error
2820       status from the MDA, fetchmail has to change its normal signal handling
2821       so that dead plugin processes don't get reaped until  the  end  of  the
2822       poll  cycle.   This  can  cause resource starvation if too many zombies
2823       accumulate.  So either don't deliver to a MDA  using  plugins  or  risk
2824       being overrun by an army of undead.
2825
2826       The  --interface  option does not support IPv6 and it is doubtful if it
2827       ever will, since there is no  portable  way  to  query  interface  IPv6
2828       addresses.
2829
2830       The  RFC822  address  parser  used  in  multidrop  mode  chokes on some
2831       @-addresses that are technically legal but bizarre.   Strange  uses  of
2832       quoting and embedded comments are likely to confuse it.
2833
2834       In  a  message  with  multiple envelope headers, only the last one pro‐
2835       cessed will be visible to fetchmail.
2836
2837       Use of some of these protocols requires that  the  program  send  unen‐
2838       crypted  passwords  over the TCP/IP connection to the mailserver.  This
2839       creates a risk that name/password pairs might be snaffled with a packet
2840       sniffer  or  more  sophisticated  monitoring software.  Under Linux and
2841       FreeBSD, the --interface option can be  used  to  restrict  polling  to
2842       availability  of  a  specific interface device with a specific local or
2843       remote IP address, but snooping is still possible if  (a)  either  host
2844       has a network device that can be opened in promiscuous mode, or (b) the
2845       intervening network link can be tapped.  We recommend the use of ssh(1)
2846       tunnelling  to  not  only  shroud your passwords but encrypt the entire
2847       conversation.
2848
2849       Use of the %F or %T escapes in an mda  option  could  open  a  security
2850       hole, because they pass text manipulable by an attacker to a shell com‐
2851       mand.  Potential shell characters are replaced by '_' before execution.
2852       The hole is further reduced by the fact that fetchmail temporarily dis‐
2853       cards any suid privileges it may have while running the MDA.  For maxi‐
2854       mum  safety, however, don't use an mda command containing %F or %T when
2855       fetchmail is run from the root account itself.
2856
2857       Fetchmail's method of sending bounces due to  errors  or  spam-blocking
2858       and  spam  bounces  requires that port 25 of localhost be available for
2859       sending mail via SMTP.
2860
2861       If you modify ~/.fetchmailrc while a background instance is running and
2862       break  the syntax, the background instance will die silently.  Unfortu‐
2863       nately, it can't die noisily because we don't yet know  whether  syslog
2864       should  be  enabled.   On  some systems, fetchmail dies quietly even if
2865       there is no syntax error; this seems to have something to do with buggy
2866       terminal ioctl code in the kernel.
2867
2868       The  -f  -  option (reading a configuration from stdin) is incompatible
2869       with the plugin option.
2870
2871       The 'principal' option only handles Kerberos IV, not V.
2872
2873       Interactively entered passwords are truncated after 63  characters.  If
2874       you  really  need to use a longer password, you will have to use a con‐
2875       figuration file.
2876
2877       A backslash as the last character  of  a  configuration  file  will  be
2878       flagged as a syntax error rather than ignored.
2879
2880       The  BSMTP error handling is virtually nonexistent and may leave broken
2881       messages behind.
2882
2883       Send comments, bug reports, gripes, and the like to the fetchmail-devel
2884       list ⟨fetchmail-devel@lists.sourceforge.net⟩
2885
2886
2887       An  HTML  FAQ  ⟨https://fetchmail.sourceforge.io/fetchmail-FAQ.html⟩ is
2888       available at the fetchmail home page, it  should  also  accompany  your
2889       installation.
2890
2891

AUTHOR

2893       Fetchmail  is currently maintained by Matthias Andree and Rob Funk with
2894       major assistance from Sunil Shetye (for code) and  Rob  MacGregor  (for
2895       the mailing lists).
2896
2897       Most of the code is from Eric S. Raymond ⟨esr@snark.thyrsus.com⟩ .  Too
2898       many other people to name here have contributed code and patches.
2899
2900       This program is descended from and replaces popclient, by  Carl  Harris
2901       ⟨ceharris@mal.com⟩  ;  the  internals  have become quite different, but
2902       some of its interface design is directly traceable  to  that  ancestral
2903       program.
2904
2905       This  manual page has been improved by Matthias Andree, R. Hannes Bein‐
2906       ert, and Héctor García.
2907
2908

SEE ALSO

2910       README, README.SSL, README.SSL-SERVER, The Fetchmail FAQ ⟨https://
2911       www.fetchmail.info/fetchmail-FAQ.html⟩, mutt(1), elm(1), mail(1), send‐
2912       mail(8), popd(8), imapd(8), netrc(5).
2913
2914       The fetchmail home page.  ⟨https://www.fetchmail.info/
2915
2916       The fetchmail home page (alternative URI).  ⟨https://
2917       fetchmail.sourceforge.io/⟩
2918
2919       The maildrop home page.  ⟨https://www.courier-mta.org/maildrop/
2920

APPLICABLE STANDARDS

2922       Note that this list is just a collection of references and not a state‐
2923       ment as to the actual protocol conformance or  requirements  in  fetch‐
2924       mail.
2925
2926       SMTP/ESMTP:
2927            RFC  821,  RFC  2821,  RFC 1869, RFC 1652, RFC 1870, RFC 1983, RFC
2928            1985, RFC 2554.
2929
2930       mail:
2931            RFC 822, RFC 2822, RFC 1123, RFC 1892, RFC 1894.
2932
2933       POP2:
2934            RFC 937
2935
2936       POP3:
2937            RFC 1081, RFC 1225, RFC 1460, RFC 1725, RFC 1734,  RFC  1939,  RFC
2938            1957, RFC 2195, RFC 2449.
2939
2940       APOP:
2941            RFC 1939.
2942
2943       RPOP:
2944            RFC 1081, RFC 1225.
2945
2946       IMAP2/IMAP2BIS:
2947            RFC 1176, RFC 1732.
2948
2949       IMAP4/IMAP4rev1:
2950            RFC  1730,  RFC  1731, RFC 1732, RFC 2060, RFC 2061, RFC 2195, RFC
2951            2177, RFC 2683.
2952
2953       ETRN:
2954            RFC 1985.
2955
2956       ODMR/ATRN:
2957            RFC 2645.
2958
2959       OTP: RFC 1938.
2960
2961       LMTP:
2962            RFC 2033.
2963
2964       GSSAPI:
2965            RFC 1508, RFC 1734, Generic Security Service Application Program
2966            Interface (GSSAPI)/Kerberos/Simple Authentication and Security
2967            Layer (SASL) Service Names ⟨https://www.iana.org/assignments/
2968            gssapi-service-names/⟩.
2969
2970       TLS: RFC 2595.
2971
2972
2973
2974fetchmail 6.4.16                  2021-01-30                      fetchmail(1)
Impressum