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       If fetchmail is used with a POP or an IMAP server, it has two fundamen‐
34       tal modes of operation for each user account from  which  it  retrieves
35       mail:  singledrop-  and  multidrop-mode.  In singledrop-mode, fetchmail
36       assumes that all messages in the user's account are intended for a sin‐
37       gle  recipient.   An  individual mail message will not be inspected for
38       recipient information, rather,  the  identity  of  the  recipient  will
39       either default to the local user currently executing fetchmail, or else
40       will need to be explicitly specified in the configuration  file.   Sin‐
41       gledrop-mode  is  used  when  the fetchmailrc configuration contains at
42       most a single local user specification for a given server account.
43
44       With multidrop-mode, fetchmail is not able to assume that there is only
45       a  single  recipient,  but rather that the mail server account actually
46       contains mail intended for any number of different recipients.   There‐
47       fore,  fetchmail must attempt to deduce the proper "envelope recipient"
48       from the mail headers of each message.   In  this  mode  of  operation,
49       fetchmail almost resembles an MTA, however it is important to note that
50       neither the POP nor IMAP protocols were intended for use in this  fash‐
51       ion,  and  hence  envelope information is often not directly available.
52       Instead, fetchmail must resort to a process of informed  guess-work  in
53       an attempt to discover the true envelope recipient of a message, unless
54       the ISP stores the envelope information in some header  (not  all  do).
55       Even  if this information is present in the headers, the process can be
56       error-prone and is dependent upon the specific  mail  server  used  for
57       mail  retrieval.   Multidrop-mode is used when more than one local user
58       is specified for a particular server account in the configuration file.
59       Note  that  the  forgoing discussion of singledrop- and multidrop-modes
60       does not apply to the ESMTP ETRN or ODMR retrieval methods, since  they
61       are  based upon the SMTP protocol which specifically provides the enve‐
62       lope recipient to fetchmail.
63
64       As each message is retrieved, fetchmail normally delivers it  via  SMTP
65       to  port 25 on the machine it is running on (localhost), just as though
66       it were being passed in over a normal TCP/IP link.  fetchmail  provides
67       the  SMTP  server  with  an  envelope  recipient  derived in the manner
68       described previously.  The mail will then be delivered locally via your
69       system's  MDA (Mail Delivery Agent, usually sendmail(8) but your system
70       may use a different one such as smail, mmdf, exim, postfix, or  qmail).
71       All  the  delivery-control mechanisms (such as .forward files) normally
72       available through your system MDA and local delivery agents will there‐
73       fore work automatically.
74
75       If  no  port 25 listener is available, but your fetchmail configuration
76       was told about a reliable local MDA, it will use  that  MDA  for  local
77       delivery instead.
78
79       If  the  program fetchmailconf is available, it will assist you in set‐
80       ting up and editing a fetchmailrc configuration.  It runs under  the  X
81       window  system and requires that the language Python and the Tk toolkit
82       be present on your system.  If you are first setting up  fetchmail  for
83       single-user  mode,  it is recommended that you use Novice mode.  Expert
84       mode provides complete control of  fetchmail  configuration,  including
85       the  multidrop  features.   In either case, the 'Autoprobe' button will
86       tell you the most capable protocol a  given  mailserver  supports,  and
87       warn you of potential problems with that server.
88
89

GENERAL OPERATION

91       The  behavior  of fetchmail is controlled by command-line options and a
92       run control file, ~/.fetchmailrc, the syntax of which we describe in  a
93       later  section  (this  file  is  what the fetchmailconf program edits).
94       Command-line options override ~/.fetchmailrc declarations.
95
96       Each server name that you specify following the options on the  command
97       line  will be queried.  If you don't specify any servers on the command
98       line, each 'poll' entry in your ~/.fetchmailrc file will be queried.
99
100       To facilitate the use of fetchmail in scripts and pipelines, it returns
101       an appropriate exit code upon termination -- see EXIT CODES below.
102
103       The  following  options modify the behavior of fetchmail.  It is seldom
104       necessary to specify any of these once you have a working  .fetchmailrc
105       file set up.
106
107       Almost  all  options  have a corresponding keyword which can be used to
108       declare them in a .fetchmailrc file.
109
110       Some special options are not covered here, but are  documented  instead
111       in sections on AUTHENTICATION and DAEMON MODE which follow.
112
113   General Options
114       -V | --version
115              Displays the version information for your copy of fetchmail.  No
116              mail fetch is performed.  Instead, for  each  server  specified,
117              all  the  option information that would be computed if fetchmail
118              were connecting to that server is displayed.  Any non-printables
119              in  passwords  or other string names are shown as backslashed C-
120              like escape sequences.  This option is useful for verifying that
121              your options are set the way you want them.
122
123       -c | --check
124              Return  a status code to indicate whether there is mail waiting,
125              without actually fetching  or  deleting  mail  (see  EXIT  CODES
126              below).  This option turns off daemon mode (in which it would be
127              useless).  It doesn't play well with queries to multiple  sites,
128              and doesn't work with ETRN or ODMR.  It will return a false pos‐
129              itive if you leave read but undeleted mail in your server  mail‐
130              box  and  your  fetch protocol can't tell kept messages from new
131              ones.  This means it will work with IMAP, not  work  with  POP2,
132              and may occasionally flake out under POP3.
133
134       -s | --silent
135              Silent  mode.   Suppresses all progress/status messages that are
136              normally echoed to standard output during a fetch (but does  not
137              suppress actual error messages).  The --verbose option overrides
138              this.
139
140       -v | --verbose
141              Verbose mode.  All control messages passed between fetchmail and
142              the  mailserver are echoed to stdout.  Overrides --silent.  Dou‐
143              bling this option (-v -v) causes extra diagnostic information to
144              be printed.
145
146   Disposal Options
147       -a | --all | (since v6.3.3) --fetchall
148              (Keyword: fetchall, since v3.0) Retrieve both old (seen) and new
149              messages from the mailserver.  The default is to fetch only mes‐
150              sages  the  server has not marked seen.  Under POP3, this option
151              also forces the use of RETR rather than  TOP.   Note  that  POP2
152              retrieval  behaves  as  though --all is always on (see RETRIEVAL
153              FAILURE MODES below) and this option does not work with ETRN  or
154              ODMR.   While  the -a and --all command-line and fetchall rcfile
155              options have been supported for a long time, the --fetchall com‐
156              mand-line option was added in v6.3.3.
157
158       -k | --keep
159              (Keyword:   keep)   Keep   retrieved   messages  on  the  remote
160              mailserver.  Normally, messages are deleted from the  folder  on
161              the  mailserver  after they have been retrieved.  Specifying the
162              keep option causes retrieved messages to remain in  your  folder
163              on the mailserver.  This option does not work with ETRN or ODMR.
164              If used with POP3, it is recommended to also specify the  --uidl
165              option or uidl keyword.
166
167       -K | --nokeep
168              (Keyword:  nokeep)  Delete  retrieved  messages  from the remote
169              mailserver.  This option forces retrieved mail  to  be  deleted.
170              It may be useful if you have specified a default of keep in your
171              .fetchmailrc.  This option is forced on with ETRN and ODMR.
172
173       -F | --flush
174              POP3/IMAP only.  This is a dangerous option and can  cause  mail
175              loss  when  used improperly. It deletes old (seen) messages from
176              the mailserver before retrieving new  messages.   Warning:  This
177              can  cause  mail  loss if you check your mail with other clients
178              than fetchmail, and cause fetchmail to delete a message  it  had
179              never  fetched  before.  It can also cause mail loss if the mail
180              server marks the message seen after retrieval  (IMAP2  servers).
181              You  should  probably  not use this option in your configuration
182              file. If you use it with POP3, you must use the  'uidl'  option.
183              What  you  probably  want  is  the default setting: if you don't
184              specify '-k', then fetchmail will automatically delete  messages
185              after successful delivery.
186
187       --limitflush
188              POP3/IMAP  only, since version 6.3.0.  Delete oversized messages
189              from the mailserver before retrieving  new  messages.  The  size
190              limit  should  be  separately specified with the --limit option.
191              This option does not work with ETRN or ODMR.
192
193   Protocol and Query Options
194       -p <proto> | --proto <proto> | --protocol <proto>
195              (Keyword: proto[col]) Specify the protocol to use when  communi‐
196              cating with the remote mailserver.  If no protocol is specified,
197              the default is AUTO.  proto may be one of the following:
198
199              AUTO   Tries IMAP, POP3, and POP2 (skipping  any  of  these  for
200                     which support has not been compiled in).
201
202              POP2   Post Office Protocol 2 (legacy, to be removed from future
203                     release)
204
205              POP3   Post Office Protocol 3
206
207              APOP   Use POP3 with old-fashioned MD5-challenge authentication.
208
209              RPOP   Use POP3 with RPOP authentication.
210
211              KPOP   Use POP3 with Kerberos V4 authentication on port 1109.
212
213              SDPS   Use POP3 with Demon Internet's SDPS extensions.
214
215              IMAP   IMAP2bis, IMAP4, or  IMAP4rev1  (fetchmail  automatically
216                     detects their capabilities).
217
218              ETRN   Use the ESMTP ETRN option.
219
220              ODMR   Use the the On-Demand Mail Relay ESMTP profile.
221
222       All  these  alternatives  work in basically the same way (communicating
223       with standard server daemons to fetch mail already delivered to a mail‐
224       box  on  the server) except ETRN and ODMR.  The ETRN mode allows you to
225       ask a compliant ESMTP server (such as BSD sendmail at release 8.8.0  or
226       higher)  to  immediately  open  a sender-SMTP connection to your client
227       machine and begin forwarding any items addressed to your client machine
228       in  the server's queue of undelivered mail.   The ODMR mode requires an
229       ODMR-capable server and works similarly to ETRN, except  that  it  does
230       not require the client machine to have a static DNS.
231
232       -U | --uidl
233              (Keyword:  uidl)  Force  UIDL  use  (effective  only with POP3).
234              Force client-side tracking of 'newness' of messages (UIDL stands
235              for  "unique ID listing" and is described in RFC1939).  Use with
236              'keep' to use a mailbox as a baby  news  drop  for  a  group  of
237              users. The fact that seen messages are skipped is logged, unless
238              error logging is done through syslog  while  running  in  daemon
239              mode.   Note that fetchmail may automatically enable this option
240              depending on upstream server capabilities.  Note also that  this
241              option  may  be removed and forced enabled in a future fetchmail
242              version. See also: --idfile.
243
244       --idle (since 6.3.3)
245              (Keyword: idle, since before 6.0.0) Enable IDLE  use  (effective
246              only  with IMAP). Note that this works with only one folder at a
247              given time.  While the idle rcfile keyword  had  been  supported
248              for  a  long  time,  the --idle command-line option was added in
249              version 6.3.3. IDLE use means  that  fetchmail  tells  the  IMAP
250              server  to send notice of new messages, so they can be retrieved
251              sooner than would be possible with regular polls.
252
253       -P <portnumber> | --service <servicename>
254              (Keyword: service) Since version 6.3.0.  The service option per‐
255              mits you to specify a service name to connect to.  You can spec‐
256              ify a decimal port number here, if your services database  lacks
257              the  required service-port assignments. See the FAQ item R12 and
258              the --ssl documentation for details.  This  replaces  the  older
259              --port option.
260
261       --port <portnumber>
262              (Keyword: port) Obsolete version of --service that does not take
263              service names.  Note: this option may be removed from  a  future
264              version.
265
266       --principal <principal>
267              (Keyword: principal) The principal option permits you to specify
268              a service principal for mutual authentication.  This is applica‐
269              ble to POP3 or IMAP with Kerberos authentication.
270
271       -t <seconds> | --timeout <seconds>
272              (Keyword:  timeout)  The  timeout  option  allows  you  to set a
273              server-nonresponse timeout in seconds.  If a mailserver does not
274              send  a  greeting  message  or respond to commands for the given
275              number of seconds, fetchmail will hang up on it.  Without such a
276              timeout  fetchmail  might  hang  up indefinitely trying to fetch
277              mail from a down host.  This would be particularly annoying  for
278              a  fetchmail  running in background.  There is a default timeout
279              which fetchmail -V will report.  If a given connection  receives
280              too  many  timeouts  in  succession,  fetchmail will consider it
281              wedged and stop retrying, the calling user will be  notified  by
282              email if this happens.
283
284       --plugin <command>
285              (Keyword:  plugin) The plugin option allows you to use an exter‐
286              nal program to establish the TCP connection.  This is useful  if
287              you  want  to  use  socks,  SSL, ssh, or need some special fire‐
288              walling setup.  The program will be looked up in $PATH  and  can
289              optionally  be  passed  the hostname and port as arguments using
290              "%h" and "%p" respectively (note that the interpolation logic is
291              rather  primitive, and these token must be bounded by whitespace
292              or beginning of string or end of string).  Fetchmail will  write
293              to the plugin's stdin and read from the plugin's stdout.
294
295       --plugout <command>
296              (Keyword:  plugout)  Identical  to  the plugin option above, but
297              this one is used for the SMTP connections (which  will  probably
298              not need it, so it has been separated from plugin).
299
300       -r <name> | --folder <name>
301              (Keyword:  folder[s]) Causes a specified non-default mail folder
302              on the mailserver (or comma-separated list  of  folders)  to  be
303              retrieved.   The  syntax of the folder name is server-dependent.
304              This option is not available under POP3, ETRN, or ODMR.
305
306       --tracepolls
307              (Keyword: tracepolls) Tell fetchmail to poll  trace  information
308              in  the  form  'polling  %s  account  %s' and 'folder %s' to the
309              Received line it generates, where the %s parts are  replaced  by
310              the user's remote name, the poll label, and the folder (mailbox)
311              where available (the Received header also normally includes  the
312              server's  true  name).  This can be used to facilitate mail fil‐
313              tering based on the account  it  is  being  received  from.  The
314              folder information is written only since version 6.3.4.
315
316       --ssl  (Keyword:  ssl)  Causes  the connection to the mail server to be
317              encrypted via SSL.  Connect to the server  using  the  specified
318              base  protocol  over  a  connection  secured by SSL. This option
319              defeats TLS negotiation. Use --sslcertck to  validate  the  cer‐
320              tificates presented by the server.
321
322              Note  that fetchmail may still try to negotiate TLS even if this
323              option is not given. You can use the --sslproto option to defeat
324              this  behavior  or  tell fetchmail to negotiate a particular SSL
325              protocol.
326
327              If no port is specified, the connection is attempted to the well
328              known  port  of  the  SSL version of the base protocol.  This is
329              generally a different port than the port used by the base proto‐
330              col.  For IMAP, this is port 143 for the clear protocol and port
331              993 for the SSL secured protocol, for POP3, it is port  110  for
332              the clear text and port 995 for the encrypted variant.
333
334              If  your  system  lacks the corresponding entries from /etc/ser‐
335              vices, see the --service option and  specify  the  numeric  port
336              number  as  given in the previous paragraph (unless your ISP had
337              directed you to different ports, which is uncommon however).
338
339       --sslcert <name>
340              (Keyword: sslcert) Specifies the file name of  the  client  side
341              public  SSL certificate.  Some SSL encrypted servers may require
342              client side keys and certificates for authentication.   In  most
343              cases,  this  is  optional.   This specifies the location of the
344              public key certificate to be presented to the server at the time
345              the  SSL session is established.  It is not required (but may be
346              provided) if the server does not require it.  Some  servers  may
347              require  it, some servers may request it but not require it, and
348              some servers may not request it at all.  It may be the same file
349              as  the private key (combined key and certificate file) but this
350              is not recommended.
351
352              NOTE: If you use client authentication, the user name is fetched
353              from  the  certificate's  CommonName  and overrides the name set
354              with --user.
355
356       --sslkey <name>
357              (Keyword: sslkey) Specifies the file name  of  the  client  side
358              private  SSL key.  Some SSL encrypted servers may require client
359              side keys and certificates for authentication.  In  most  cases,
360              this  is  optional.   This specifies the location of the private
361              key used to sign transactions with the server at  the  time  the
362              SSL session is established.  It is not required (but may be pro‐
363              vided) if the server does not  require  it.   Some  servers  may
364              require  it, some servers may request it but not require it, and
365              some servers may not request it at all.  It may be the same file
366              as  the  public key (combined key and certificate file) but this
367              is not recommended.  If a password is  required  to  unlock  the
368              key,  it  will  be prompted for at the time just prior to estab‐
369              lishing the session to the server.  This can cause some  compli‐
370              cations in daemon mode.
371
372       --sslproto <name>
373              (Keyword: sslproto) Forces an SSL or TLS protocol. Possible val‐
374              ues are 'SSL2', 'SSL3', 'SSL23', and 'TLS1'.  Try  this  if  the
375              default handshake does not work for your server. Use this option
376              with negotiation when the server advertises  STARTTLS  or  STLS,
377              use  ''.  This option, even if the argument is the empty string,
378              will also suppress the diagnostic 'SERVER: opportunistic upgrade
379              to  TLS.'  message in verbose mode. The default is to try appro‐
380              priate protocols depending on context.
381
382       --sslcertck
383              (Keyword: sslcertck) Causes  fetchmail  to  strictly  check  the
384              server  certificate  against a set of local trusted certificates
385              (see the sslcertpath option). If the server  certificate  cannot
386              be  obtained  or  is  not  signed  by  one  of  the trusted ones
387              (directly or indirectly), the SSL connection will fail,  regard‐
388              less  of the sslfingerprint option.  Note that CRL are only sup‐
389              ported in OpenSSL 0.9.7 and newer! Your system clock should also
390              be reasonably accurate when using this option.
391
392              Note  that this optional behavior may become default behavior in
393              future fetchmail versions.
394
395       --sslcertpath <directory>
396              (Keyword: sslcertpath) Sets the directory fetchmail uses to look
397              up  local certificates. The default is your OpenSSL default one.
398              The directory must be hashed as OpenSSL expects it - every  time
399              you  add  or  modify a certificate in the directory, you need to
400              use the c_rehash tool (which comes with OpenSSL  in  the  tools/
401              subdirectory).
402
403       --sslfingerprint <fingerprint>
404              (Keyword:  sslfingerprint) Specify the fingerprint of the server
405              key (an MD5 hash of the key) in hexadecimal notation with colons
406              separating  groups  of two digits. The letter hex digits must be
407              in upper case. This is the default format OpenSSL uses, and  the
408              one fetchmail uses to report the fingerprint when an SSL connec‐
409              tion is established. When this is specified, fetchmail will com‐
410              pare the server key fingerprint with the given one, and the con‐
411              nection will fail  if  they  do  not  match  regardless  of  the
412              sslcertck  setting.  The  connection will also fail if fetchmail
413              cannot obtain an SSL certificate from the server.  This  can  be
414              used  to prevent man-in-the-middle attacks, but the finger print
415              from the server needs to be obtained or verified over  a  secure
416              channel,  and  certainly  not  over the same Internet connection
417              that fetchmail would use.
418
419              Using this option will prevent printing certificate verification
420              errors as long as --sslcertck is unset.
421
422              To  obtain  the  fingerprint of a certificate stored in the file
423              cert.pem, try:
424
425                   openssl x509 -in cert.pem -noout -md5 -fingerprint
426
427              For details, see x509(1ssl).
428
429   Delivery Control Options
430       -S <hosts> | --smtphost <hosts>
431              (Keyword: smtp[host]) Specify a hunt list of  hosts  to  forward
432              mail  to  (one  or  more  hostnames, comma-separated). Hosts are
433              tried in list order; the first one that is up becomes  the  for‐
434              warding target for the current run.  If this option is not spec‐
435              ified, 'localhost' is used as the default.   Each  hostname  may
436              have  a port number following the host name.  The port number is
437              separated from the host name by a slash;  the  default  port  is
438              "smtp".   If you specify an absolute path name (beginning with a
439              /), it will be interpreted as the name of a UNIX socket  accept‐
440              ing  LMTP  connections  (such  as is supported by the Cyrus IMAP
441              daemon) Example:
442
443                   --smtphost server1,server2/2525,server3,/var/imap/socket/lmtp
444
445              This option can be used with ODMR, and  will  make  fetchmail  a
446              relay between the ODMR server and SMTP or LMTP receiver.
447
448       --fetchdomains <hosts>
449              (Keyword: fetchdomains) In ETRN or ODMR mode, this option speci‐
450              fies the list of domains the server should ship  mail  for  once
451              the connection is turned around.  The default is the FQDN of the
452              machine running fetchmail.
453
454       -D <domain> | --smtpaddress <domain>
455              (Keyword: smtpaddress) Specify the  domain  to  be  appended  to
456              addresses  in  RCPT  TO  lines shipped to SMTP. When this is not
457              specified, the name of the SMTP server (as specified  by  --smt‐
458              phost)  is  used  for SMTP/LMTP and 'localhost' is used for UNIX
459              socket/BSMTP.
460
461       --smtpname <user@domain>
462              (Keyword: smtpname) Specify the domain and user  to  be  put  in
463              RCPT  TO lines shipped to SMTP.  The default user is the current
464              local user.
465
466       -Z <nnn> | --antispam <nnn[, nnn]...>
467              (Keyword: antispam) Specifies the list of  numeric  SMTP  errors
468              that  are  to  be  interpreted as a spam-block response from the
469              listener.  A value of -1 disables this option.  For the command-
470              line option, the list values should be comma-separated.
471
472       -m <command> | --mda <command>
473              (Keyword:  mda)  You  can  force  mail  to  be  passed to an MDA
474              directly (rather than forwarded to port 25) with the --mda or -m
475              option.   To  avoid  losing mail, use this option only with MDAs
476              like maildrop or MTAs like sendmail that return a nonzero status
477              on  disk-full  and other resource-exhaustion errors; the nonzero
478              status tells fetchmail that delivery  failed  and  prevents  the
479              message from being deleted off the server.  If fetchmail is run‐
480              ning as root, it sets its user id to that  of  the  target  user
481              while  delivering  mail  through an MDA.  Some possible MDAs are
482              "/usr/sbin/sendmail -i -f %F -- %T" (Note: some several older or
483              vendor  sendmail versions mistake -- for an address, rather than
484              an  indicator  to  mark  the  end  of  the  option   arguments),
485              "/usr/bin/deliver"  and "/usr/bin/maildrop -d %T".  Local deliv‐
486              ery addresses will be inserted into the MDA command wherever you
487              place  a  %T;  the  mail message's From address will be inserted
488              where you place an %F. DO NOT ENCLOSE THE %F  OR  %T  STRING  IN
489              SINGLE  QUOTES!  For  both  %T  and  %F,  fetchmail encloses the
490              addresses in single quotes ('), after removing any single quotes
491              they may contain, before the MDA command is passed to the shell.
492              Do NOT use an MDA invocation like "sendmail  -i  -t"  that  dis‐
493              patches  on the contents of To/Cc/Bcc, it will create mail loops
494              and bring the just wrath of  many  postmasters  down  upon  your
495              head.   Also,  do  not try to combine multidrop mode with an MDA
496              such as maildrop that can only accept one address; you will lose
497              mail.
498
499              A  word  of  warning: the well-known procmail(1) package is very
500              hard to configure properly, it has a very nasty "fall through to
501              the next rule" behavior on delivery errors (even temporary ones,
502              such as out of disk space if another user's mail  daemon  copies
503              the mailbox around to purge old messages), so your mail will end
504              up in the wrong mailbox sooner or  later.  The  proper  procmail
505              configuration  is  outside  the  scope  of this document though.
506              Using maildrop(1) is usually much easier, and  many  users  find
507              the filter syntax used by maildrop easier to understand.
508
509
510       --lmtp (Keyword:  lmtp)  Cause  delivery  via LMTP (Local Mail Transfer
511              Protocol).  A service host and port must be explicitly specified
512              on  each  host  in  the  smtphost  hunt list (see above) if this
513              option is selected; the default port 25 will (in accordance with
514              RFC 2033) not be accepted.
515
516       --bsmtp <filename>
517              (keyword: bsmtp) Append fetched mail to a BSMTP file.  This sim‐
518              ply contains the SMTP commands that would normally be  generated
519              by  fetchmail  when passing mail to an SMTP listener daemon.  An
520              argument of '-' causes the mail to be written to  standard  out‐
521              put.  Note that fetchmail's reconstruction of MAIL FROM and RCPT
522              TO lines is not guaranteed correct; the caveats discussed  under
523              THE USE AND ABUSE OF MULTIDROP MAILBOXES below apply.
524
525   Resource Limit Control Options
526       -l <maxbytes> | --limit <maxbytes>
527              (Keyword:  limit) Takes a maximum octet size argument.  Messages
528              larger than this size will not be fetched and will  be  left  on
529              the  server  (in foreground sessions, the progress messages will
530              note that they are "oversized").  If the fetch protocol  permits
531              (in  particular, under IMAP or POP3 without the fetchall option)
532              the message will not be marked seen.
533
534              An explicit --limit of 0 overrides any limits set  in  your  run
535              control  file.  This  option  is  intended  for those needing to
536              strictly control fetch time due to expensive and variable  phone
537              rates.
538
539              Combined  with  --limitflush, it can be used to delete oversized
540              messages waiting on a server.  In daemon mode, oversize  notifi‐
541              cations  are  mailed  to  the  calling  user (see the --warnings
542              option). This option does not work with ETRN or ODMR.
543
544       -w <interval> | --warnings <interval>
545              (Keyword: warnings) Takes an interval in seconds.  When you call
546              fetchmail  with  a  'limit' option in daemon mode, this controls
547              the interval at which  warnings  about  oversized  messages  are
548              mailed  to the calling user (or the user specified by the 'post‐
549              master' option).  One such notification is always mailed at  the
550              end  of  the  the  first  poll  that  the  oversized  message is
551              detected.  Thereafter, re-notification is suppressed until after
552              the  warning  interval elapses (it will take place at the end of
553              the first following poll).
554
555       -b <count> | --batchlimit <count>
556              (Keyword: batchlimit) Specify the  maximum  number  of  messages
557              that  will  be shipped to an SMTP listener before the connection
558              is deliberately torn down and rebuilt (defaults to 0, meaning no
559              limit).   An explicit --batchlimit of 0 overrides any limits set
560              in your run control file.  While sendmail(8) normally  initiates
561              delivery  of  a  message immediately after receiving the message
562              terminator, some SMTP listeners are not so  prompt.   MTAs  like
563              smail(8)  may  wait  till  the  delivery  socket is shut down to
564              deliver.  This may produce annoying  delays  when  fetchmail  is
565              processing  very large batches.  Setting the batch limit to some
566              nonzero size will prevent these delays.  This  option  does  not
567              work with ETRN or ODMR.
568
569       -B <number> | --fetchlimit <number>
570              (Keyword: fetchlimit) Limit the number of messages accepted from
571              a given server in a single poll.  By default there is no  limit.
572              An  explicit  --fetchlimit of 0 overrides any limits set in your
573              run control file.  This option does not work with ETRN or ODMR.
574
575       --fetchsizelimit <number>
576              (Keyword: fetchsizelimit) Limit the number of sizes of  messages
577              accepted  from  a  given  server  in a single transaction.  This
578              option is useful in reducing the delay in downloading the  first
579              mail  when there are too many mails in the mailbox.  By default,
580              the limit is 100.  If set to 0, sizes of all messages are  down‐
581              loaded  at  the  start.   This option does not work with ETRN or
582              ODMR.  For POP3, the only valid non-zero value is 1.
583
584       --fastuidl <number>
585              (Keyword: fastuidl) Do a binary instead of linear search for the
586              first  unseen  UID. Binary search avoids downloading the UIDs of
587              all mails. This saves time (especially  in  daemon  mode)  where
588              downloading  the  same  set  of  UIDs in each poll is a waste of
589              bandwidth. The number 'n' indicates how rarely a  linear  search
590              should  be done. In daemon mode, linear search is used once fol‐
591              lowed by binary searches in 'n-1' polls if 'n' is  greater  than
592              1;  binary  search  is always used if 'n' is 1; linear search is
593              always used if 'n' is 0. In non-daemon mode,  binary  search  is
594              used  if  'n' is 1; otherwise linear search is used. The default
595              value of 'n' is 4.  This option works with POP3 only.
596
597       -e <count> | --expunge <count>
598              (keyword: expunge) Arrange for deletions to be made final  after
599              a  given number of messages.  Under POP2 or POP3, fetchmail can‐
600              not make deletions final without sending  QUIT  and  ending  the
601              session -- with this option on, fetchmail will break a long mail
602              retrieval session into multiple sub-sessions, sending QUIT after
603              each  sub-session.  This is a good defense against line drops on
604              POP3 servers.  Under IMAP, fetchmail normally issues an  EXPUNGE
605              command after each deletion in order to force the deletion to be
606              done immediately.  This is safest when your  connection  to  the
607              server  is flaky and expensive, as it avoids resending duplicate
608              mail after a line hit.  However, on large mailboxes the overhead
609              of  re-indexing  after  every message can slam the server pretty
610              hard, so if your  connection  is  reliable  it  is  good  to  do
611              expunges less frequently.  Also note that some servers enforce a
612              delay of a few seconds after each quit, so fetchmail may not  be
613              able  to get back in immediately after an expunge -- you may see
614              "lock busy" errors if this happens. If you specify  this  option
615              to  an  integer  N, it tells fetchmail to only issue expunges on
616              every Nth delete.   An  argument  of  zero  suppresses  expunges
617              entirely  (so  no  expunges at all will be done until the end of
618              run).  This option does not work with ETRN or ODMR.
619
620   Authentication Options
621       -u <name> | --user <name> | --username <name>
622              (Keyword: user[name]) Specifies the user  identification  to  be
623              used  when  logging  in to the mailserver.  The appropriate user
624              identification is both server and user-dependent.   The  default
625              is  your login name on the client machine that is running fetch‐
626              mail.  See USER AUTHENTICATION below for a complete description.
627
628       -I <specification> | --interface <specification>
629              (Keyword: interface) Require that a specific interface device be
630              up  and  have  a specific local or remote IPv4 (IPv6 is not sup‐
631              ported by this option yet) address (or  range)  before  polling.
632              Frequently  fetchmail  is  used  over a transient point-to-point
633              TCP/IP link established directly to a  mailserver  via  SLIP  or
634              PPP.   That  is  a  relatively  secure  channel.  But when other
635              TCP/IP routes to the mailserver exist (e.g.  when  the  link  is
636              connected  to  an alternate ISP), your username and password may
637              be vulnerable to snooping (especially when daemon mode automati‐
638              cally  polls for mail, shipping a clear password over the net at
639              predictable intervals).  The --interface option may be  used  to
640              prevent  this.  When the specified link is not up or is not con‐
641              nected to a matching IP address, polling will be  skipped.   The
642              format is:
643
644                   interface/iii.iii.iii.iii[/mmm.mmm.mmm.mmm]
645
646              The  field  before  the  first slash is the interface name (i.e.
647              sl0, ppp0 etc.).  The field  before  the  second  slash  is  the
648              acceptable  IP  address.   The field after the second slash is a
649              mask which specifies a range of IP addresses to accept.   If  no
650              mask  is  present  255.255.255.255  is  assumed  (i.e.  an exact
651              match).  This option is currently only supported under Linux and
652              FreeBSD.  Please  see  the monitor section for below for FreeBSD
653              specific information.
654
655              Note that this option may be removed  from  a  future  fetchmail
656              version.
657
658       -M <interface> | --monitor <interface>
659              (Keyword:  monitor)  Daemon mode can cause transient links which
660              are automatically taken down after a period of inactivity  (e.g.
661              PPP  links) to remain up indefinitely.  This option identifies a
662              system TCP/IP interface to be  monitored  for  activity.   After
663              each  poll interval, if the link is up but no other activity has
664              occurred on the link, then the poll will be  skipped.   However,
665              when  fetchmail  is  woken  up by a signal, the monitor check is
666              skipped and the poll goes through unconditionally.  This  option
667              is  currently  only  supported under Linux and FreeBSD.  For the
668              monitor and interface options to work for non root  users  under
669              FreeBSD,  the fetchmail binary must be installed SGID kmem. This
670              would be a security hole, but fetchmail runs with the  effective
671              GID  set  to  that of the kmem group only when interface data is
672              being collected.
673
674              Note that this option may be removed  from  a  future  fetchmail
675              version.
676
677       --auth <type>
678              (Keyword:  auth[enticate]) This option permits you to specify an
679              authentication type (see USER AUTHENTICATION below for details).
680              The  possible  values  are  any, password, kerberos_v5, kerberos
681              (or, for excruciating exactness, kerberos_v4), gssapi, cram-md5,
682              otp,  ntlm,  msn  (only for POP3), external (only IMAP) and ssh.
683              When any (the default) is specified, fetchmail tries first meth‐
684              ods  that  don't  require  a  password  (EXTERNAL,  GSSAPI, KER‐
685              BEROS IV, KERBEROS 5); then it looks for methods that mask  your
686              password (CRAM-MD5, X-OTP - note that NTLM and MSN are not auto‐
687              probed for POP3 and MSN is only supported for POP3); and only if
688              the  server doesn't support any of those will it ship your pass‐
689              word en clair.  Other  values  may  be  used  to  force  various
690              authentication  methods  (ssh  suppresses  authentication and is
691              thus useful for IMAP PREAUTH).  (external suppresses authentica‐
692              tion  and  is  thus  useful for IMAP EXTERNAL).  Any value other
693              than password, cram-md5, ntlm, msn or otp suppresses fetchmail's
694              normal  inquiry  for a password.  Specify ssh when you are using
695              an end-to-end secure connection such as an ssh  tunnel;  specify
696              external when you use TLS with client authentication and specify
697              gssapi or kerberos_v4 if you are using a protocol  variant  that
698              employs  GSSAPI  or  K4.   Choosing  KPOP protocol automatically
699              selects Kerberos authentication.  This option does not work with
700              ETRN.
701
702   Miscellaneous Options
703       -f <pathname> | --fetchmailrc <pathname>
704              Specify  a  non-default  name for the ~/.fetchmailrc run control
705              file.  The pathname argument must be either "-" (a single  dash,
706              meaning  to  read  the  configuration  from standard input) or a
707              filename.  Unless the --version option is also on, a named  file
708              argument   must   have   permissions  no  more  open  than  0600
709              (u=rw,g=,o=) or else be /dev/null.
710
711       -i <pathname> | --idfile <pathname>
712              (Keyword: idfile) Specify an alternate name  for  the  .fetchids
713              file  used to save POP3 UIDs. NOTE: since fetchmail 6.3.0, write
714              access to the directory containing the idfile  is  required,  as
715              fetchmail  writes a temporary file and renames it into the place
716              of the real idfile only if the temporary file has  been  written
717              successfully. This avoids the truncation of idfiles when running
718              out of disk space.
719
720       --pidfile <pathname>
721              (Keyword: pidfile; since fetchmail v6.3.4) Override the  default
722              location of the PID file. Default: see "ENVIRONMENT" below.
723
724       -n | --norewrite
725              (Keyword:  no rewrite) Normally, fetchmail edits RFC-822 address
726              headers (To, From, Cc, Bcc, and Reply-To)  in  fetched  mail  so
727              that  any  mail  IDs  local  to  the server are expanded to full
728              addresses (@ and the mailserver hostname  are  appended).   This
729              enables replies on the client to get addressed correctly (other‐
730              wise your mailer might think they should be addressed  to  local
731              users  on  the  client  machine!).  This option disables the re‐
732              write.  (This option is provided to pacify people who are  para‐
733              noid about having an MTA edit mail headers and want to know they
734              can prevent it, but it is generally not a good idea to  actually
735              turn  off rewrite.)  When using ETRN or ODMR, the rewrite option
736              is ineffective.
737
738       -E <line> | --envelope <line>
739              (Keyword: envelope; Multidrop only)
740              In the configuration file, an enhanced syntax is used:
741              envelope [<count>] <line>
742
743              This option changes the header fetchmail assumes  will  carry  a
744              copy  of the mail's envelope address.  Normally this is 'X-Enve‐
745              lope-To', but as this header is not standard,  practice  varies.
746              See  the  discussion  of multidrop address handling below.  As a
747              special case, 'envelope "Received"' enables parsing of sendmail-
748              style Received lines.  This is the default, and it should not be
749              necessary unless you have  globally  disabled  Received  parsing
750              with 'no envelope' in the .fetchmailrc file.
751
752              The optional count argument (only available in the configuration
753              file) determines how many header lines of this kind are skipped.
754              A  count of 1 means: skip the first, take the second. A count of
755              2 means: skip the first and second, take the third, and so on.
756
757       -Q <prefix> | --qvirtual <prefix>
758              (Keyword: qvirtual; Multidrop only) The string  prefix  assigned
759              to  this  option will be removed from the user name found in the
760              header specified with the envelope  option  (before  doing  mul‐
761              tidrop name mapping or localdomain checking, if either is appli‐
762              cable). This option is useful if you are using fetchmail to col‐
763              lect  the  mail  for an entire domain and your ISP (or your mail
764              redirection provider) is using qmail.  One of the basic features
765              of qmail is the
766
767              'Delivered-To:'
768
769              message  header.   Whenever  qmail delivers a message to a local
770              mailbox it puts the username and hostname of the envelope recip‐
771              ient on this line.  The major reason for this is to prevent mail
772              loops.  To set up qmail to batch mail for  a  disconnected  site
773              the ISP-mailhost will have normally put that site in its 'Virtu‐
774              alhosts' control file so it  will  add  a  prefix  to  all  mail
775              addresses  for  this  site.  This results in mail sent to 'user‐
776              name@userhost.userdom.dom.com' having a 'Delivered-To:' line  of
777              the form:
778
779              Delivered-To: mbox-userstr-username@userhost.example.com
780
781              The ISP can make the 'mbox-userstr-' prefix anything they choose
782              but a string matching the user host name is  likely.   By  using
783              the option 'envelope Delivered-To:' you can make fetchmail reli‐
784              ably identify the original envelope recipient, but you  have  to
785              strip the 'mbox-userstr-' prefix to deliver to the correct user.
786              This is what this option is for.
787
788       --configdump
789              Parse  the  ~/.fetchmailrc  file,  interpret  any   command-line
790              options  specified,  and dump a configuration report to standard
791              output.  The configuration report is a data structure assignment
792              in the language Python.  This option is meant to be used with an
793              interactive ~/.fetchmailrc editor like fetchmailconf, written in
794              Python.
795
796   Removed Options
797       -T | --netsec
798              Removed before version 6.3.0, the required underlying inet6_apps
799              library had been discontinued and is no longer available.
800
801

USER AUTHENTICATION AND ENCRYPTION

803       All modes except ETRN require  authentication  of  the  client  to  the
804       server.   Normal user authentication in fetchmail is very much like the
805       authentication mechanism of ftp(1).  The correct user-id  and  password
806       depend upon the underlying security system at the mailserver.
807
808       If  the mailserver is a Unix machine on which you have an ordinary user
809       account, your regular login name and password are used with  fetchmail.
810       If  you  use  the  same  login  name  on both the server and the client
811       machines, you needn't worry about specifying  a  user-id  with  the  -u
812       option  -- the default behavior is to use your login name on the client
813       machine as the user-id on the server machine.  If you use  a  different
814       login  name  on the server machine, specify that login name with the -u
815       option.  e.g. if your login name is 'jsmith' on a machine named  'mail‐
816       grunt', you would start fetchmail as follows:
817
818              fetchmail -u jsmith mailgrunt
819
820       The  default behavior of fetchmail is to prompt you for your mailserver
821       password before the connection is established.  This is the safest  way
822       to  use  fetchmail  and  ensures that your password will not be compro‐
823       mised.  You may also specify your password in your ~/.fetchmailrc file.
824       This is convenient when using fetchmail in daemon mode or with scripts.
825
826   Using netrc files
827       If you do not specify a password, and fetchmail cannot extract one from
828       your ~/.fetchmailrc file, it will look for a ~/.netrc file in your home
829       directory before requesting one interactively; if an entry matching the
830       mailserver is found in that file, the password will be used.  Fetchmail
831       first looks for a match on poll name; if it finds none, it checks for a
832       match on via name.  See the ftp(1) man page for details of  the  syntax
833       of the ~/.netrc file.  To show a practical example, a .netrc might look
834       like this:
835
836              machine hermes.example.org
837              login joe
838              password topsecret
839
840       You can repeat this block with different user information if  you  need
841       to provide more than one password.
842
843       This feature may allow you to avoid duplicating password information in
844       more than one file.
845
846       On mailservers that do not provide ordinary user accounts, your user-id
847       and  password are usually assigned by the server administrator when you
848       apply for a mailbox on the server.  Contact your  server  administrator
849       if  you  don't  know  the correct user-id and password for your mailbox
850       account.
851

POP3 VARIANTS

853       Early versions of POP3 (RFC1081, RFC1225) supported  a  crude  form  of
854       independent  authentication  using  the  rhosts  file on the mailserver
855       side.  Under this RPOP variant, a fixed per-user  ID  equivalent  to  a
856       password  was  sent  in  clear over a link to a reserved port, with the
857       command RPOP rather than PASS to alert the server  that  it  should  do
858       special  checking.   RPOP  is  supported  by fetchmail (you can specify
859       'protocol RPOP' to have the program send 'RPOP' rather than 'PASS') but
860       its  use  is  strongly  discouraged, and support will be removed from a
861       future fetchmail version.  This facility was vulnerable to spoofing and
862       was withdrawn in RFC1460.
863
864       RFC1460  introduced  APOP authentication.  In this variant of POP3, you
865       register an APOP password on your server host (the program to  do  this
866       with  on  the  server is probably called popauth(8)).  You put the same
867       password in your ~/.fetchmailrc file.  Each time fetchmail logs in,  it
868       sends  a  cryptographically secure hash of your password and the server
869       greeting time to the server, which can verify it by checking its autho‐
870       rization database.
871
872   RETR or TOP
873       fetchmail  makes  some  efforts to make the server believe messages had
874       not been retrieved, by using the TOP command with  a  large  number  of
875       lines  when  possible.  TOP is a command that retrieves the full header
876       and a fetchmail-specified amount of body  lines.  It  is  optional  and
877       therefore  not implemented by all servers, and some are known to imple‐
878       ment it improperly. On many servers however,  the  RETR  command  which
879       retrieves  the  full message with header and body, sets the "seen" flag
880       (for instance, in a web interface), whereas the TOP command does not do
881       that.
882
883       fetchmail  will  always  use  the  RETR  command  if "fetchall" is set.
884       fetchmail will also use the RETR command if "keep" is set and "uidl" is
885       unset.   Finally,  fetchmail  will  use the RETR command on Maillennium
886       POP3/PROXY servers (used by Comcast) to avoid a deliberate  TOP  misin‐
887       terpretation in this server that causes message corruption.
888
889       In  all  other  cases, fetchmail will use the TOP command. This implies
890       that in "keep" setups, "uidl" must be set if "TOP" is desired.
891
892       Note that this description is true for the current  version  of  fetch‐
893       mail,  but  the  behavior may change in future versions. In particular,
894       fetchmail may prefer the RETR command because the  TOP  command  causes
895       much grief on some servers and is only optional.
896

ALTERNATE AUTHENTICATION FORMS

898       If  your fetchmail was built with Kerberos support and you specify Ker‐
899       beros authentication (either with --auth  or  the  .fetchmailrc  option
900       authenticate kerberos_v4) it will try to get a Kerberos ticket from the
901       mailserver at the start of each query.  Note: if either the pollname or
902       via  name  is 'hesiod', fetchmail will try to use Hesiod to look up the
903       mailserver.
904
905       If you use POP3 or IMAP  with  GSSAPI  authentication,  fetchmail  will
906       expect  the  server to have RFC1731- or RFC1734-conforming GSSAPI capa‐
907       bility, and will use it.  Currently this has only been tested over Ker‐
908       beros  V,  so you're expected to already have a ticket-granting ticket.
909       You may pass a username different from your principal  name  using  the
910       standard --user command or by the .fetchmailrc option user.
911
912       If  your IMAP daemon returns the PREAUTH response in its greeting line,
913       fetchmail will notice this and skip  the  normal  authentication  step.
914       This  can  be useful, e.g. if you start imapd explicitly using ssh.  In
915       this case you can declare the authentication value 'ssh' on  that  site
916       entry  to stop .fetchmail from asking you for a password when it starts
917       up.
918
919       If you use client authentication with TLS1 and your IMAP daemon returns
920       the AUTH=EXTERNAL response, fetchmail will notice this and will use the
921       authentication shortcut and will not send the passphrase. In this  case
922       you can declare the authentication value 'external'
923        on  that site to stop fetchmail from asking you for a password when it
924       starts up.
925
926       If you are using POP3, and the server issues a one-time-password  chal‐
927       lenge conforming to RFC1938, fetchmail will use your password as a pass
928       phrase to generate the required response. This avoids  sending  secrets
929       over the net unencrypted.
930
931       Compuserve's  RPA authentication (similar to APOP) is supported. If you
932       compile in the support, fetchmail will try  to  perform  an  RPA  pass-
933       phrase  authentication instead of sending over the password en clair if
934       it detects "@compuserve.com" in the hostname.
935
936       If you are using IMAP, Microsoft's NTLM authentication (used by  Micro‐
937       soft  Exchange)  is supported. If you compile in the support, fetchmail
938       will try to perform an NTLM authentication (instead of sending over the
939       password  en  clair) whenever the server returns AUTH=NTLM in its capa‐
940       bility  response.  Specify  a  user  option  value  that   looks   like
941       'user@domain':  the  part  to  the  left of the @ will be passed as the
942       username and the part to the right as the NTLM domain.
943
944   Secure Socket Layers (SSL) and Transport Layer Security (TLS)
945       You can access SSL encrypted services by specifying the  --ssl  option.
946       You  can  also  do this using the "ssl" user option in the .fetchmailrc
947       file. With SSL encryption enabled, queries are initiated over a connec‐
948       tion  after negotiating an SSL session, and the connection fails if SSL
949       cannot be negotiated.  Some services, such as POP3 and IMAP, have  dif‐
950       ferent  well  known  ports defined for the SSL encrypted services.  The
951       encrypted ports will be selected automatically when SSL is enabled  and
952       no  explicit  port  is  specified. The --sslproto option can be used to
953       select the SSL protocols (default: v2 or v3).  The --sslcertck  command
954       line  or  sslcertck  run  control  file  option should be used to force
955       strict certificate checking - see below.
956
957       If SSL is not configured, fetchmail will usually opportunistically  try
958       to use TLS. TLS can be enforced by using --sslproto "TLS1". TLS connec‐
959       tions use the same port as the unencrypted version of the protocol  and
960       negotiate  TLS  via  special parameter. The --sslcertck command line or
961       sslcertck run control file option should be used to force  strict  cer‐
962       tificate checking - see below.
963
964       --sslcheck  recommended:  When  connecting  to  an SSL or TLS encrypted
965       server, the server presents a certificate to the client for validation.
966       The  certificate  is checked to verify that the common name in the cer‐
967       tificate matches the name of the server being contacted  and  that  the
968       effective  and  expiration dates in the certificate indicate that it is
969       currently valid.  If any of these checks fail,  a  warning  message  is
970       printed, but the connection continues.  The server certificate does not
971       need to be signed by any specific Certifying Authority  and  may  be  a
972       "self-signed"  certificate.  If  the --sslcertck command line option or
973       sslcertck run control file option is used, fetchmail will instead abort
974       if any of these checks fail. Use of the sslcertck or --sslcertck option
975       is advised.
976
977       Some SSL encrypted servers may request a client  side  certificate.   A
978       client  side  public  SSL certificate and private SSL key may be speci‐
979       fied.  If requested by the server, the client certificate  is  sent  to
980       the  server  for  validation.   Some servers may require a valid client
981       certificate and may refuse connections if a certificate is not provided
982       or  if  the  certificate is not valid.  Some servers may require client
983       side certificates be signed by a recognized Certifying Authority.   The
984       format  for the key files and the certificate files is that required by
985       the underlying SSL libraries (OpenSSL in the general case).
986
987       A word of care about the use of SSL: While above mentioned  setup  with
988       self-signed  server  certificates  retrieved over the wires can protect
989       you from a passive eavesdropper, it  doesn't  help  against  an  active
990       attacker.  It's  clearly  an  improvement over sending the passwords in
991       clear, but you should be aware that a man-in-the-middle attack is triv‐
992       ially  possible  (in  particular with tools such as dsniff, http://mon
993       key.org/~dugsong/dsniff/).  Use of strict certificate checking  with  a
994       certification  authority recognized by server and client, or perhaps of
995       an SSH tunnel (see below for some examples) is preferable if  you  care
996       seriously about the security of your mailbox and passwords.
997
998   ESMTP AUTH
999       fetchmail  also  supports  authentication  to  the  ESMTP server on the
1000       client side according to RFC 2554.  You  can  specify  a  name/password
1001       pair  to be used with the keywords 'esmtpname' and 'esmtppassword'; the
1002       former defaults to the username of the calling user.
1003
1004

DAEMON MODE

1006   Introducing the daemon mode
1007       In daemon mode, fetchmail puts itself into the background and runs for‐
1008       ever,  querying  each  specified  host  and  then  sleeping for a given
1009       polling interval.
1010
1011   Starting the daemon mode
1012       There are several ways to make fetchmail work in daemon  mode.  On  the
1013       command  line,  --daemon <interval> or -d <interval> option runs fetch‐
1014       mail in daemon mode.  You must specify a numeric argument  which  is  a
1015       polling interval in seconds.
1016
1017       Example: simply invoking
1018
1019              fetchmail -d 900
1020
1021       will,  therefore,  poll  all the hosts described in your ~/.fetchmailrc
1022       file (except those explicitly excluded with the 'skip' verb) once every
1023       15 minutes.
1024
1025       It  is  also  possible to set a polling interval in your ~/.fetchmailrc
1026       file by saying 'set daemon <interval>', where <interval> is an  integer
1027       number of seconds.  If you do this, fetchmail will always start in dae‐
1028       mon mode unless you override it with the command-line option --daemon 0
1029       or -d0.
1030
1031       Only  one  daemon process is permitted per user; in daemon mode, fetch‐
1032       mail sets up a per-user lockfile to guarantee this.  (You  can  however
1033       cheat  and  set the FETCHMAILHOME environment variable to overcome this
1034       setting, but in that case, it is your responsibility to make  sure  you
1035       aren't polling the same server with two processes at the same time.)
1036
1037   Awakening the background daemon
1038       Normally,  calling  fetchmail  with  a daemon in the background sends a
1039       wake-up signal to the daemon and quits without output.  The  background
1040       daemon  then  starts its next poll cycle immediately.  The wake-up sig‐
1041       nal, SIGUSR1, can also be sent manually. The wake-up action also clears
1042       any authentication or multiple timeouts.
1043
1044   Terminating the background daemon
1045       The  option --quit will kill a running daemon process instead of waking
1046       it up (if there is no such process, fetchmail will notify you.  If  the
1047       --quit option appears last on the command line, fetchmail will kill the
1048       running daemon process and then quit. Otherwise, fetchmail  will  first
1049       kill  a running daemon process and then continue running with the other
1050       options.
1051
1052   Useful options for daemon mode
1053       The -L <filename> or --logfile <filename> option (keyword: set logfile)
1054       is only effective when fetchmail is detached. This option allows you to
1055       redirect status messages into a specified logfile  (follow  the  option
1056       with  the logfile name).  The logfile is opened for append, so previous
1057       messages aren't deleted.  This is primarily useful for  debugging  con‐
1058       figurations.  Note  that  fetchmail  does  not detect if the logfile is
1059       rotated, the logfile is only opened once  when  fetchmail  starts.  You
1060       need  to  restart  fetchmail after rotating the logfile and before com‐
1061       pressing it (if applicable).
1062
1063       The --syslog option (keyword: set syslog) allows you to redirect status
1064       and error messages emitted to the syslog(3) system daemon if available.
1065       Messages are logged with an id of fetchmail, the facility LOG_MAIL, and
1066       priorities LOG_ERR, LOG_ALERT or LOG_INFO.  This option is intended for
1067       logging status and error messages which indicate the status of the dae‐
1068       mon and the results while fetching mail from the server(s).  Error mes‐
1069       sages for command line options and parsing the  .fetchmailrc  file  are
1070       still  written to stderr, or to the specified log file.  The --nosyslog
1071       option turns off use of syslog(3),  assuming  it's  turned  on  in  the
1072       ~/.fetchmailrc  file,  or  that  the  -L or --logfile <file> option was
1073       used.
1074
1075       The -N or --nodetach option suppresses backgrounding and detachment  of
1076       the  daemon  process  from  its  control  terminal.  This is useful for
1077       debugging or when fetchmail runs as the child of a  supervisor  process
1078       such as init(8) or Gerrit Pape's runit.  Note that this also causes the
1079       logfile option to be ignored (though perhaps it shouldn't).
1080
1081       Note that while running in daemon  mode  polling  a  POP2  or  IMAP2bis
1082       server,  transient  errors  (such  as DNS failures or sendmail delivery
1083       refusals) may force the fetchall option on for the duration of the next
1084       polling  cycle.  This is a robustness feature.  It means that if a mes‐
1085       sage is fetched (and thus marked seen by the mailserver) but not deliv‐
1086       ered  locally due to some transient error, it will be re-fetched during
1087       the next poll cycle.  (The IMAP logic  doesn't  delete  messages  until
1088       they're delivered, so this problem does not arise.)
1089
1090       If  you touch or change the ~/.fetchmailrc file while fetchmail is run‐
1091       ning in daemon mode, this will be detected at the beginning of the next
1092       poll  cycle.   When  a  changed  ~/.fetchmailrc  is detected, fetchmail
1093       rereads it and restarts from scratch (using exec(2); no state  informa‐
1094       tion is retained in the new instance).  Note also that if you break the
1095       ~/.fetchmailrc file's syntax, the new instance will softly and silently
1096       vanish away on startup.
1097
1098

ADMINISTRATIVE OPTIONS

1100       The  --postmaster <name> option (keyword: set postmaster) specifies the
1101       last-resort username to which multidrop mail is to be forwarded  if  no
1102       matching  local  recipient can be found. It is also used as destination
1103       of undeliverable mail if the 'bouncemail'  global  option  is  off  and
1104       additionally for spam-blocked mail if the 'bouncemail' global option is
1105       off and the 'spambounce' global option is on. This option  defaults  to
1106       the user who invoked fetchmail.  If the invoking user is root, then the
1107       default of this option is the user 'postmaster'.  Setting postmaster to
1108       the  empty string causes such mail as described above to be discarded -
1109       this however is usually a bad idea.  See also the  description  of  the
1110       'FETCHMAILUSER' environment variable in the ENVIRONMENT section below.
1111
1112       The  --nobounce  behaves  like  the  "set no bouncemail" global option,
1113       which see.
1114
1115       The --invisible option (keyword: set invisible) tries to make fetchmail
1116       invisible.   Normally, fetchmail behaves like any other MTA would -- it
1117       generates a Received header into each message describing its  place  in
1118       the  chain  of  transmission, and tells the MTA it forwards to that the
1119       mail came from the machine fetchmail itself  is  running  on.   If  the
1120       invisible option is on, the Received header is suppressed and fetchmail
1121       tries to spoof the MTA it forwards to into thinking  it  came  directly
1122       from the mailserver host.
1123
1124       The  --showdots option (keyword: set showdots) forces fetchmail to show
1125       progress dots even if the current tty is not stdout (for  example  log‐
1126       files).   Fetchmail shows the dots by default when run in nodetach mode
1127       or when daemon mode is not enabled.
1128
1129       By specifying the --tracepolls option, you can  ask  fetchmail  to  add
1130       information to the Received header on the form "polling {label} account
1131       {user}", where {label} is the account label (from the specified rcfile,
1132       normally  ~/.fetchmailrc)  and  {user} is the username which is used to
1133       log on to the mail server. This header can be used  to  make  filtering
1134       email where no useful header information is available and you want mail
1135       from different accounts sorted into different  mailboxes  (this  could,
1136       for  example, occur if you have an account on the same server running a
1137       mailing list, and are subscribed to the list using that  account).  The
1138       default is not adding any such header.  In .fetchmailrc, this is called
1139       'tracepolls'.
1140
1141

RETRIEVAL FAILURE MODES

1143       The protocols fetchmail uses to talk to mailservers are next to bullet‐
1144       proof.   In  normal operation forwarding to port 25, no message is ever
1145       deleted (or even marked for deletion) on the host until the  SMTP  lis‐
1146       tener on the client side has acknowledged to fetchmail that the message
1147       has been either accepted for delivery or rejected due to a spam block.
1148
1149       When forwarding to an MDA, however, there is more possibility of error.
1150       Some MDAs are 'safe' and reliably return a nonzero status on any deliv‐
1151       ery error, even one due to temporary resource limits.  The  maildrop(1)
1152       program  is  like this; so are most programs designed as mail transport
1153       agents, such as sendmail(1), including the sendmail wrapper of  Postfix
1154       and exim(1).  These programs give back a reliable positive acknowledge‐
1155       ment and can be used with the mda option with no  risk  of  mail  loss.
1156       Unsafe  MDAs,  though,  may return 0 even on delivery failure.  If this
1157       happens, you will lose mail.
1158
1159       The normal mode of fetchmail is to try to download only 'new' messages,
1160       leaving  untouched  (and  undeleted)  messages  you  have  already read
1161       directly on the server (or fetched with a previous  fetchmail  --keep).
1162       But  you  may  find that messages you've already read on the server are
1163       being fetched (and deleted) even when you don't specify  --all.   There
1164       are several reasons this can happen.
1165
1166       One  could  be  that  you're using POP2.  The POP2 protocol includes no
1167       representation of 'new' or 'old' state in messages, so  fetchmail  must
1168       treat  all messages as new all the time.  But POP2 is obsolete, so this
1169       is unlikely.
1170
1171       A potential POP3 problem might be servers that insert messages  in  the
1172       middle of mailboxes (some VMS implementations of mail are rumored to do
1173       this).  The fetchmail code assumes that new messages  are  appended  to
1174       the  end  of  the  mailbox; when this is not true it may treat some old
1175       messages as new and vice versa.  Using UIDL whilst setting  fastuidl  0
1176       might fix this, otherwise, consider switching to IMAP.
1177
1178       Yet  another  POP3  problem is that if they can't make tempfiles in the
1179       user's home directory, some POP3 servers will hand back an undocumented
1180       response that causes fetchmail to spuriously report "No mail".
1181
1182       The  IMAP code uses the presence or absence of the server flag \Seen to
1183       decide whether or not a message is new.  This isn't the right thing  to
1184       do,  fetchmail should check the UIDVALIDITY and use UID, but it doesn't
1185       do that yet. Under Unix, it counts on your IMAP server  to  notice  the
1186       BSD-style  Status  flags set by mail user agents and set the \Seen flag
1187       from them when appropriate.  All Unix IMAP servers we know of do  this,
1188       though  it's  not  specified by the IMAP RFCs.  If you ever trip over a
1189       server that doesn't, the symptom will be that messages you have already
1190       read  on  your  host  will  look new to the server.  In this (unlikely)
1191       case, only messages you fetched with  fetchmail  --keep  will  be  both
1192       undeleted and marked old.
1193
1194       In  ETRN and ODMR modes, fetchmail does not actually retrieve messages;
1195       instead, it asks the server's SMTP listener to start a queue  flush  to
1196       the client via SMTP.  Therefore it sends only undelivered messages.
1197
1198

SPAM FILTERING

1200       Many  SMTP listeners allow administrators to set up 'spam filters' that
1201       block unsolicited email from specified domains.  A MAIL  FROM  or  DATA
1202       line  that  triggers  this  feature  will elicit an SMTP response which
1203       (unfortunately) varies according to the listener.
1204
1205       Newer versions of sendmail return an error code of 571.
1206
1207       According to RFC2821, the correct thing to return in this situation  is
1208       550  "Requested  action not taken: mailbox unavailable" (the draft adds
1209       "[E.g., mailbox not found, no access, or command  rejected  for  policy
1210       reasons].").
1211
1212       Older  versions  of the exim MTA return 501 "Syntax error in parameters
1213       or arguments".
1214
1215       The postfix MTA runs 554 as an antispam response.
1216
1217       Zmailer may reject code with a 500 response (followed  by  an  enhanced
1218       status code that contains more information).
1219
1220       Return  codes which fetchmail treats as antispam responses and discards
1221       the message can be set with the 'antispam' option.  This is one of  the
1222       only  three  circumstance under which fetchmail ever discards mail (the
1223       others are the 552 and 553 errors described below, and the  suppression
1224       of multidropped messages with a message-ID already seen).
1225
1226       If  fetchmail  is  fetching  from an IMAP server, the antispam response
1227       will be detected and the message rejected immediately after the headers
1228       have  been  fetched, without reading the message body.  Thus, you won't
1229       pay for downloading spam message bodies.
1230
1231       By default, the list of antispam responses is empty.
1232
1233       If the spambounce global option is on, mail that is spam-blocked  trig‐
1234       gers an RFC1892/RFC1894 bounce message informing the originator that we
1235       do not accept mail from it. See also BUGS.
1236
1237

SMTP/ESMTP ERROR HANDLING

1239       Besides the spam-blocking  described  above,  fetchmail  takes  special
1240       actions on the following SMTP/ESMTP error responses
1241
1242       452 (insufficient system storage)
1243            Leave the message in the server mailbox for later retrieval.
1244
1245       552 (message exceeds fixed maximum message size)
1246            Delete the message from the server.  Send bounce-mail to the orig‐
1247            inator.
1248
1249       553 (invalid sending domain)
1250            Delete the message from  the  server.   Don't  even  try  to  send
1251            bounce-mail to the originator.
1252
1253       Other errors trigger bounce mail back to the originator. See also BUGS.
1254
1255

THE RUN CONTROL FILE

1257       The  preferred  way to set up fetchmail is to write a .fetchmailrc file
1258       in your home directory (you may do this directly, with a  text  editor,
1259       or indirectly via fetchmailconf).  When there is a conflict between the
1260       command-line arguments and the arguments in this file, the command-line
1261       arguments take precedence.
1262
1263       To  protect the security of your passwords, your ~/.fetchmailrc may not
1264       normally have more than 0600 (u=rw,g=,o=) permissions;  fetchmail  will
1265       complain and exit otherwise (this check is suppressed when --version is
1266       on).
1267
1268       You may read the .fetchmailrc file as a list of commands to be executed
1269       when fetchmail is called with no arguments.
1270
1271   Run Control Syntax
1272       Comments begin with a '#' and extend through the end of the line.  Oth‐
1273       erwise the file consists of a series of server entries or global option
1274       statements in a free-format, token-oriented syntax.
1275
1276       There are four kinds of tokens: grammar keywords, numbers (i.e. decimal
1277       digit sequences), unquoted  strings,  and  quoted  strings.   A  quoted
1278       string  is  bounded  by  double  quotes and may contain whitespace (and
1279       quoted digits are treated as a string).  Note that quoted strings  will
1280       also contain line feed characters if they run across two or more lines,
1281       unless you use a backslash to join  lines  (see  below).   An  unquoted
1282       string  is  any  whitespace-delimited  token  that  is neither numeric,
1283       string quoted nor contains the special characters  ',',  ';',  ':',  or
1284       '='.
1285
1286       Any  amount  of  whitespace  separates tokens in server entries, but is
1287       otherwise ignored. You may use backslash escape sequences (\n  for  LF,
1288       \t  for  HT,  \b  for BS, \r for CR, \nnn for decimal (where nnn cannot
1289       start with a 0), \0ooo for octal, and \xhh for hex) to embed non-print‐
1290       able  characters or string delimiters in strings.  In quoted strings, a
1291       backslash at the very end of a line will cause the backslash itself and
1292       the line feed (LF or NL, new line) character to be ignored, so that you
1293       can wrap long strings. Without the backslash at the line end, the  line
1294       feed character would become part of the string.
1295
1296       Warning:  while  these  resemble C-style escape sequences, they are not
1297       the same.  fetchmail only supports these eight styles. C supports  more
1298       escape  sequences that consist of backslash (\) and a single character,
1299       but does not support decimal codes and does not require the  leading  0
1300       in octal notation.  Example: fetchmail interprets \233 the same as \xE9
1301       (Latin small letter e with acute), where  C  would  interpret  \233  as
1302       octal 0233 = \x9B (CSI, control sequence introducer).
1303
1304       Each  server  entry  consists  of one of the keywords 'poll' or 'skip',
1305       followed by a server name, followed by server options, followed by  any
1306       number  of  user  descriptions.   Note: the most common cause of syntax
1307       errors is mixing up user and server options.
1308
1309       For backward compatibility, the word 'server' is a synonym for 'poll'.
1310
1311       You can use the noise  keywords  'and',  'with',  'has',  'wants',  and
1312       'options'  anywhere  in  an entry to make it resemble English.  They're
1313       ignored, but but can make entries much easier to read at a glance.  The
1314       punctuation characters ':', ';' and ',' are also ignored.
1315
1316   Poll vs. Skip
1317       The  'poll' verb tells fetchmail to query this host when it is run with
1318       no arguments.  The 'skip' verb tells fetchmail not to  poll  this  host
1319       unless  it  is  explicitly named on the command line.  (The 'skip' verb
1320       allows you to experiment with test entries safely,  or  easily  disable
1321       entries for hosts that are temporarily down.)
1322
1323   Keyword/Option Summary
1324       Here are the legal options.  Keyword suffixes enclosed in square brack‐
1325       ets are optional.  Those corresponding to  short  command-line  options
1326       are  followed  by  '-' and the appropriate option letter.  If option is
1327       only relevant to a single mode of operation, it is noted as 's' or  'm'
1328       for singledrop- or multidrop-mode, respectively.
1329
1330       Here are the legal global options:
1331
1332
1333       Keyword             Opt   Mode   Function
1334       ────────────────────────────────────────────────────────────────────
1335       set daemon          -d           Set  a background poll interval in
1336                                        seconds.
1337       set postmaster                   Give the name of  the  last-resort
1338                                        mail recipient (default: user run‐
1339                                        ning  fetchmail,  "postmaster"  if
1340                                        run by the root user)
1341       set    bouncemail                Direct  error  mail  to the sender
1342                                        (default)
1343       set no bouncemail                Direct error  mail  to  the  local
1344                                        postmaster  (as  per the 'postmas‐
1345                                        ter' global option above).
1346       set no spambounce                Do not  bounce  spam-blocked  mail
1347                                        (default).
1348       set    spambounce                Bounce  blocked  spam-blocked mail
1349                                        (as  per   the   'antispam'   user
1350                                        option) back to the destination as
1351                                        indicated  by   the   'bouncemail'
1352                                        global  option.   Warning:  Do not
1353                                        use this to bounce  spam  back  to
1354                                        the  sender  -  most  spam is sent
1355                                        with false sender address and thus
1356                                        this    option    hurts   innocent
1357                                        bystanders.
1358       set logfile         -L           Name of a file to append error and
1359                                        status messages to.
1360       set idfile          -i           Name  of  the  file  to  store UID
1361                                        lists in.
1362       set    syslog                    Do  error  logging  through   sys‐
1363                                        log(3).
1364       set no syslog                    Turn  off  error  logging  through
1365                                        syslog(3). (default)
1366       set properties                   String value that  is  ignored  by
1367                                        fetchmail  (may  be used by exten‐
1368                                        sion scripts).
1369
1370       Here are the legal server options:
1371
1372
1373       Keyword          Opt   Mode   Function
1374       ─────────────────────────────────────────────────────────────────
1375       via                           Specify DNS  name  of  mailserver,
1376                                     overriding poll name
1377
1378
1379       proto[col]       -p           Specify  protocol  (case  insensi‐
1380                                     tive):  POP2,  POP3,  IMAP,  APOP,
1381                                     KPOP
1382       local[domains]         m      Specify  domain(s)  to be regarded
1383                                     as local
1384       port                          Specify TCP/IP service port (obso‐
1385                                     lete, use 'service' instead).
1386       service          -P           Specify  service  name  (a numeric
1387                                     value is also allowed and  consid‐
1388                                     ered a TCP/IP port number).
1389       auth[enticate]                Set  authentication  type (default
1390                                     'any')
1391       timeout          -t           Server inactivity timeout in  sec‐
1392                                     onds (default 300)
1393       envelope         -E    m      Specify   envelope-address  header
1394                                     name
1395       no envelope            m      Disable   looking   for   envelope
1396                                     address
1397       qvirtual         -Q    m      Qmail  virtual  domain  prefix  to
1398                                     remove from user name
1399       aka                    m      Specify  alternate  DNS  names  of
1400                                     mailserver
1401       interface        -I           specify  IP interface(s) that must
1402                                     be up  for  server  poll  to  take
1403                                     place
1404       monitor          -M           Specify  IP address to monitor for
1405                                     activity
1406       plugin                        Specify command through  which  to
1407                                     make server connections.
1408       plugout                       Specify  command  through which to
1409                                     make listener connections.
1410       dns                    m      Enable DNS  lookup  for  multidrop
1411                                     (default)
1412       no dns                 m      Disable DNS lookup for multidrop
1413       checkalias             m      Do  comparison  by  IP address for
1414                                     multidrop
1415       no checkalias          m      Do comparison  by  name  for  mul‐
1416                                     tidrop (default)
1417       uidl             -U           Force   POP3  to  use  client-side
1418                                     UIDLs (recommended)
1419       no uidl                       Turn off POP3 use  of  client-side
1420                                     UIDLs (default)
1421       interval                      Only  check this site every N poll
1422                                     cycles; N is a numeric argument.
1423       tracepolls                    Add poll  tracing  information  to
1424                                     the Received header
1425       principal                     Set  Kerberos principal (only use‐
1426                                     ful with IMAP and kerberos)
1427       esmtpname                     Set name for  RFC2554  authentica‐
1428                                     tion to the ESMTP server.
1429       esmtppassword                 Set password for RFC2554 authenti‐
1430                                     cation to the ESMTP server.
1431
1432       Here are the legal user options:
1433
1434
1435       Keyword            Opt   Mode   Function
1436       ───────────────────────────────────────────────────────────────────
1437       user[name]         -u           Set remote user name  (local  user
1438                                       name if name followed by 'here')
1439       is                              Connect   local  and  remote  user
1440                                       names
1441       to                              Connect  local  and  remote   user
1442                                       names
1443       pass[word]                      Specify remote account password
1444       ssl                             Connect  to server over the speci‐
1445                                       fied  base  protocol   using   SSL
1446                                       encryption
1447       sslcert                         Specify  file for client side pub‐
1448                                       lic SSL certificate
1449
1450
1451       sslkey                          Specify file for client side  pri‐
1452                                       vate SSL key
1453       sslproto                        Force ssl protocol for connection
1454       folder             -r           Specify remote folder to query
1455       smtphost           -S           Specify smtp host(s) to forward to
1456       fetchdomains             m      Specify  domains  for  which  mail
1457                                       should be fetched
1458       smtpaddress        -D           Specify the domain to  be  put  in
1459                                       RCPT TO lines
1460       smtpname                        Specify  the user and domain to be
1461                                       put in RCPT TO lines
1462       antispam           -Z           Specify  what  SMTP  returns   are
1463                                       interpreted as spam-policy blocks
1464       mda                -m           Specify MDA for local delivery
1465       bsmtp              -o           Specify BSMTP batch file to append
1466                                       to
1467       preconnect                      Command to be executed before each
1468                                       connection
1469       postconnect                     Command  to be executed after each
1470                                       connection
1471       keep               -k           Don't delete  seen  messages  from
1472                                       server  (for  POP3, uidl is recom‐
1473                                       mended)
1474       flush              -F           Flush  all  seen  messages  before
1475                                       querying (DANGEROUS)
1476       limitflush                      Flush   all   oversized   messages
1477                                       before querying
1478       fetchall           -a           Fetch all messages whether seen or
1479                                       not
1480       rewrite                         Rewrite  destination addresses for
1481                                       reply (default)
1482       stripcr                         Strip carriage returns  from  ends
1483                                       of lines
1484       forcecr                         Force  carriage returns at ends of
1485                                       lines
1486       pass8bits                       Force BODY=8BITMIME to ESMTP  lis‐
1487                                       tener
1488       dropstatus                      Strip  Status and X-Mozilla-Status
1489                                       lines out of incoming mail
1490       dropdelivered                   Strip Delivered-To  lines  out  of
1491                                       incoming mail
1492       mimedecode                      Convert  quoted-printable to 8-bit
1493                                       in MIME messages
1494       idle                            Idle  waiting  for  new   messages
1495                                       after each poll (IMAP only)
1496       no keep            -K           Delete  seen  messages from server
1497                                       (default)
1498       no flush                        Don't  flush  all  seen   messages
1499                                       before querying (default)
1500       no fetchall                     Retrieve    only    new   messages
1501                                       (default)
1502       no rewrite                      Don't rewrite headers
1503       no stripcr                      Don't   strip   carriage   returns
1504                                       (default)
1505       no forcecr                      Don't  force  carriage  returns at
1506                                       EOL (default)
1507       no pass8bits                    Don't force BODY=8BITMIME to ESMTP
1508                                       listener (default)
1509       no dropstatus                   Don't    drop    Status    headers
1510                                       (default)
1511       no dropdelivered                Don't  drop  Delivered-To  headers
1512                                       (default)
1513       no mimedecode                   Don't  convert quoted-printable to
1514                                       8-bit in MIME messages (default)
1515       no idle                         Don't idle waiting  for  new  mes‐
1516                                       sages after each poll (IMAP only)
1517       limit              -l           Set message size limit
1518       warnings           -w           Set message size warning interval
1519       batchlimit         -b           Max  # messages to forward in sin‐
1520                                       gle connect
1521
1522
1523       fetchlimit         -B           Max # messages to fetch in  single
1524                                       connect
1525       fetchsizelimit                  Max  #  message  sizes to fetch in
1526                                       single transaction
1527       fastuidl                        Use binary search for first unseen
1528                                       message (POP3 only)
1529       expunge            -e           Perform  an  expunge  on every #th
1530                                       message (IMAP and POP3 only)
1531       properties                      String value is ignored by  fetch‐
1532                                       mail  (may  be  used  by extension
1533                                       scripts)
1534
1535       Remember that all user options must follow all server options.
1536
1537       In the .fetchmailrc file, the 'envelope' string argument  may  be  pre‐
1538       ceded  by a whitespace-separated number.  This number, if specified, is
1539       the number of such headers to skip over (that  is,  an  argument  of  1
1540       selects  the second header of the given type).  This is sometime useful
1541       for ignoring bogus envelope headers created by an ISP's local  delivery
1542       agent  or  internal  forwards  (through  mail  inspection  systems, for
1543       instance).
1544
1545   Keywords Not Corresponding To Option Switches
1546       The 'folder' and 'smtphost' options (unlike their command-line  equiva‐
1547       lents)  can  take  a  space- or comma-separated list of names following
1548       them.
1549
1550       All options correspond to the obvious  command-line  arguments,  except
1551       the  following:  'via',  'interval', 'aka', 'is', 'to', 'dns'/'no dns',
1552       'checkalias'/'no checkalias', 'password', 'preconnect',  'postconnect',
1553       'localdomains',   'stripcr'/'no   stripcr',   'forcecr'/'no   forcecr',
1554       'pass8bits'/'no  pass8bits'  'dropstatus/no  dropstatus',   'dropdeliv‐
1555       ered/no  dropdelivered', 'mimedecode/no mimedecode', 'no idle', and 'no
1556       envelope'.
1557
1558       The 'via' option is for if you want to have more than one configuration
1559       pointing  at the same site.  If it is present, the string argument will
1560       be taken as the actual DNS name of the mailserver host to query.   This
1561       will override the argument of poll, which can then simply be a distinct
1562       label for the configuration (e.g. what you would give  on  the  command
1563       line to explicitly query this host).
1564
1565       The  'interval'  option  (which takes a numeric argument) allows you to
1566       poll a server less frequently than the basic poll interval.  If you say
1567       'interval N' the server this option is attached to will only be queried
1568       every N poll intervals.
1569
1570   Singledrop vs. Multidrop options
1571       The 'is' or  'to'  keywords  associate  the  following  local  (client)
1572       name(s)  (or  server-name  to client-name mappings separated by =) with
1573       the mailserver user name in the entry.  If an is/to list has '*' as its
1574       last  name,  unrecognized  names  are  simply passed through. Note that
1575       until fetchmail version 6.3.4 inclusively, these lists could only  con‐
1576       tain  local  parts of user names (fetchmail would only look at the part
1577       before the @ sign). fetchmail versions 6.3.5  and  newer  support  full
1578       addresses on the left hand side of these mappings, and they take prece‐
1579       dence over any 'localdomains', 'aka', 'via' or similar mappings.
1580
1581       A single local name can be used to support redirecting your  mail  when
1582       your  username on the client machine is different from your name on the
1583       mailserver.  When there is only a single local name, mail is  forwarded
1584       to  that  local  username regardless of the message's Received, To, Cc,
1585       and Bcc headers.  In this case, fetchmail never does DNS lookups.
1586
1587       When there is more than one local name  (or  name  mapping),  fetchmail
1588       looks  at  the  envelope  header,  if  configured, and otherwise at the
1589       Received, To, Cc, and Bcc headers of retrieved mail (this is 'multidrop
1590       mode').   It  looks  for  addresses with hostname parts that match your
1591       poll name or your 'via', 'aka' or 'localdomains' options,  and  usually
1592       also  for  hostname  parts  which  DNS  tells  it  are  aliases  of the
1593       mailserver.  See the discussion of 'dns', 'checkalias', 'localdomains',
1594       and 'aka' for details on how matching addresses are handled.
1595
1596       If  fetchmail  cannot  match  any  mailserver  usernames or localdomain
1597       addresses, the mail will be bounced.  Normally it will  be  bounced  to
1598       the sender, but if the 'bouncemail' global option is off, the mail will
1599       go to the local  postmaster  instead.   (see  the  'postmaster'  global
1600       option). See also BUGS.
1601
1602       The  'dns'  option  (normally  on) controls the way addresses from mul‐
1603       tidrop mailboxes are checked.  On, it enables logic to check each  host
1604       address  that  does not match an 'aka' or 'localdomains' declaration by
1605       looking it up with DNS.   When  a  mailserver  username  is  recognized
1606       attached to a matching hostname part, its local mapping is added to the
1607       list of local recipients.
1608
1609       The 'checkalias' option (normally off) extends the lookups performed by
1610       the  'dns'  keyword  in  multidrop  mode,  providing a way to cope with
1611       remote MTAs that identify themselves using their canonical name,  while
1612       they're polled using an alias.  When such a server is polled, checks to
1613       extract the envelope address fail, and fetchmail  reverts  to  delivery
1614       using   the   To/Cc/Bcc   headers   (See  below  'Header  vs.  Envelope
1615       addresses').  Specifying this option instructs  fetchmail  to  retrieve
1616       all  the  IP  addresses associated with both the poll name and the name
1617       used by the remote MTA and to do a  comparison  of  the  IP  addresses.
1618       This  comes  in  handy  in situations where the remote server undergoes
1619       frequent canonical name changes, that would otherwise require modifica‐
1620       tions  to the rcfile.  'checkalias' has no effect if 'no dns' is speci‐
1621       fied in the rcfile.
1622
1623       The 'aka' option is for use with multidrop mailboxes.  It allows you to
1624       pre-declare  a  list of DNS aliases for a server.  This is an optimiza‐
1625       tion hack that allows you to trade space for  speed.   When  fetchmail,
1626       while  processing  a multidrop mailbox, grovels through message headers
1627       looking for names of the mailserver, pre-declaring common ones can save
1628       it  from  having  to do DNS lookups.  Note: the names you give as argu‐
1629       ments to 'aka' are matched as suffixes -- if  you  specify  (say)  'aka
1630       netaxs.com',  this  will  match not just a hostname netaxs.com, but any
1631       hostname that ends with '.netaxs.com'; such  as  (say)  pop3.netaxs.com
1632       and mail.netaxs.com.
1633
1634       The 'localdomains' option allows you to declare a list of domains which
1635       fetchmail should consider local.  When  fetchmail  is  parsing  address
1636       lines in multidrop modes, and a trailing segment of a host name matches
1637       a declared local domain, that address is passed through to the listener
1638       or MDA unaltered (local-name mappings are not applied).
1639
1640       If you are using 'localdomains', you may also need to specify 'no enve‐
1641       lope', which disables fetchmail's normal attempt to deduce an  envelope
1642       address  from  the  Received  line  or X-Envelope-To header or whatever
1643       header has been previously set by 'envelope'.  If you set 'no envelope'
1644       in the defaults entry it is possible to undo that in individual entries
1645       by using 'envelope <string>'.  As a special case, 'envelope "Received"'
1646       restores the default parsing of Received lines.
1647
1648       The  password  option requires a string argument, which is the password
1649       to be used with the entry's server.
1650
1651       The 'preconnect' keyword allows you to specify a shell  command  to  be
1652       executed  just before each time fetchmail establishes a mailserver con‐
1653       nection.  This may be useful if you are attempting to set up secure POP
1654       connections  with  the aid of ssh(1).  If the command returns a nonzero
1655       status, the poll of that mailserver will be aborted.
1656
1657       Similarly, the 'postconnect' keyword similarly allows you to specify  a
1658       shell  command to be executed just after each time a mailserver connec‐
1659       tion is taken down.
1660
1661       The 'forcecr' option controls whether lines terminated by LF  only  are
1662       given  CRLF  termination  before  forwarding.  Strictly speaking RFC821
1663       requires this, but few MTAs enforce the requirement it so  this  option
1664       is  normally  off  (only  one such MTA, qmail, is in significant use at
1665       time of writing).
1666
1667       The 'stripcr' option controls whether carriage returns are stripped out
1668       of retrieved mail before it is forwarded.  It is normally not necessary
1669       to set this, because it defaults to 'on' (CR  stripping  enabled)  when
1670       there  is  an  MDA declared but 'off' (CR stripping disabled) when for‐
1671       warding is via SMTP.  If 'stripcr' and 'forcecr' are both on, 'stripcr'
1672       will override.
1673
1674       The 'pass8bits' option exists to cope with Microsoft mail programs that
1675       stupidly slap a "Content-Transfer-Encoding: 7bit" on everything.   With
1676       this  option  off  (the  default)  and such a header present, fetchmail
1677       declares BODY=7BIT to an ESMTP-capable listener; this  causes  problems
1678       for  messages  actually  using 8-bit ISO or KOI-8 character sets, which
1679       will be garbled by having the high bits of all characters stripped.  If
1680       'pass8bits'  is on, fetchmail is forced to declare BODY=8BITMIME to any
1681       ESMTP-capable listener.  If the listener is  8-bit-clean  (as  all  the
1682       major ones now are) the right thing will probably result.
1683
1684       The 'dropstatus' option controls whether nonempty Status and X-Mozilla-
1685       Status lines are retained in fetched mail (the default)  or  discarded.
1686       Retaining  them  allows  your  MUA  to  see what messages (if any) were
1687       marked seen on the server.  On the other hand, it can confuse some new-
1688       mail notifiers, which assume that anything with a Status line in it has
1689       been seen.  (Note: the empty Status lines inserted by  some  buggy  POP
1690       servers are unconditionally discarded.)
1691
1692       The  'dropdelivered'  option controls whether Delivered-To headers will
1693       be kept in fetched mail (the default) or discarded. These  headers  are
1694       added by Qmail and Postfix mailservers in order to avoid mail loops but
1695       may get in your way if you try to "mirror" a mailserver within the same
1696       domain. Use with caution.
1697
1698       The  'mimedecode'  option  controls  whether  MIME  messages  using the
1699       quoted-printable encoding are automatically converted into  pure  8-bit
1700       data.  If you are delivering mail to an ESMTP-capable, 8-bit-clean lis‐
1701       tener (that includes all of the major MTAs like  sendmail),  then  this
1702       will  automatically  convert  quoted-printable message headers and data
1703       into 8-bit data, making it easier to understand when reading  mail.  If
1704       your  e-mail  programs  know  how to deal with MIME messages, then this
1705       option is not needed.  The mimedecode option is off by default, because
1706       doing  RFC2047 conversion on headers throws away character-set informa‐
1707       tion and can lead to bad results if the encoding of the headers differs
1708       from the body encoding.
1709
1710       The  'idle'  option is intended to be used with IMAP servers supporting
1711       the RFC2177 IDLE command extension, but does not strictly  require  it.
1712       If it is enabled, and fetchmail detects that IDLE is supported, an IDLE
1713       will be issued at the end of each poll.  This will tell the IMAP server
1714       to  hold  the  connection  open  and notify the client when new mail is
1715       available.  If IDLE is not supported, fetchmail  will  simulate  it  by
1716       periodically  issuing NOOP. If you need to poll a link frequently, IDLE
1717       can save bandwidth by  eliminating  TCP/IP  connects  and  LOGIN/LOGOUT
1718       sequences. On the other hand, an IDLE connection will eat almost all of
1719       your fetchmail's time, because it will never drop  the  connection  and
1720       allow  other  polls  to occur unless the server times out the IDLE.  It
1721       also doesn't work with multiple folders; only  the  first  folder  will
1722       ever be polled.
1723
1724
1725       The  'properties'  option is an extension mechanism.  It takes a string
1726       argument, which is ignored by fetchmail itself.   The  string  argument
1727       may  be  used  to  store  configuration  information  for scripts which
1728       require it.  In particular, the output of  '--configdump'  option  will
1729       make  properties  associated  with  a user entry readily available to a
1730       Python script.
1731
1732   Miscellaneous Run Control Options
1733       The words 'here' and 'there'  have  useful  English-like  significance.
1734       Normally  'user  eric  is esr' would mean that mail for the remote user
1735       'eric' is to be delivered to 'esr', but you can make  this  clearer  by
1736       saying 'user eric there is esr here', or reverse it by saying 'user esr
1737       here is eric there'
1738
1739       Legal protocol identifiers for use with the 'protocol' keyword are:
1740
1741           auto (or AUTO) (legacy, to be removed from future release)
1742           pop2 (or POP2) (legacy, to be removed from future release)
1743           pop3 (or POP3)
1744           sdps (or SDPS)
1745           imap (or IMAP)
1746           apop (or APOP)
1747           kpop (or KPOP)
1748
1749
1750       Legal authentication types are  'any',  'password',  'kerberos',  'ker‐
1751       beros_v4',  'kerberos_v5'  and 'gssapi', 'cram-md5', 'otp', 'msn' (only
1752       for POP3), 'ntlm', 'ssh', 'external' (only IMAP).  The 'password'  type
1753       specifies  authentication  by  normal  transmission  of a password (the
1754       password may be plain text or subject to  protocol-specific  encryption
1755       as in APOP); 'kerberos' tells fetchmail to try to get a Kerberos ticket
1756       at the start of each query instead, and send an arbitrary string as the
1757       password;  and  'gssapi'  tells fetchmail to use GSSAPI authentication.
1758       See the description of the 'auth' keyword for more.
1759
1760       Specifying 'kpop' sets POP3 protocol over port 1109  with  Kerberos  V4
1761       authentication.  These defaults may be overridden by later options.
1762
1763       There  are  some  global option statements: 'set logfile' followed by a
1764       string sets the same global specified  by  --logfile.   A  command-line
1765       --logfile option will override this. Note that --logfile is only effec‐
1766       tive if fetchmail detaches itself from the terminal.  Also,  'set  dae‐
1767       mon'  sets  the poll interval as --daemon does.  This can be overridden
1768       by a command-line --daemon option; in particular --daemon 0 can be used
1769       to  force foreground operation. The 'set postmaster' statement sets the
1770       address to which multidrop mail defaults if there are no local matches.
1771       Finally, 'set syslog' sends log messages to syslogd(8).
1772
1773

DEBUGGING FETCHMAIL

1775   Fetchmail crashing
1776       There are various ways in that fetchmail may "crash", i. e. stop opera‐
1777       tion suddenly and unexpectedly. A "crash" usually refers  to  an  error
1778       condition  that  the  software  did  not handle by itself. A well-known
1779       failure mode is the "segmentation fault" or "signal 11" or "SIGSEGV" or
1780       just  "segfault" for short. These can be caused by hardware or by soft‐
1781       ware problems. Software-induced segfaults  can  usually  be  reproduced
1782       easily and in the same place, whereas hardware-induced segfaults can go
1783       away if the computer is rebooted, or powered off for a few  hours,  and
1784       can  happen  in  random locations even if you use the software the same
1785       way.
1786
1787       For solving hardware-induced segfaults, find the faulty  component  and
1788       repair  or  replace  it.  <http://www.bitwizard.nl/sig11/> may help you
1789       with details.
1790
1791       For solving software-induced  segfaults,  the  developers  may  need  a
1792       "stack backtrace".
1793
1794
1795   Enabling fetchmail core dumps
1796       By  default,  fetchmail  suppresses  core  dumps as these might contain
1797       passwords and other  sensitive  information.  For  debugging  fetchmail
1798       crashes,  obtaining  a  "stack backtrace" from a core dump is often the
1799       quickest way to solve the problem, and when posting your problem  on  a
1800       mailing list, the developers may ask you for a "backtrace".
1801
1802       1.  To  get  useful backtraces, fetchmail needs to be installed without
1803       getting stripped  of  its  compilation  symbols.   Unfortunately,  most
1804       binary  packages  that  are installed are stripped, and core files from
1805       symbol-stripped programs are worthless. So you may  need  to  recompile
1806       fetchmail. On many systems, you can type
1807
1808               file `which fetchmail`
1809
1810       to  find  out  if  fetchmail  was  symbol-stripped or not. If yours was
1811       unstripped, fine, proceed, if it was stripped, you  need  to  recompile
1812       the  source code first. You do not usually need to install fetchmail in
1813       order to debug it.
1814
1815       2. The shell environment that starts fetchmail  needs  to  enable  core
1816       dumps.  The  key  is the "maximum core (file) size" that can usually be
1817       configured with a tool named "limit" or "ulimit". See the documentation
1818       for  your  shell  for  details.  In the popular bash shell, "ulimit -Sc
1819       unlimited" will allow the core dump.
1820
1821       3. You need to tell fetchmail, too, to allow core dumps.  To  do  this,
1822       run  fetchmail with the -d0 -v options.  It is often easier to also add
1823       --nosyslog -N as well.
1824
1825       Finally, you need to reproduce the crash. You can just start  fetchmail
1826       from  the directory where you compiled it by typing ./fetchmail, so the
1827       complete command line will start with ./fetchmail -Nvd0 --nosyslog  and
1828       perhaps list your other options.
1829
1830       After the crash, run your debugger to obtain the core dump.  The debug‐
1831       ger will often be GNU GDB, you can then type (adjust  paths  as  neces‐
1832       sary) gdb ./fetchmail fetchmail.core and then, after GDB has started up
1833       and read all its files, type backtrace full, save the  output  (copy  &
1834       paste  will  do,  the  backtrace will be read by a human) and then type
1835       quit to leave gdb.  Note: on some systems, the core files have  differ‐
1836       ent  names, they might contain a number instead of the program name, or
1837       number and name, but it will usually have "core" as part of their name.
1838
1839

INTERACTION WITH RFC 822

1841       When trying to determine the originating address of a  message,  fetch‐
1842       mail looks through headers in the following order:
1843
1844               Return-Path:
1845               Resent-Sender: (ignored if it doesn't contain an @ or !)
1846               Sender: (ignored if it doesn't contain an @ or !)
1847               Resent-From:
1848               From:
1849               Reply-To:
1850               Apparently-From:
1851
1852       The  originating  address is used for logging, and to set the MAIL FROM
1853       address when forwarding to SMTP.  This order is intended to cope grace‐
1854       fully  with  receiving  mailing  list  messages  in multidrop mode. The
1855       intent is that if a local address doesn't  exist,  the  bounce  message
1856       won't  be  returned  blindly  to  the author or to the list itself, but
1857       rather to the list manager (which is less annoying).
1858
1859       In multidrop mode, destination headers are processed as follows: First,
1860       fetchmail looks for the Received: header (or whichever one is specified
1861       by the 'envelope' option) to determine the local recipient address.  If
1862       the  mail  is  addressed  to more than one recipient, the Received line
1863       won't contain any information regarding recipient addresses.
1864
1865       Then fetchmail looks for the Resent-To:,  Resent-Cc:,  and  Resent-Bcc:
1866       lines.   If  they  exist,  they should contain the final recipients and
1867       have precedence over their To:/Cc:/Bcc: counterparts.  If the  Resent-*
1868       lines  don't  exist,  the  To:,  Cc:, Bcc: and Apparently-To: lines are
1869       looked for. (The presence of a Resent-To: is taken to  imply  that  the
1870       person  referred  by  the To: address has already received the original
1871       copy of the mail.)
1872
1873

CONFIGURATION EXAMPLES

1875       Note that although there are password declarations in a  good  many  of
1876       the  examples below, this is mainly for illustrative purposes.  We rec‐
1877       ommend stashing account/password pairs in your $HOME/.netrc file, where
1878       they  can  be  used  not just by fetchmail but by ftp(1) and other pro‐
1879       grams.
1880
1881       Basic format is:
1882
1883         poll SERVERNAME protocol PROTOCOL username NAME password PASSWORD
1884
1885       Example:
1886
1887         poll pop.provider.net protocol pop3 username "jsmith" password "secret1"
1888
1889       Or, using some abbreviations:
1890
1891         poll pop.provider.net proto pop3 user "jsmith" password "secret1"
1892
1893       Multiple servers may be listed:
1894
1895         poll pop.provider.net proto pop3 user "jsmith" pass "secret1"
1896         poll other.provider.net proto pop2 user "John.Smith" pass "My^Hat"
1897
1898       Here's a version of those two  with  more  whitespace  and  some  noise
1899       words:
1900
1901         poll pop.provider.net proto pop3
1902             user "jsmith", with password secret1, is "jsmith" here;
1903         poll other.provider.net proto pop2:
1904             user "John.Smith", with password "My^Hat", is "John.Smith" here;
1905
1906       This version is much easier to read and doesn't cost significantly more
1907       (parsing is done only once, at startup time).
1908
1909
1910       If you need to include whitespace in a parameter  string,  enclose  the
1911       string in double quotes.  Thus:
1912
1913         poll mail.provider.net with proto pop3:
1914               user "jsmith" there has password "u can't krak this"
1915                           is jws here and wants mda "/bin/mail"
1916
1917       You  may  have  an  initial  server  description  headed by the keyword
1918       'defaults' instead of 'poll' followed by a  name.   Such  a  record  is
1919       interpreted  as  defaults for all queries to use. It may be overwritten
1920       by individual server descriptions.  So, you could write:
1921
1922         defaults proto pop3
1923               user "jsmith"
1924         poll pop.provider.net
1925               pass "secret1"
1926         poll mail.provider.net
1927               user "jjsmith" there has password "secret2"
1928
1929       It's possible to specify more than one user per server  (this  is  only
1930       likely  to  be  useful  when running fetchmail in daemon mode as root).
1931       The 'user' keyword leads off a user description, and every user  speci‐
1932       fication in a multi-user entry must include it.  Here's an example:
1933
1934         poll pop.provider.net proto pop3 port 3111
1935               user "jsmith" with pass "secret1" is "smith" here
1936               user jones with pass "secret2" is "jjones" here keep
1937
1938       This  associates  the  local username 'smith' with the pop.provider.net
1939       username  'jsmith'  and  the   local   username   'jjones'   with   the
1940       pop.provider.net  username  'jones'.   Mail  for 'jones' is kept on the
1941       server after download.
1942
1943       Here's what a simple retrieval configuration for  a  multidrop  mailbox
1944       looks like:
1945
1946         poll pop.provider.net:
1947               user maildrop with pass secret1 to golux 'hurkle'='happy' snark here
1948
1949       This  says  that  the  mailbox of account 'maildrop' on the server is a
1950       multidrop box, and that messages in it should be parsed for the  server
1951       user  names  'golux', 'hurkle', and 'snark'.  It further specifies that
1952       'golux' and 'snark' have the same name on the client as on the  server,
1953       but  mail  for  server user 'hurkle' should be delivered to client user
1954       'happy'.
1955
1956       Note  that  fetchmail,  until  version  6.3.4,  did  NOT   allow   full
1957       user@domain  specifications  here,  these  would never match. Fetchmail
1958       6.3.5 and newer support user@domain  specifications  on  the  left-hand
1959       side of a user mapping.
1960
1961       Here's an example of another kind of multidrop connection:
1962
1963         poll pop.provider.net localdomains loonytoons.org toons.org:
1964               user maildrop with pass secret1 to * here
1965
1966       This  also says that the mailbox of account 'maildrop' on the server is
1967       a multidrop box.  It tells fetchmail that any  address  in  the  loony‐
1968       toons.org  or  toons.org  domains  (including sub-domain addresses like
1969       'joe@daffy.loonytoons.org') should be passed through to the local  SMTP
1970       listener  without  modification.   Be  careful  of mail loops if you do
1971       this!
1972
1973       Here's an example configuration using ssh and the plugin  option.   The
1974       queries  are  made  directly  on the stdin and stdout of imapd via ssh.
1975       Note that in this setup, IMAP authentication can be skipped.
1976
1977       poll mailhost.net with proto imap:
1978               plugin "ssh %h /usr/sbin/imapd" auth ssh;
1979                       user esr is esr here
1980
1981

THE USE AND ABUSE OF MULTIDROP MAILBOXES

1983       Use the multiple-local-recipients feature with caution -- it can  bite.
1984       All multidrop features are ineffective in ETRN and ODMR modes.
1985
1986       Also,  note  that  in multidrop mode duplicate mails are suppressed.  A
1987       piece of mail is considered duplicate if it has the same message-ID  as
1988       the  message  immediately  preceding and more than one addressee.  Such
1989       runs of messages may be generated when copies of a message addressed to
1990       multiple users are delivered to a multidrop box.
1991
1992
1993   Header vs. Envelope addresses
1994       The  fundamental problem is that by having your mailserver toss several
1995       peoples' mail in a single maildrop box, you may have thrown away poten‐
1996       tially  vital  information  about  who  each piece of mail was actually
1997       addressed  to  (the  'envelope  address',  as  opposed  to  the  header
1998       addresses in the RFC822 To/Cc headers - the Bcc is not available at the
1999       receiving end).  This 'envelope address' is the  address  you  need  in
2000       order to reroute mail properly.
2001
2002       Sometimes fetchmail can deduce the envelope address.  If the mailserver
2003       MTA is sendmail and the item of mail had just one  recipient,  the  MTA
2004       will  have  written a 'by/for' clause that gives the envelope addressee
2005       into its Received header. But this  doesn't  work  reliably  for  other
2006       MTAs,  nor  if there is more than one recipient.  By default, fetchmail
2007       looks for envelope addresses in  these  lines;  you  can  restore  this
2008       default with -E "Received" or 'envelope Received'.
2009
2010       As a better alternative, some SMTP listeners and/or mail servers insert
2011       a header in each message containing a copy of the  envelope  addresses.
2012       This  header  (when it exists) is often 'X-Original-To', 'Delivered-To'
2013       or 'X-Envelope-To'.  Fetchmail's assumption about this can  be  changed
2014       with the -E or 'envelope' option.  Note that writing an envelope header
2015       of this kind exposes the  names  of  recipients  (including  blind-copy
2016       recipients)  to  all  receivers  of  the messages, so the upstream must
2017       store one copy of the message per recipient to avoid becoming a privacy
2018       problem.
2019
2020       Postfix,  since version 2.0, writes an X-Original-To: header which con‐
2021       tains a copy of the envelope as it was received.
2022
2023       Qmail and Postfix generally write a 'Delivered-To' header upon deliver‐
2024       ing  the  message  to  the  mail  spool and use it to avoid mail loops.
2025       Qmail virtual domains however will prefix the user name with  a  string
2026       that  normally matches the user's domain. To remove this prefix you can
2027       use the -Q or 'qvirtual' option.
2028
2029       Sometimes, unfortunately, neither of these methods works.  That is  the
2030       point  when you should contact your ISP and ask them to provide such an
2031       envelope header, and you should not use multidrop  in  this  situation.
2032       When  they  all fail, fetchmail must fall back on the contents of To/Cc
2033       headers (Bcc headers are not available - see below) to try to determine
2034       recipient addressees -- and these are unreliable.  In particular, mail‐
2035       ing-list software often ships mail with only the list broadcast address
2036       in the To header.
2037
2038       Note that a future version of fetchmail may remove To/Cc parsing!
2039
2040       When fetchmail cannot deduce a recipient address that is local, and the
2041       intended recipient address was anyone other than  fetchmail's  invoking
2042       user,  mail  will  get  lost.  This is what makes the multidrop feature
2043       risky without proper envelope information.
2044
2045       A related problem is that when you blind-copy a mail message,  the  Bcc
2046       information  is carried only as envelope address (it's removed from the
2047       headers by the sending mail server, so fetchmail can  see  it  only  if
2048       there  is  an  X-0elope-To header).  Thus, blind-copying to someone who
2049       gets mail over a fetchmail multidrop link  will  fail  unless  the  the
2050       mailserver  host routinely writes X-Envelope-To or an equivalent header
2051       into messages in your maildrop.
2052
2053       In conclusion, mailing lists and Bcc'd mail can only work if the server
2054       you're  fetching  from (1) stores one copy of the message per recipient
2055       in your domain and (2) records the envelope information  in  a  special
2056       header (X-Original-To, Delivered-To, X-Envelope-To).
2057
2058
2059   Good Ways To Use Multidrop Mailboxes
2060       Multiple  local names can be used to administer a mailing list from the
2061       client side of a fetchmail collection.  Suppose your name is 'esr', and
2062       you  want  to  both  pick  up your own mail and maintain a mailing list
2063       called (say) "fetchmail-friends", and you want to keep the  alias  list
2064       on your client machine.
2065
2066       On  your  server,  you can alias 'fetchmail-friends' to 'esr'; then, in
2067       your .fetchmailrc, declare 'to esr fetchmail-friends here'.  Then, when
2068       mail including 'fetchmail-friends' as a local address gets fetched, the
2069       list name will be appended to the list of recipients your SMTP listener
2070       sees.   Therefore  it will undergo alias expansion locally.  Be sure to
2071       include 'esr' in the local alias  expansion  of  fetchmail-friends,  or
2072       you'll  never  see  mail sent only to the list.  Also be sure that your
2073       listener has the "me-too"  option  set  (sendmail's  -oXm  command-line
2074       option or OXm declaration) so your name isn't removed from alias expan‐
2075       sions in messages you send.
2076
2077       This trick is not without its problems, however.  You'll begin  to  see
2078       this  when  a message comes in that is addressed only to a mailing list
2079       you do not have declared as a local name.  Each such message will  fea‐
2080       ture  an 'X-Fetchmail-Warning' header which is generated because fetch‐
2081       mail cannot find a valid local name in the recipient  addresses.   Such
2082       messages  default  (as  was described above) to being sent to the local
2083       user running fetchmail, but the program has no way to know that  that's
2084       actually the right thing.
2085
2086
2087   Bad Ways To Abuse Multidrop Mailboxes
2088       Multidrop mailboxes and fetchmail serving multiple users in daemon mode
2089       do not mix.  The problem, again, is mail from mailing lists, which typ‐
2090       ically  does  not  have an individual recipient address on it.   Unless
2091       fetchmail can deduce an envelope address, such mail will only go to the
2092       account  running  fetchmail  (probably root).  Also, blind-copied users
2093       are very likely never to see their mail at all.
2094
2095       If you're tempted to use fetchmail to retrieve mail for multiple  users
2096       from  a  single  mail drop via POP or IMAP, think again (and reread the
2097       section on header and envelope addresses above).  It would  be  smarter
2098       to  just let the mail sit in the mailserver's queue and use fetchmail's
2099       ETRN or ODMR modes to trigger SMTP sends periodically (of course,  this
2100       means  you  have  to  poll more frequently than the mailserver's expiry
2101       period).  If you can't arrange this, try setting up a UUCP feed.
2102
2103       If you absolutely must use multidrop for this purpose, make  sure  your
2104       mailserver  writes  an  envelope-address header that fetchmail can see.
2105       Otherwise you will lose mail and it will come back to haunt you.
2106
2107
2108   Speeding Up Multidrop Checking
2109       Normally, when multiple users are declared fetchmail extracts recipient
2110       addresses  as described above and checks each host part with DNS to see
2111       if it's an alias of the mailserver.  If so, the name mappings described
2112       in  the  "to ... here" declaration are done and the mail locally deliv‐
2113       ered.
2114
2115       This is a convenient but also slow method.  To speed it up, pre-declare
2116       mailserver aliases with 'aka'; these are checked before DNS lookups are
2117       done.  If you're certain your aka list contains all DNS aliases of  the
2118       mailserver (and all MX names pointing at it - note this may change in a
2119       future version) you can  declare  'no  dns'  to  suppress  DNS  lookups
2120       entirely and only match against the aka list.
2121
2122

EXIT CODES

2124       To  facilitate  the  use  of fetchmail in shell scripts, an exit status
2125       code is returned to give an indication of what occurred during a  given
2126       connection.
2127
2128       The exit codes returned by fetchmail are as follows:
2129
2130       0      One  or more messages were successfully retrieved (or, if the -c
2131              option was selected, were found waiting but not retrieved).
2132
2133       1      There was no mail awaiting retrieval.  (There may have been  old
2134              mail still on the server but not selected for retrieval.)
2135
2136       2      An  error  was  encountered  when attempting to open a socket to
2137              retrieve mail.  If you don't know what a socket is, don't  worry
2138              about  it  -- just treat this as an 'unrecoverable error'.  This
2139              error can also be because a protocol fetchmail wants to  use  is
2140              not listed in /etc/services.
2141
2142       3      The  user authentication step failed.  This usually means that a
2143              bad user-id, password, or APOP id was specified.  Or it may mean
2144              that you tried to run fetchmail under circumstances where it did
2145              not have standard input attached to a  terminal  and  could  not
2146              prompt for a missing password.
2147
2148       4      Some sort of fatal protocol error was detected.
2149
2150       5      There was a syntax error in the arguments to fetchmail.
2151
2152       6      The run control file had bad permissions.
2153
2154       7      There  was  an error condition reported by the server.  Can also
2155              fire if fetchmail timed out while waiting for the server.
2156
2157       8      Client-side exclusion error.  This means fetchmail either  found
2158              another  copy of itself already running, or failed in such a way
2159              that it isn't sure whether another copy is running.
2160
2161       9      The user authentication step failed because the server responded
2162              "lock  busy".  Try again after a brief pause!  This error is not
2163              implemented for all protocols, nor  for  all  servers.   If  not
2164              implemented  for  your server, "3" will be returned instead, see
2165              above.  May be returned when talking to qpopper or other servers
2166              that  can respond with "lock busy" or some similar text contain‐
2167              ing the word "lock".
2168
2169       10     The fetchmail run failed while trying to do an SMTP port open or
2170              transaction.
2171
2172       11     Fatal  DNS error.  Fetchmail encountered an error while perform‐
2173              ing a DNS lookup at startup and could not proceed.
2174
2175       12     BSMTP batch file could not be opened.
2176
2177       13     Poll terminated by a fetch limit (see the --fetchlimit option).
2178
2179       14     Server busy indication.
2180
2181       23     Internal error.  You should see a message on standard error with
2182              details.
2183
2184       24     These are internal codes and should not appear externally.
2185
2186       When  fetchmail  queries  more than one host, return status is 0 if any
2187       query successfully retrieved mail. Otherwise the returned error  status
2188       is that of the last host queried.
2189
2190

FILES

2192       ~/.fetchmailrc
2193            default run control file
2194
2195       ~/.fetchids
2196            default  location  of file associating hosts with last message IDs
2197            seen (used only with newer RFC1939-compliant POP3 servers support‐
2198            ing the UIDL command).
2199
2200       ~/.fetchmail.pid
2201            lock file to help prevent concurrent runs (non-root mode).
2202
2203       ~/.netrc
2204            your FTP run control file, which (if present) will be searched for
2205            passwords as a last resort before prompting for one interactively.
2206
2207       /var/run/fetchmail.pid
2208            lock file to help prevent concurrent runs (root mode,  Linux  sys‐
2209            tems).
2210
2211       /etc/fetchmail.pid
2212            lock  file  to  help  prevent  concurrent runs (root mode, systems
2213            without /var/run).
2214
2215

ENVIRONMENT

2217       If the FETCHMAILUSER variable is set, it is used as  the  name  of  the
2218       calling  user  (default  local name) for purposes such as mailing error
2219       notifications.  Otherwise, if either the LOGNAME or  USER  variable  is
2220       correctly  set (e.g. the corresponding UID matches the session user ID)
2221       then that name is used as the  default  local  name.   Otherwise  getp‐
2222       wuid(3)  must  be  able to retrieve a password entry for the session ID
2223       (this elaborate logic is designed to handle the case of multiple  names
2224       per userid gracefully).
2225
2226       If  the environment variable FETCHMAILHOME is set to a valid and exist‐
2227       ing directory name, fetchmail will read $FETCHMAILHOME/fetchmailrc (the
2228       dot  is missing in this case), $FETCHMAILHOME/.fetchids and $FETCHMAIL‐
2229       HOME/.fetchmail.pid rather than from the user's  home  directory.   The
2230       .netrc file is always looked for in the the invoking user's home direc‐
2231       tory regardless of FETCHMAILHOME's setting.
2232
2233       If the HOME_ETC variable is set, fetchmail will read  $HOME_ETC/.fetch‐
2234       mailrc instead of ~/.fetchmailrc.
2235
2236       If HOME_ETC and FETCHMAILHOME are set, HOME_ETC will be ignored.
2237
2238

SIGNALS

2240       If  a fetchmail daemon is running as root, SIGUSR1 wakes it up from its
2241       sleep phase and forces a poll of all non-skipped servers. For  compati‐
2242       bility  reasons, SIGHUP can also be used in 6.3.X but may not be avail‐
2243       able in future fetchmail versions.
2244
2245       If fetchmail is running in daemon mode as non-root, use SIGUSR1 to wake
2246       it  (this  is  so SIGHUP due to logout can retain the default action of
2247       killing it).
2248
2249       Running fetchmail in foreground while a background fetchmail is running
2250       will do whichever of these is appropriate to wake it up.
2251
2252

BUGS AND KNOWN PROBLEMS

2254       Fetchmail  cannot  handle  user  names  that contain blanks after a "@"
2255       character, for instance "demonstr@ti on". These are rather uncommon and
2256       only  hurt when using UID-based --keep setups, so the 6.3.X versions of
2257       fetchmail won't be fixed.
2258
2259       Please check the NEWS file that shipped with fetchmail for  more  known
2260       bugs than those listed here.
2261
2262       The  assumptions  that the DNS and in particular the checkalias options
2263       make are not often sustainable. For instance, it  has  become  uncommon
2264       for  an  MX server to be a POP3 or IMAP server at the same time. There‐
2265       fore the MX lookups may go away in a future release.
2266
2267       The mda and plugin options interact badly.  In order to  collect  error
2268       status from the MDA, fetchmail has to change its normal signal handling
2269       so that dead plugin processes don't get reaped until  the  end  of  the
2270       poll  cycle.   This  can  cause resource starvation if too many zombies
2271       accumulate.  So either don't deliver to a MDA  using  plugins  or  risk
2272       being overrun by an army of undead.
2273
2274       The  --interface  option does not support IPv6 and it is doubtful if it
2275       ever will, since there is no  portable  way  to  query  interface  IPv6
2276       addresses.
2277
2278       The  RFC822  address  parser  used  in  multidrop  mode  chokes on some
2279       @-addresses that are technically legal but bizarre.   Strange  uses  of
2280       quoting and embedded comments are likely to confuse it.
2281
2282       In  a  message  with  multiple envelope headers, only the last one pro‐
2283       cessed will be visible to fetchmail.
2284
2285       Use of some of these protocols requires that  the  program  send  unen‐
2286       crypted  passwords  over the TCP/IP connection to the mailserver.  This
2287       creates a risk that name/password pairs might be snaffled with a packet
2288       sniffer  or  more  sophisticated  monitoring software.  Under Linux and
2289       FreeBSD, the --interface option can be  used  to  restrict  polling  to
2290       availability  of  a  specific interface device with a specific local or
2291       remote IP address, but snooping is still possible if  (a)  either  host
2292       has a network device that can be opened in promiscuous mode, or (b) the
2293       intervening network link can be tapped.  We recommend the use of ssh(1)
2294       tunnelling  to  not  only  shroud your passwords but encrypt the entire
2295       conversation.
2296
2297       Use of the %F or %T escapes in an mda  option  could  open  a  security
2298       hole, because they pass text manipulable by an attacker to a shell com‐
2299       mand.  Potential shell characters are replaced by '_' before execution.
2300       The hole is further reduced by the fact that fetchmail temporarily dis‐
2301       cards any suid privileges it may have while running the MDA.  For maxi‐
2302       mum  safety, however, don't use an mda command containing %F or %T when
2303       fetchmail is run from the root account itself.
2304
2305       Fetchmail's method of sending bounces due to  errors  or  spam-blocking
2306       and  spam  bounces  requires that port 25 of localhost be available for
2307       sending mail via SMTP.
2308
2309       If you modify a ~/.fetchmailrc while a background instance  is  running
2310       and  break  the  syntax,  the  background  instance  will die silently.
2311       Unfortunately, it can't die noisily because we don't yet  know  whether
2312       syslog should be enabled.  On some systems, fetchmail dies quietly even
2313       if there is no syntax error; this seems to have something  to  do  with
2314       buggy terminal ioctl code in the kernel.
2315
2316       The  -f  -  option (reading a configuration from stdin) is incompatible
2317       with the plugin option.
2318
2319       The 'principal' option only handles Kerberos IV, not V.
2320
2321       Interactively entered passwords are truncated after 63  characters.  If
2322       you  really  need to use a longer password, you will have to use a con‐
2323       figuration file.
2324
2325       A backslash as the last character  of  a  configuration  file  will  be
2326       flagged as a syntax error rather than ignored.
2327
2328       Send comments, bug reports, gripes, and the like to the fetchmail-devel
2329       list <fetchmail-devel@lists.berlios.de>.  An HTML FAQ is  available  at
2330       the  fetchmail  home page; surf to http://fetchmail.berlios.de/ or do a
2331       WWW search for pages with 'fetchmail' in their titles.
2332
2333

AUTHOR

2335       Fetchmail is currently maintained by Matthias Andree and Rob Funk  with
2336       major  assistance  from  Sunil Shetye (for code) and Rob MacGregor (for
2337       the mailing lists).
2338
2339       Most of the code is from Eric S. Raymond <esr@snark.thyrsus.com>.   Too
2340       many other people to name here have contributed code and patches.
2341
2342       This  program  is descended from and replaces popclient, by Carl Harris
2343       <ceharris@mal.com>; the internals have become quite different, but some
2344       of  its  interface  design is directly traceable to that ancestral pro‐
2345       gram.
2346
2347       This manual page has been improved  by  R. Hannes  Beinert  and  Héctor
2348       García.
2349
2350

SEE ALSO

2352       mutt(1), elm(1), mail(1), sendmail(8), popd(8), imapd(8), netrc(5)
2353
2354       The fetchmail home page: <http://fetchmail.berlios.de/>
2355
2356       The maildrop home page: <http://www.courier-mta.org/maildrop/>
2357

APPLICABLE STANDARDS

2359       Note that this list is just a collection of references and not a state‐
2360       ment as to the actual protocol conformance or  requirements  in  fetch‐
2361       mail.
2362
2363       SMTP/ESMTP:
2364            RFC  821,  RFC  2821,  RFC 1869, RFC 1652, RFC 1870, RFC 1983, RFC
2365            1985, RFC 2554.
2366
2367       mail:
2368            RFC 822, RFC 2822, RFC 1123, RFC 1892, RFC 1894.
2369
2370       POP2:
2371            RFC 937
2372
2373       POP3:
2374            RFC 1081, RFC 1225, RFC 1460, RFC 1725, RFC 1734,  RFC  1939,  RFC
2375            1957, RFC 2195, RFC 2449.
2376
2377       APOP:
2378            RFC 1460, RFC 1725, RFC 1939.
2379
2380       RPOP:
2381            RFC 1081, RFC 1225.
2382
2383       IMAP2/IMAP2BIS:
2384            RFC 1176, RFC 1732.
2385
2386       IMAP4/IMAP4rev1:
2387            RFC  1730,  RFC  1731, RFC 1732, RFC 2060, RFC 2061, RFC 2195, RFC
2388            2177, RFC 2683.
2389
2390       ETRN:
2391            RFC 1985.
2392
2393       ODMR/ATRN:
2394            RFC 2645.
2395
2396       OTP: RFC 1938.
2397
2398       LMTP:
2399            RFC 2033.
2400
2401       GSSAPI:
2402            RFC 1508.
2403
2404       TLS: RFC 2595.
2405
2406
2407
2408fetchmail                       fetchmail 6.3.7                   fetchmail(1)
Impressum