1 <!doctype HTML public "-//W3O//DTD W3 HTML 3.2//EN">
4 <TITLE>The Fetchmail FAQ</TITLE>
5 <link rev=made href="mailto:esr@snark.thyrsus.com">
6 <meta name="description" content="Frequently asked questions about fetchmail.">
7 <meta name="keywords" content="fetchmail, POP, POP2, POP3, IMAP, remote mail">
10 <table width="100%" cellpadding=0><tr>
11 <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a>
12 <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a>
13 <td width="30%" align=right>$Date: 1997/10/06 20:34:27 $
16 <H1>Frequently Asked Questions About Fetchmail</H1>
18 Before reporting any bug, please read <a href="#G3">G3</a> for advice
19 on how to include diagnostic information that will get your bug fixed
20 as quickly as possible. <p>
22 If you have a question or answer you think ought to be added to this FAQ list,
23 mail it to fetchmail's maintainer, Eric S. Raymond, at
24 <A HREF="mailto:esr@thyrsus.com">esr@snark.thyrsus.com</A>.<p>
26 <h1>General questions:</h1>
28 <a href="#G1">G1. What is fetchmail and why should I bother?</a><br>
29 <a href="#G2">G2. Where do I find the latest FAQ and fetchmail sources?</a><br>
30 <a href="#G3">G3. I think I've found a bug. Will you fix it?</a><br>
31 <a href="#G4">G4. I have this idea for a neat feature. Will you add it?</a><br>
32 <a href="#G5">G5. Is there a mailing list for exchanging tips?</a><br>
33 <a href="#G6">G6. So, what's this I hear about a fetchmail paper?</a><br>
34 <a href="#G7">G7. What is the best server to use with fetchmail?</a><br>
35 <a href="#G8">G8. How can I avoid sending my password en clair?</a><br>
37 <h1>Build-time problems:</h1>
39 <a href="#B1">B1. I get link failures when I try to build fetchmail.</a><br>
41 <h1>Fetchmail configuration file grammar questions:</h1>
43 <a href="#F1">F1. Why does my old .fetchmailrc no longer work?</a><br>
44 <a href="#F2">F2. The .fetchmailrc parser won't accept my all-numeric user name.</a><br>
45 <a href="#F3">F3. The .fetchmailrc parser won't accept my host or username beginning with `no'.</a><br>
46 <a href="#F4">F4. I'm migrating from popclient. How do I need to modify my .poprc?</a><br>
48 <h1>Configuration questions:</h1>
50 <a href="#C1">C1. Why do I need a .fetchmailrc when running as root on my own machine?</a><br>
51 <a href="#C2">C2. How can I arrange for a fetchmail daemon to get killed when I log out?</a><br>
52 <a href="#C3">C3. How do I know what interface and address to use with --interface?</a><br>
53 <a href="#C4">C4. How can I get fetchmail to work with ssh?</a><br>
54 <a href="#C5">C5. How can I set up support for sendmail's anti-spam 571 response?</a><br>
55 <a href="#C6">C6. How can I do automatic startup/shutdown of fetchmail
56 when I may have multiple login sessions going?</a><br>
58 <h1>Configuration tips for non-sendmail MTAs and unusual servers.</h1>
60 <a href="#T1">T1. How can I use fetchmail with qmail?</a><br>
61 <a href="#T2">T2. How can I use fetchmail with exim?</a><br>
62 <a href="#T3">T3. How can I use fetchmail with smail?</a><br>
63 <a href="#T4">T4. How can I use fetchmail with SCO's MMDF?</a><br>
64 <a href="#T5">T5. How can I use fetchmail with Lotus Notes?</a><br>
65 <a href="#T6">T6. How can I use fetchmail with Microsoft Exchange?</a><br>
66 <a href="#T7">T7. How can I use fetchmail with Compuserve RPA?</a><br>
67 <a href="#T8">T8. How can I use fetchmail with HP OpenMail?</a><br>
69 <h1>Runtime fatal errors:</h1>
71 <a href="#R1">R1. Fetchmail isn't working, and -v shows `SMTP connect failed' messages.</a><br>
72 <a href="#R2">R2. When I try to configure an MDA, fetchmail doesn't work.</a><br>
73 <a href="#R3">R3. Fetchmail dumps core when given an invalid rc file.</a><br>
74 <a href="#R4">R4. Fetchmail dumps core in -V mode, but operates normally otherwise.</a><br>
75 <a href="#R5">R5. Fetchmail dumps core when I use a .netrc file but works otherwise.</a><br>
76 <a href="#R6">R6. Running fetchmail in daemon mode doesn't work.</a><br>
78 <h1>Disappearing mail</h1>
80 <a href="#D1">D1. I think I've set up fetchmail correctly, but I'm not getting any mail.</a><br>
81 <a href="#D2">D2. All my mail seems to disappear after an interrupt.</a><br>
82 <a href="#D3">D3. Mail that was being fetched when I interrupted my fetchmail seems to have been vanished.</a></br>
84 <h1>Multidrop-mode problems:</h1>
86 <a href="#M1">M1. I've declared local names, but all my multidrop mail is going to root anyway.</a><br>
87 <a href="#M2">M2. I can't seem to get fetchmail to route to a local domain properly.</a><br>
88 <a href="#M3">M3. I tried to run a mailing list using multidrop, and I have a mail loop!</a><br>
89 <a href="#M4">M4. My multidrop fetchmail seems to be having DNS problems.</a><br>
90 <a href="#M5">M5. I'm seeing long DNS delays before each message is processed.</a><br>
91 <a href="#M6">M6. How do I get multidrop mode to work with majordomo?</a>
93 <h1>Mangled mail:</h1>
95 <a href="#X1">X1. Spurious blank lines are appearing in the headers of fetched mail.</a><br>
96 <a href="#X2">X2. My mail client can't see a Subject line.</a><br>
97 <a href="#X3">X3. Messages containing "From" at start of line are being split.</a><br>
98 <a href="#X4">X4. My mail is being mangled in a new and different way.</a><br>
100 <h1>Other Problems:</h1>
102 <a href="#O1">O1. The --logfile option doesn't work if the logfile doesn't exist.</a><br>
103 <a href="#O2">O2. Every time I get a POP or IMAP message the header is
104 dumped to all my terminal sessions.</a><br>
105 <a href="#O3">O3. Does fetchmail reread its rc file every poll cycle?</a><br>
106 <a href="#O4">O4. Why do deleted messages show up again when I take
107 a line hit while downloading?</a><br>
108 <a href="#O5">O5. Why is fetched mail being logged with my name, not the real From address?</a><br>
112 <h2><a name="G1">G1. What is fetchmail and why should I bother?</a></h2>
114 Fetchmail is a one-stop solution to the remote mail retrieval problem
115 for Unix machines, quite useful to anyone with an intermittent PPP or
116 SLIP connection to a remote mailserver. It can collect mail using any
117 variant of POP or IMAP and forwards via port 25 to the local SMTP
118 listener, enabling all the normal forwarding/filtering/aliasing
119 mechanisms that would apply to local mail or mail arriving via a
120 full-time TCP/IP connection.<p>
122 Fetchmail is not a toy or a coder's learning exercise, but an
123 industrial-strength tool capable of transparently handling every
124 retrieval demand from those of a simple single-user ISP connection up
125 to mail retrieval and rerouting for an entire client domain.
126 Fetchmail is easy to configure, unobtrusive in operation, powerful,
127 feature-rich, and well documented. Extensive testing by a large,
128 multi-platform user community has shown that it is as near bulletproof
129 as the underlying protocols permit.<p>
131 If you found this FAQ in the distribution, see the README for fetchmail's
132 full feature list.<p>
135 <h2><a name="G2">G2. Where do I find the latest FAQ and fetchmail
138 The latest HTML FAQ is available alongside the latest fetchmail
139 sources at the fetchmail home page:
140 <a href="http://www.ccil.org/~esr/fetchmail">
141 http://www.ccil.org/~esr/fetchmail</a>. You can also find
143 href="http://sunsite.unc.edu/pub/Linux/system/mail/pop/!INDEX.html">POP
144 mail tools directory on Sunsite</a>.<p>
146 A text dump of this FAQ is included in the fetchmail
147 distribution. Because it freezes at distribution release time, it may
148 not be completely current.<p>
151 <h2><a name="G3">G3. I think I've found a bug. Will you fix it?</a></h2>
153 Yes I will, provided you include enough diagnostic information for me
154 to go on. Send bugs to <a
155 href="mailto:fetchmail-friends">fetchmail-friends</a>. When reporting
156 bugs, please include the following:
159 <li>Your operating system and compiler version.
160 <li>Any command-line options you used.
161 <li>The output of fetchmail -V called with whatever other
162 command-line options you used.
165 It is helpful if you include your .fetchmailrc, but not necessary
166 unless your symptom seems to involve an error in configuration parsing.<p>
168 If fetchmail seems to run and fetch mail, but the headers look mangled
169 (that is headers are missing, or blank lines are inserted in the
170 headers) then read the FAQ items in section <a href="#X1">X</a>
171 before submitting a bug report. Pay special attention to the item on
172 <a href="#generic_mangling">diagnosing mail mangling</a>. There are
173 lots of ways for other programs in the mail chain to screw up that
174 look like fetchmail's fault, but you may be able to fix these by
175 tweaking your configuration.<P>
177 A transcript of the failed session with -v on is almost always useful.
178 It is very important that the transcript include your POP/IMAP server's
179 greeting line, so I can identify it in case of server problems.<P>
181 If the bug involves a core dump or hang, a gdb stack trace is good to have.
182 (Bear in mind that you can attach gdb to a running but hung process by
183 giving the process ID as a second argument.) You will need to
187 CFLAGS=-g LDFLAGS=" " ./configure
190 and then rebuild in order to generate a version that can be gdb-traced.<p>
192 Best of all is a mail file which, when fetched, will reproduce the
193 bug under the latest (current) version.<p>
195 Any bug I can reproduce will usually get fixed very quickly, often
196 within 48 hours. Bugs I can't reproduce are a crapshoot. If the
197 solution isn't obvious when I first look, it may evade me for a long
198 time (or to put it another way, fetchmail is well enough tested that the
199 easy bugs have long since been found). So if you want your bug fixed
200 rapidly, it is not just sufficient but nearly <em>necessary</em> that
201 you give me a way to reproduce it.<p>
204 <h2><a name="G4">G4. I have this idea for a neat feature. Will you add it?</a></h2>
206 Probably not. Most of the feature suggestions I get are for ways to
207 set various kinds of administrative policy or add more spam filtering
208 (the most common one, which I used to get about four million times a week
209 and got <em>really</em> tired of, is for tin-like kill files).<p>
211 You can do spam filtering better with procmail or mailagent on the
212 server side and (if you're the server sysadmin) sendmail.cf domain
213 exclusions. You can do other policy things better with the
214 <CODE>mda</CODE> option and script wrappers around fetchmail. If
215 it's a prime-time-vs.-non-prime-time issue, ask yourself whether a
216 wrapper script called from crontab would do the job.<p>
218 I'm not going to do these; fetchmail's job is transport, not policy, and I
219 refuse to change it from doing one thing well to attempting many things badly.
220 One of my objectives is to keep fetchmail simple so it stays reliable.<p>
222 All that said, if you have a feature idea that really is about a transport
223 problem that can't be handled anywhere but fetchmail, lay it on me. I'm
224 very accommodating about good ideas.<p>
227 <h2><a name="G5">G5. Is there a mailing list for exchanging tips?</a></h2>
229 There is a fetchmail-friends list for people who want to discuss fixes
230 and improvements in fetchmail and help co-develop it. It's at <a
231 href="mailto:fetchmail-friends@thyrsus.com">fetchmail-friends@thyrsus.com</a>.
232 There is also an announcements-only list, <em>fetchmail-announce@thyrsus.com</em>.<P>
234 Both lists are SmartList reflectors; sign up in the usual way with a
235 message containing the word "subscribe" in the subject line sent to
236 <a href="mailto:fetchmail-friends-request@thyrsus.com?subject=subscribe">
237 fetchmail-friends-request@thyrsus.com</a> or
238 <a href="mailto:fetchmail-announce-request@thyrsus.com?subject=subscribe">
239 fetchmail-announce-request@thyrsus.com</a>. (Similarly, "unsubscribe"
240 in the Subject line unsubscribes you, and "help" returns general list help) <p>
243 <h2><a name="G6">G6. So, what's this I hear about a fetchmail paper?</a></h2>
245 Now it can be told! The fetchmail development was also a sociological
246 experiment, an extended test to see if my theory about the critical
247 features of the Linux development model is correct.<p>
249 The experiment was a success. I wrote a paper about it titled
250 <a href="http://www.ccil.org/~esr/writings/cathedral.html">The
251 Cathedral and the Bazaar</a> which was first presented at Linux
252 Kongress '97 in Bavaria and very well received there. It was also
253 given at Atlanta Linux Expo.<p>
255 If you're reading a non-HTML dump of this FAQ, you can find the paper
256 on the Web with a search for that title.<p>
259 <h2><a name="G7">G7. What is the best server to use with fetchmail?</a></h2>
261 Fetchmail will work with any POP, IMAP, or ESMTP/ETRN server that
262 conforms to the relevant RFCs (and even some oughtright broken ones
263 like Microsoft Exchange). This doesn't mean it works equally well
264 with all, however. POP2 servers, and POP3 servers without LAST, limit
265 fetchmail's capabilities in various ways described on the manual
268 Most modern Unixes (and effectively all Linux/*BSD systems) come with
269 POP3 support preconfigured (but beware of the horribly broken POP3
270 server mentioned in <a href="#D2">D2</a>). An increasing minority
271 also feature IMAP (you can detect IMAP support by running fetchmail in
274 If you have the option, we recommend using or installing IMAP4; it has
275 the best facilities for tracking message "seen" states. It also
276 recovers from interrupted connections more gracefully than POP3, and
277 enables some significant performance optimizations.<P>
279 You can find sources for IMAP software at <a
280 href="http://www.imap.org"> The IMAP Connection</a>; we like the
281 freeware UW IMAP and Cyrus products. UW IMAP is the reference
282 implementation of IMAP.<P>
285 <h2><a name="G8">G8. How can I avoid sending my password en clair?</a></h2>
287 Depending on what your mail server you are talking to, this ranges
288 from trivial to impossible. It may even be next to useless.<P>
290 Most people use fetchmail over phone wires, which are hard to tap.
291 Anybody with the skill and resources to do this could get into your
292 server mailbox with much less effort by subverting the server host.
293 So if your provider setup is modem wires going straight into a service
294 box, you probably don't need to worry.<P>
296 In general there is little point in trying to secure your fetchmail
297 transaction unless you trust the security of the server host you are
298 retrieving mail from. Your vulnerability is more likely to be an
299 insecure local network on the server end (e.g. somebody with a TCP/IP
300 packet sniffer intercepting Ethernet traffic between the modem
301 concentrator you dial in to and the mailserver host).<P>
303 Having realized this, you need to ask whether password encryption
304 alone will really address your security exposure. If you think you
305 might be snooped, it's better to use end-to-end encryption on your
306 whole mail stream so none of it can be read. One of the advantages of
307 fetchmail over conventional SMTP-push delivery is that you may be able
308 to arrange this by using ssh(1); see <a href="#C4">C4</a>.<P>
310 If ssh/sshd isn't available, or you find it too complicated for you to
311 set up, password encryption will at least keep a malicious cracker
312 from deleting your mail, and require him to either tap your connection
313 continuously or crack root on the server in order to read it.<P>
315 You can deduce what encryptions your mail server has available by
316 by looking at the server greeting line (and, for IMAP, the
317 response to a CAPABILITY query). Do a <code>fetchmail -v</code>
318 to see these, or telnet direct to the server port (110 for POP3, 143 for
321 The facility you are most likely to have available is APOP. This is a
322 POP3 feature supported by many servers. If you see something in the
323 greeting line that looks like an angle-bracket-enclosed Internet
324 address with a numeric left-hand part, that's an APOP challenge (it
325 will vary each time you log in). You can register a secret on the
326 host (using <code>popauth(8)</code> or some program like it). Specify
327 the secret as your password in your .fetchmailrc; it will be used to
328 encrypt the current challenge, and the encrypted form will be sent
329 back the the server for verification.<P>
331 Alternatively, you may have Kerberos available. This may require you
332 to set up some magic files in your home directory on your client
333 machine, but means you can omit specifying any password at all.<P>
335 Fetchmail supports two different Kerberos schemes. One is a
336 POP3 variant called KPOP; consult the documentation of your mail
337 server to see if you have it (one clue is the string "krb-IV" in the
338 greeting line on port 110). The other is an IMAP facility described
339 by RFC1731. You can tell if this one is present by looking for
340 AUTH=KERBEROS_V4 in the CAPABILITY response.<P>
342 If you are fetching mail from a CompuServe POP3 account, you can use
343 their RPA authentication (which works much like APOP). See <a
344 href="#T7">T7</a> for details.<P>.
346 Your POP3 server may have the RFC1938 OTP capability to use one-time
347 passwords. To check this, look for the string "otp-" in the greeting
348 line. If you see it, and your fetchmail was built with OPIE support
349 compiled in (see the distribution INSTALL file), fetchmail will
350 detect it also. When using OTP, you will specify a password but it
351 will not be sent en clair.<P>
353 Sadly, there is at present (October 1997) no OTP or APOP-like facility
354 generally available on IMAP servers.<P>
357 <h2><a name="B1">B1. I get link failures when I try to build fetchmail.</a></h2>
359 If you get errors resembling these<P>
362 mxget.o(.text+0x35): undefined referenceto `__res_search'
363 mxget.o(.text+0x99): undefined reference to`__dn_skipname'
364 mxget.o(.text+0x11c): undefined reference to`__dn_expand'
365 mxget.o(.text+0x187): undefined reference to`__dn_expand'
366 make: *** [fetchmail] Error 1
369 then you must add "-lresolv" to the LOADLIBS line in your Makefile
370 since you have installed the `bind' package.<P>
373 <h2><a name="F1">F1. Why does my old .fetchmailrc file no longer work?</a></h2>
375 <h3>If your file predates 4.0.6:</h3>
377 Just after the `<CODE>via</CODE>' option was introduced, I realized
378 that the interactions between the `<CODE>via</CODE>',
379 `<CODE>aka</CODE>', and `<CODE>localdomains</CODE>' options were out
380 of control. Their behavior had become complex and confusing, so much so
381 that I was no longer sure I understood it myself. Users were being
382 unpleasantly surprised.<P>
384 Rather than add more options or crock the code, I re-thought it. The
385 redesign simplified the code and made the options more orthogonal, but
386 may have broken some complex multidrop configurations.
388 Any multidrop configurations that depended on the name just after the
389 `<CODE>poll</CODE>' or `<CODE>skip</CODE>' keyword being still
390 interpreted as a DNS name for address-matching purposes, even in the
391 presence of a `<CODE>via</CODE>' option, will break.<P>
393 It is theoretically possible that other unusual configurations (such
394 as those using a non-FQDN poll name to generate Kerberos IV tickets) might
395 also break; the old behavior was sufficiently murky that we can't be
396 sure. If you think this has happened to you, contact the maintainer.<P>
398 <h3>If your file predates 3.9:</h3>
400 It could be because you're using a .fetchmailrc that's written in the
401 old popclient syntax without an explicit `<CODE>username</CODE>'
402 keyword leading the first user entry attached to a server entry.
404 This error can be triggered by having a user option such as `<CODE>keep</CODE>'
405 or `<CODE>fetchall</CODE>' before the first explicit username. For
406 example, if you write<p>
409 poll openmail protocol pop3
410 keep user "Hal DeVore" there is hdevore here
413 the `<CODE>keep</CODE>' option will generate an entire user entry with
414 the default username (the name of fetchmail's invoking user).<p>
416 The popclient compatibility syntax was removed in 4.0. It complicated
417 the configuration file grammar and confused users.<p>
419 <h3>If your file predates 2.8:</h3>
421 The `<CODE>interface</CODE>', `<CODE>monitor</CODE>' and
422 `<CODE>batchlimit</CODE>' options changed after 2.8.<p>
424 They used to be global options with `<CODE>set</CODE>' syntax like the
425 batchlimit and logfile options. Now they're per-server options, like
426 `<CODE>protocol</CODE>'.<p>
428 If you had something like<p>
431 set interface = "sl0/10.0.2.15"
434 in your .fetchmailrc file, simply delete that line and insert
435 `interface sl0/10.0.2.15' in the server options part of your `defaults'
438 Do similarly for any `<CODE>monitor</CODE>' or `<CODE>batchlimit</CODE>' options.<p>
441 <h2><a name="F2">F2. The .fetchmailrc parser won't accept my all-numeric user name.</a></h2>
443 So put string quotes around it. :-)<p>
445 The configuration file parser treats any all-numeric token as a
446 number, which will confuse it when it's expecting a name. String
447 quoting forces the token's class.<p>
450 <h2><a name="F3">F3. The .fetchmailrc parser won't accept my host or username beginning with `no'.</a></h2>
452 You're caught in an unfortunate crack between the newer-style syntax
453 for negated options (`no keep', `no rewrite' etc.) and the older style
454 run-on syntax (`nokeep', `norewrite' etc.).<p>
456 You can work around this easily. Just put string quotes around your
459 I haven't fixed this because there is no good fix for it short of
460 implementing a token pushback stack in the lexer. That's more
461 additional complexity than I'm willing to add to banish a very
462 marginal bug with an easy workaround.<p>
465 <h2><a name="F4">F4. I'm migrating from popclient. How do I need to modify my .poprc?</a></h2>
467 If you have been using popclient (the ancestor of this program)
468 at version 3.0b6 or later, start with this<p>
471 (cd; mv .poprc .fetchmailrc)
474 in order to migrate. Be aware that some of popclient's unnecessary
475 options have been removed (see the NOTES file in the distribution for
476 explanation). You can't deliver to a local mail file or to
477 standard output any more, and using an MDA for delivery is
478 discouraged. If you throw those options away, fetchmail will now
479 forward your mail into your system's normal Internet-mail delivery
482 Actually, using an MDA is now almost always the wrong thing; the MDA
483 facility has been retained only for people who can't or won't run a
484 sendmail-like SMTP listener on port 25. The default, SMTP forwarding
485 to port 25, is better for at least two major reasons. One: it feeds
486 retrieved POP and IMAP mail into your system's normal delivery path
487 along with local mail and normal Internet mail, so all your normal
488 filtering/aliasing/forwarding setup for local mail works. Two:
489 because the port 25 listener returns a positive acknowledge, fetchmail
490 can be sure you're not going to lose mail to a disk-full or some other
491 resource-exhaustion problem.<p>
493 If you used to use <CODE>-mda "procmail -d</CODE>
494 <em><you></em><CODE>"</CODE> or something similar, forward to port
495 25 and do "<CODE>| procmail -d</CODE> <em><you></em><CODE>"</CODE> in
496 your ~/.forward file.<p>
498 As long as your new .fetchmailrc file does not use the removed
499 `localfolder' option or `<CODE>limit</CODE>' (which now takes a
500 maximum byte size rather than a line count), a straight move or copy
501 of your .poprc will often work. (The new run control file syntax also
502 has to be a little stricter about the order of options than the old,
503 in order to support multiple user descriptions per server; thus you
504 may have to rearrange things a bit.)<p>
506 Run control files in the minimal .poprc format (without the `username'
507 token) will trigger a warning. To eliminate this warning, add the
508 `<CODE>username</CODE>' keyword before your first user entry per server (it is
509 already required before second and subsequent user entries per server.<p>
511 In some future version the `<CODE>username</CODE>' keyword will be required.<p>
514 <h2><a name="C1">C1. Why do I need a .fetchmailrc when running as root on my own machine?</a></h2>
516 Ian T. Zimmerman <itz@rahul.net> asked:<p>
518 On the machine where I'm the only real user, I run fetchmail as root
519 from a cron job, like this:<p>
522 fetchmail -u "itz" -p POP3 -s bolero.rahul.net
525 This used to work as is (with no .fetchmailrc file in root's home
526 directory) with the last version I had (1.7 or 1.8, I don't
527 remember). But with 2.0, it RECPs all mail to the local root user,
528 unless I create a .fetchmailrc in root's home directory containing:<p>
531 skip bolero.rahul.net proto POP3
535 It won't work if the second line is just "<CODE>user itz</CODE>". This is silly.<p>
537 It seems fetchmail decides to RECP the `default local user' (ie. the
538 uid running fetchmail) unless there are local aliases, and the
539 `default' aliases (itz->itz) don't count. They should.<p>
543 No they shouldn't. I thought about this for a while, and I don't much
544 like the conclusion I reached, but it's unavoidable. The problem is
545 that fetchmail has no way to know, in general, that a local user `itz'
548 "Ah!" you say, "Why doesn't it check the password file to see if the remote
549 name matches a local one?" Well, there are two reasons.<p>
551 One: it's not always possible. Suppose you have an SMTP host declared
552 that's not the machine fetchmail is running on? You lose.<p>
554 Two: How do you know server itz and SMTP-host itz are the same person?
555 They might not be, and fetchmail shouldn't assume they are unless
556 local-itz can explicitly produce credentials to prove it (that is, the
557 server-itz password in local-itz's .fetchmailrc file.).<p>
559 Once you start running down possible failure modes and thinking about
560 ways to tinker with the mapping rules, you'll quickly find that all the
561 alternatives to the present default are worse or unacceptably
562 more complicated or both.<p>
565 <h2><a name="C2">C2. How can I arrange for a fetchmail daemon to get killed when I log out?</a></h2>
567 Fetchmail versions before 2.3 actually used SIGHUP as a wakeup signal.
568 Newer versions use SIGUSR1 for wakeup (and SIGHUP only in
569 background-daemon mode) in order to avoid any potential confusion
570 about logout-time behavior. The right way to dispatch fetchmail on
571 logout is to arrange for the command `fetchmail -q' to be called on
574 Under bash, you can arrange this by putting `fetchmail -q' in the file
575 `~/.bash_logout'. Most csh variants execute `~/.logout' on logout.
576 For other shells, consult your shell manual page.<p>
579 <h2><a name="C3">C3. How do I know what interface and address to use with --interface?</a></h2>
581 This depends a lot on your local networking configuration (and right
582 now you can't use it at all except under Linux). However, here are
583 some important rules of thumb that can help. If they don't work, ask
584 your local sysop or your Internet provider.<p>
586 First, you may not need to use --interface at all. If your machine
587 only ever does SLIP or PPP to one provider, it's almost certainly by a
588 point to point modem connection to your provider's local subnet that's
589 pretty secure against snooping (unless someone can tap your phone or
590 the provider's local subnet!). Under these circumstances, specifying
591 an interface address is fairly pointless.<p>
593 What the option is really for is sites that use more than one
594 provider. Under these circumstances, typically one of your provider
595 IP addresses is your mailserver (reachable fairly securely via the
596 modem and provider's subnet) but the others might ship your packets
597 (including your password) over unknown portions of the general
598 Internet that could be vulnerable to snooping. What you'll use
599 --interface for is to make sure your password only goes over the
602 To determine the device:<p>
605 <li> If you're using a SLIP link, the correct device is probably sl0.
606 <li> If you're using a PPP link, the correct device is probably ppp0.
607 <li> If you're using a direct connection over a local network such as
608 an ethernet, use the command `netstat -r' to look at your routing table.
609 Try to match your mailserver name to a destination entry; if you don't
610 see it in the first column, use the `default' entry. The device name
611 will be in the rightmost column.
614 To determine the address and netmask:<p>
617 <li> If you're talking to slirp, the correct address is probably 10.0.2.15,
618 with no netmask specified. (It's possible to configure slirp to present
619 other addresses, but that's the default.)
621 <li> If you have a static IP address, run `ifconfig <device>', where <device>
622 is whichever one you've determined. Use the IP address given after
623 "inet addr:". That is the IP address for your end of the link, and is
624 what you need. You won't need to specify a netmask.
626 <li> If you have a dynamic IP address, your connection IP will vary randomly
627 over some given range (that is, some number of the least significant bits
628 change from connection to connection). You need to declare an address
629 with the variable bits zero and a complementary netmask that sets
633 To illustrate the rule for dynamic IP addresses, let's suppose you're
634 hooked up via SLIP and your IP provider tells you that the dynamic
635 address pool is 255 addresses ranging from 205.164.136.1 to
636 205.164.136.255. Then<p>
639 interface "sl0/205.164.136.0/255.255.255.0"
642 would work. To range over any value of the last two octets
643 (65536 addresses) you would use<p>
646 interface "sl0/205.164.0.0/255.255.0.0"
650 <h2><a name="C4">C4. How can I get fetchmail to work with ssh?</a></h2>
652 We have two recipes for this. The first is a little easier to set up,
653 but only supports one user at a time.<P>
655 First, a lightly edited version of a recipe from Masafumi NAKANE:<p>
657 1. You must have ssh (the ssh client) on the local host and sshd (ssh
658 server) on the remote mail server. And you have to configure ssh so
659 you can login to the sshd server host without a password. (Refer to ssh
660 man page for several authentication methods.)<p>
662 2. Add something like following to your .fetchmailrc file: <p>
665 poll mailhost port 1234 via localhost with pop3:
666 preconnect "ssh -f -L 1234:mailhost:110 mailhost sleep 20 </dev/null >/dev/null";
669 (Note that 1234 can be an arbitrary port number. Privileged ports can
670 be specified only by root.) The effect of this ssh command is to
671 forward connections made to localhost port 1234 (in above example) to
674 This configuration will enable secure mail transfer. All the
675 conversation between fetchmail and remote pop server will be
678 If sshd is not running on the remote mail server, you can specify
679 intermediate host running it. If you do this, however, communication
680 between the machine running sshd and the POP server will not be encrypted.
681 And the preconnect line would be like this:<p>
684 preconnect "ssh -f -L 1234:mailhost:110 sshdhost sleep 20 </dev/null >/dev/null"
687 You can work this trick with IMAP too, but the port number 110 in the
688 above would need to become 143.<p>
690 Second, a recipe from Charlie Brady <cbrady@ind.tansu.com.au>:<p>
692 Charlie says: "The [previous] recipe certainly works, but
693 the solution I post here is better in a few respects":
696 <LI>this method will not fail if two or more users attempt to use fetchmail
698 <LI>you are able to use the full facilities of tcpd to control access
699 <LI>this method does not depend on the preconnect feature of fetchmail, so
700 can be used for tunneling of other services as well.
707 Make sure that the "socket" program is installed on the server machine.
709 Set up an unprivileged account on your system with a .ssh directory
710 containing an SSH identity file "identity" with no pass phrase,
711 "identity.pub" and "known_hosts" containing the host key of your
712 mailhost. Let's call this account "noddy".
714 On mailhost, set up no-password access for noddy@yourhost. Add to your
715 SSH authorised_keys file:
718 command="socket localhost 110",no-port-forwarding 1024 ......
721 where "<code>1024</code> ......" is the content of noddy's identity.pub file.
723 Create a script /usr/local/bin/ssh.fm and make it executable:
727 exec ssh -q -C -l your.login.id -e none mailhost socket localhost 110
730 Add an entry in inetd.conf for whatever port you choose to use - say:
733 1234 stream tcp nowait noddy /usr/sbin/tcpd /usr/local/bin/ssh.fm
736 Send a HUP signal to your inetd.
739 Now just use localhost:1234 to access your POP server.<P>
742 <h2><a name="C5">C5. How can I set up support for sendmail's anti-spam 571 response?</a></h2>
744 Rachel Polanskis <r.polanskis@nepean.uws.edu.au> writes:<p>
746 Basically you need to use the "check_*" rules in sendmail.
747 These are rules introduced since version 8.8.2<p>
749 The idea is to generate a list of domains and addresses that are placed into
750 a file - I call mine "sendmail.rej" and you place just one domain
751 or email address on each line. During the SMTP transaction, this file
752 is checked and if there is a match, the message is refused, with
753 a suitable "Service not available" message sent back to the sender.<p>
755 With the feature enabled in fetchmail, the mail is simply deleted,
756 with no further processing.<p>
758 The only drawback when blocking spam with fetchmail is that you
759 do not get the satisfaction of sending an error back to the sender.<p>
761 To actually use the check_mail rules in sendmail 8.8.2 or better,
762 you need to know how to generate a sendmail.cf file from the m4
763 config files distributed with sendmail.<p>
765 The actual rules can be found at the following URLS:<p>
767 <a href="http://www.informatik.uni-kiel.de/%7Eca/email/check.html">
768 http://www.informatik.uni-kiel.de/%7Eca/email/check.html</a><p>
770 This one is by Claus Aßman, who has documented more of sendmail then
773 The actual setup I used though was by David Begley, who has put together
774 a WWW page describing how to quickly implement these rules yourself.<p>
776 <a href="http://www.nepean.uws.edu.au/users/david/pe/blockmail.html">
777 http://www.nepean.uws.edu.au/users/david/pe/blockmail.html</a><p>
779 David's pages could be moving shortly. I will post an update if it happens.<p>
781 Remember, when copying these rulesets off the web, that there are tabs
782 embedded in them, that may not be preserved. You <em>must</em> reintroduce
783 these tabs into the rules to make them work properly. <p>
785 Once you have your ruleset in place, and have generated a nice sendmail.cf
786 file, and the list of blocked sites, try telneting to your
787 SMTP port to test it, and send a message with a blocked address in it.<p>
789 You should see a message similar to:<p>
792 "571 unsolicited email is refused"
795 Next, if you have access to a host that you can send mail from, that
796 is <em>not</em> your mail host, add that host to your spamlist and
799 Send a message to your mailing address from that host and then pop off
800 the message with fetchmail, using the -v argument. You can monitor
801 the SMTP transaction, and when the FROM address is parsed, if sendmail
802 sees that it is an address in spamlist, fetchmail will flush and
805 Under no circumstances put your <strong>mailhost</strong> or <strong>any host
806 you accept mail from</strong> using fetchmail into your reject file. You
807 <strong>will</strong> lose mail if you do this!!!<p>
809 The check_ rules work, and they work well. Coupled with fetchmail's
810 ability to respond to the appropriate error messages, you can be assured
811 of never seeing a spam from any address you put in the reject list.<p>
813 The only thing that is missing, as mentioned previously, is the ability
814 to allow sendmail to process the message further and generate an error
815 message to the sender. <p>
818 <h2><a name="C6">C6. How can I do automatic startup/shutdown of fetchmail
819 when I may have multiple login sessions going?</a></h2>
821 In the contrib subdirectory of the fetchmail distribution there is
822 some shell code you can add to your .bash_login and .bash_logout
823 profiles that will accomplish this. Thank James Laferriere
824 <babydr@nwrain.net> for it.<p>
827 <h2><a name="T1">T1. How can I use fetchmail with qmail?</a></h2>
829 Turn on the <CODE>forcecr</CODE> option; qmail's listener mode doesn't like
830 header or message lines terminated with bare linefeeds.<p>
832 (This information is thanks to Robert de Bath
833 <robert@mayday.cix.co.uk>.)<p>
835 If a mailhost is using the qmail package (see <a
836 href="http://pobox.com/~djb/qmail.html">http://pobox.com/~djb/qmail.html</a>)
837 then, providing the local hosts are also using qmail, it is possible
838 to set up one fetchmail link to be reliably collect the mail for an
841 One of the basic features of qmail is the `Delivered-To:' message
842 header. Whenever qmail delivers a message to a local mailbox it puts
843 the username and hostname of the envelope recipient on this line. The
844 major reason for this is to prevent mail loops. <p>
846 To set up qmail to batch mail for a disconnected site the ISP-mailhost
847 will have normally put that site in its `virtualhosts' control file so
848 it will add a prefix to all mail addresses for this site. This results
849 in mail sent to 'username@userhost.userdom.dom.com' having a
850 'Delivered-To:' line of the form:<p>
853 Delivered-To: mbox-userstr-username@userhost.userdom.dom.com
856 A single host maildrop will be slightly simpler:
859 Delivered-To: mbox-userstr-username@userhost.dom.com
862 The ISP can make the 'mbox-userstr-' prefix anything they choose
863 but a string matching the user host name is likely.<p>
865 To use this line you must:<p>
868 <li>Ensure the option `envelope Delivered-To:' is in the fetchmail
871 <li>Ensure you have a localdomains containing 'userdom.dom.com' or
872 `userhost.dom.com' respectively.
875 So far this reliably delivers messages to the correct machine of the
876 local network, to deliver to the correct user the 'mbox-userstr-'
877 prefix must be stripped off of the user name. This can be done by
878 setting up an alias within the qmail MTA on each local machine.
879 Simply create a dot-qmail file called '.qmail-mbox-userstr-default'
880 in the alias directory (normally /var/qmail/alias) with the contents:<p>
883 | ../bin/qmail-inject -a -f"$SENDER" "${LOCAL#mbox-userstr-}@$HOST}"
886 Note this <em>does</em> require a modern /bin/sh.<p>
888 Luca Olivetti adds:<P>
890 If you aren't using qmail locally, or you don't want to set up the
891 alias mechanism described above, you can use the option `<code>qvirtual
892 "mbox-userstr-"</code>' in your fetchmail config file to strip the prefix
893 from the local user name.<p>
896 <h2><a name="T2">T2. How can I use fetchmail with exim?</a></h2><p>
898 By default, the exim listener enforces the the RFC1123 requirement
899 that MAIL FROM and RCPT TO addresses you pass to it have to be canonical
900 (e.g. with a fully qualified hostname part). <p>
902 Fetchmail always passes fully qualified RCPT TO addresses. But
903 MAIL FROM is a potential problem if the MTAs upstream from your fetchmail
904 don't necessarily pass canonicalized From and Return-Path addresses,
905 and fetchmail's <CODE>rewrite</CODE> option is off. The specific case
906 where this has come up involves bounce messages generated by sendmail
907 on your mailer host, which have the (un-canonicalized) origin address
910 The right way to fix this is to enable the <CODE>rewrite</CODE> option and
911 have fetchmail canonicalize From and Return-Path addresses with the
912 mailserver hostname before exim sees them. This option is enabled by
913 default, so it won't be off unless you turned it off.<p>
915 If you must run with <CODE>rewrite</CODE> off, there is a switch in exim's
916 configuration files that allows it to accept domainless MAIL FROM
917 addresses; you will have to flip it by putting the line <p>
920 sender_unqualified_hosts = localhost
923 in the main section of the exim configuration file. Note that this
924 will result in such messages having an incorrect domain name attached
925 to their return address (your SMTP listener's hostname rather than
926 that of the remote mail server). <p>
929 <h2><a name="T3">T3. How can I use fetchmail with smail?</a></h2><p>
931 Smail 3.2 is very nearly plug-compatible with sendmail, and may work
932 fine out of the box.<P>
934 We have one report that when processing multiple messages from a
935 single fetchmail session, smail sometimes delivers them in an
936 order other than received-date order. This can be annoying because it
937 scrambles conversational threads. This is not fetchmail's problem,
938 it is an smail "feature" and has been reported to the maintainers
941 Very recent smail versions require an <code>-smtp_hello_verify</code>
942 option in the smail config file. This overrides smail's check to see
943 that the HELO address is actually that of the client machine, which
944 is never going to be the case when fetchmail is in the picture.
945 According to RFC1123 an SMTP listener <em>must</em> allow this
946 mismatch, so smail's new behavior (introduced sometime between
947 3.2.0.90 and 3.2.0.95) is a bug.<P>
950 <h2><a name="T4">T4. How can I use fetchmail with SCO's MMDF?</a></h2><p>
952 We're told this is possible, but difficult and tricky (and we don't
953 have the recipe for it). Our informant suggests dropping MMDF and
954 using sendmail instead.<P>
957 <h2><a name="T5">T5. How can I use fetchmail with Lotus Notes?</a></h2><p>
959 The Lotus Notes SMTP gateway tries to deduce when it should convert \n
960 to \r\n, but its rules are not intuitive. Use `forcecr'.<P>
963 <h2><a name="T6">T6. How can I use fetchmail with Microsoft Exchange?</a></h2><p>
965 M$ Exchange violates the POP3 RFCs. Its LIST command does not reveal
966 the real sizes of mail in the pop mailbox, but the sizes of the
967 compressed versions in the exchange mail database (thanks to Arjan De
968 Vet and Guido Van Rooij for alerting us to this problem).<P>
970 Fetchmail works with M$ Exchange, despite this braindamage. Two
971 features are compromised. One is that the --limit option will not
972 work right (it will check against compressed and not actual sizes).
973 The other is that a too-small SIZE argument may be passed to your
974 ESMTP listener, assuming you're using one (this should not be a
975 problem unless the actual size of the message is above the listener's
976 configured length limit).<P>
978 If you want these fixed, go bug the Evil Empire. Or, better yet,
979 install a real operating system on your server and run IMAP.<P>
982 <h2><a name="T7">T7. How can I use fetchmail with CompuServe RPA?</a></h2>
984 First, make sure your fetchmail has the RPA support compiled in.
985 Stock fetchmail binaries (such as you might get from an RPM) don't.
986 You can check this by looking at the output of <code>fetchmail -V</code>;
987 if you see the string "+RPA" after the version ID you're good to go,
988 otherwise you'll have to build your own from sources (see the INSTALL
989 file in the source distribution for directions).<P>
991 Give your RPA pass-phrase as your password. An RPA-enabled fetchmail
992 will automatically check for csi.com in the POP server's greeting
993 line. If that's found, it will query the server to see if it is
994 RPA-capable, and if so do an RPA transaction rather than a plain-text
995 password handshake.<P>
998 <h2><a name="T8">T8. How can I use fetchmail with HP OpenMail?</a></h2>
1000 No special configuration is required, but OpenMail has an annoying bug
1001 similar to the big one in <a href="#T6">Microsoft Exchange</a>.
1002 The message sizes it gives in the LIST are rounded to the nearest 1024
1003 bytes. It also has a nasty habit of discarding headers it doesn't
1004 recognize, such as X- and Resent- headers.<P>
1006 As with M$ Exchange, the only real fix for these problems is to get a
1007 POP server that isn't brain-dead.<P>
1010 <h2><a name="R1">R1. Fetchmail isn't working, and -v shows `SMTP connect failed' messages.</a></h2>
1012 Fetchmail itself is probably working, but your SMTP port 25 listener
1013 is down or inaccessible.<p>
1015 The first thing to check is if you can telnet to port 25 on your smtp
1016 host (which is normally `localhost' unless you've specified an smtp
1017 option in your .fetchmailrc or on the command line) and get a greeting
1018 line from the listener. If the SMTP host is inaccessible or the listener
1019 is down, fix that first.<p>
1021 If the listener seems to be up when you test with telnet, the most
1022 benign and typical problem is that the listener had a momentary seizure
1023 due to resource exhaustion while fetchmail was polling it -- process
1024 table full or some other problem that stopped the listener process
1025 from forking. If your SMTP host is not `localhost' or something else
1026 in /etc/hosts, the fetchmail glitch could also have been caused by
1027 transient nameserver failure. <p>
1029 Try running fetchmail -v again; if it succeeds, you had one of these
1030 kinds of transient glitch. You can ignore these hiccups, because a
1031 future fetchmail run will get the mail through. <p>
1033 If the listener tests up, but you have chronic failures trying to
1034 connect to it anyway, your problem is more serious. One way to work
1035 around chronic SMTP connect problems is to use --mda. But this only
1036 attacks the symptom; you may have a DNS or TCP routing problem. You
1037 should really try to figure out what's going on underneath before it
1038 bites you some other way. <p>
1040 We have one report (from toby@eskimo.com) that you can sometimes solve
1041 such problems by doing an <CODE>smtp</CODE> declaration with an IP
1042 address that your routing table maps to something other than the
1043 loopback device (he used ppp0).<p>
1045 We also have a report that this error can be caused by having an
1046 /etc/hosts file that associates your client host name with more than
1049 We had another report from a Linux user of fetchmail 2.1 who solved his SMTP
1050 connection problem by removing the reference to -lresolv from his link
1051 line and relinking. Apparently in some older Linux distributions the
1052 libc bind library version works better.<p>
1054 As of 2.2, the configure script has been hacked so the bind library is
1055 linked only if it is actually needed. So under Linux it won't be, and
1056 this particular cause should go away.<p>
1059 <h2><a name="R2">R2. When I try to configure an MDA, fetchmail doesn't work.</a></h2>
1061 (I hear this one from people who have run into the blank-line problem in <a href="#X1">X1</a>.)<p>
1063 Try sending yourself test mail and retrieving it using the
1064 command-line options `<CODE>-k -m cat</CODE>'. This will dump exactly what
1065 fetchmail retrieves to standard output (plus the Received line
1066 fetchmail itself adds to the headers). <p>
1068 If the dump doesn't match what shows up in your mailbox when you
1069 configure an MDA, your MDA is mangling the message. If it doesn't
1070 match what you sent, then fetchmail or something on the server is
1074 <h2><a name="#R4">R4. Fetchmail dumps core when given an invalid rc file.</a></h2>
1076 This is usually reported from AIX or Ultrix, but has even been known
1077 to happen on Linuxes without a recent version of <code>flex</code>
1078 installed. The problem appears to be a result of linking with an
1079 archaic version of lex.<P>
1081 Workaround: fix the syntax of your .fetchmailrc file.<P>
1083 Fix: build and install the latest version of <a
1084 href="ftp://prep.ai.mit.edu/~ftp/pub/gnu">flex</a> from the Free
1085 Software Foundation. An FSF <a
1086 href="http://www.gnu.ai.mit.edu/order/ftp.html">mirror site</a>
1087 will help you get it faster.<P>
1090 <h2><a name="R4">R4. Fetchmail dumps core in -V mode, but operates normally otherwise.</a></h2>
1092 We've had this reported to us under Linux using libc-5.4.17 and gcc-2.7.2.
1093 It does not occur with libc-5.3.12 or earlier versions.<p>
1095 Workaround: link with GNU malloc rather than the stock C library malloc.<p>
1097 We're told there is some problem with the malloc() code in that
1098 version which makes it fragile in the presence of multiple free()
1099 calls on the same pointer (the malloc arena gets corrupted).
1100 Unfortunately it appears from doing gdb traces that whatever free()
1101 calls producing the problem are being made by the C library itself, not the
1102 fetchmail code (they're all from within fclose, and not an fclose called
1103 by fetchmail, either).<p>
1106 <h2><a name="R5">R5. Fetchmail dumps core when I use a .netrc file but works otherwise.</a></h2>
1108 We have a report that under Solaris 2.5 using gcc-2.7.2, if fetchmail
1109 is compiled with -O or -O2, it segfaults on startup when reading a
1112 You can work around this by disabling optimization.<p>
1114 There may be an actual bug here that the optimizer exposes; the stack
1115 trace says the segfault is in free() and has all the earmarks of a heap-
1116 corruption screw. But the symptom doesn't reproduce under Linux with the
1117 same .fetchmailrc and .netrc.<p>
1120 <h2><a name="R6">R6. Running fetchmail in daemon mode doesn't work.</a><br></h2>
1122 We have one report from a Solaris 4.1.4 user that trying to run
1123 fetchmail in detached daemon mode doesn't work, but that using the
1124 same options with -N (nodetach) is OK.<P>
1126 If this happens, you have a specific portability problem with the code
1127 in daemon.c that detaches and backgrounds the daemon fetchmail. Tell
1128 me about it so I can try to fix it. As a workaround, you can start
1129 fetchmail with -N and an ampersand to background it.<P>
1131 This should not happen under Linux or any truly POSIX-conformant Unix.<P>
1134 <h2><a name="D1">D1. I think I've set up fetchmail correctly, but I'm not getting any mail.</a></h2>
1136 Maybe you have a .forward or alias set up that you've forgotten about. You
1137 should probably remove it.<p>
1139 Or maybe you're trying to run fetchmail in multidrop mode as root
1140 without a .fetchmailrc file. This doesn't do what you think it
1141 should; see question <a href="#C1">C1</a>.<p>
1143 Or you may not be connecting to the SMTP listener. Run fetchmail -v
1144 and see <a href="#R1">R1</a>.<p>
1147 <h2><a name="D2">D2. All my mail seems to disappear after an interrupt.</a></h2>
1149 One POP3 daemon used in the Berkeley Unix world that reports itself as
1150 POP3 version 1.004 actually throws the queue away. 1.005 fixed that.
1151 If you're running this one, upgrade immediately.<P>
1153 Many POP servers, if an interruption occurs, will restore the whole
1154 mail queue after about 10 minutes. Others will restore it right
1155 away. If you have an interruption and don't see it right away, cross
1156 your fingers and wait ten minutes before retrying.<P>
1158 Some servers (such as Microsoft's NTMail) are mis-designed to restore
1159 the entire queue, including messages you have deleted. If you have
1160 one of these and it flakes out on you a lot, try setting a small
1161 <code>--fetchlimit</code> value. This will result in more IP connects
1162 to the server but will mean it actually executes changes to the queue
1165 Qualcomm's qpopper, used at many BSD Unix sites, is better behaved.
1166 If its connection is dropped, it will first execute all DELE commands (as
1167 though you had issued a QUIT -- this is a technical violation of
1168 the POP3 RFCs, but a good idea in a world of flaky phone lines). Then it
1169 will re-queue any message that was being downloaded at hangup time.
1170 Still, qpopper may require a noticeable amount of time to do deletions
1171 and clean up its queue. (Fetchmail waits a bit before retrying in
1172 order to avoid a `lock busy' error.)<P>
1175 <h2><a name="D3">D3. Mail that was being fetched when I interrupted my fetchmail seems to have been vanished.</a></h2>
1177 Fetchmail only sends a delete mail request to the server when either
1178 (a) it gets a positive delivery acknowledgement from the SMTP
1179 listener, or (b) it gets an error 571 (the spam-filter error) from the
1180 listener. No interrupt can cause it to lose mail.<p>
1182 However, POP3 has a design problem in that its servers mark a message
1183 `seen' as soon as the fetch command to get it is sent down. If for
1184 some reason the message isn't actually delivered (you take a line hit
1185 during the download, or your port 25 listener can't find enough free
1186 disk space, or you interrupt the delivery in mid-message) that `seen'
1187 message can lurk invisibly in your server mailbox forever.<p>
1189 Workaround: add the `<CODE>fetchall</CODE>' keyword to your POP3 fetch options.<p>
1191 Solution: switch to an <a href="http://www.imap.org">IMAP</a> server.<p>
1194 <h2><a name="M1">M1. I've declared local names, but all my multidrop
1195 mail is going to root anyway.</a></h2>
1197 Somehow your fetchmail is never matching the hostname part of
1198 recipient names to the name of the mailserver machine. This probably
1199 means it is unable to recognize hostname parts as being DNS names of
1200 the mailserver, and indicates some kind of DNS configuration
1201 problem either on the server or your client machine. <p>
1203 The easiest workaround is to add a `<CODE>via</CODE>' option (if
1204 necessary) and add enough aka declarations to cover all of your
1205 mailserver's aliases, then say `<CODE>no dns</CODE>'. This will take
1206 DNS out of the picture (though it means mail may be uncollected if
1207 it's sent to an alias of the mailserver that you don't have
1210 It would be better to fix your DNS, however. DNS problems can hurt
1211 you in lots of ways, for example by making your machines
1212 intermittently or permanently unreachable to the rest of the net.<P>
1215 <h2><a name="M2">M2. I can't seem to get fetchmail to route to a local domain properly.</a></h2>
1217 A lot of people want to use fetchmail as a poor man's internetwork
1218 mail gateway, picking up mail accumulated for a whole domain in a single
1219 server mailbox and then routing based on what's in the To/Cc/Bcc lines.<p>
1221 In general, this is not really a good idea. It would be smarter to
1222 just let the mail sit in the mailserver's queue and use fetchmail's
1223 ETRN mode to trigger SMTP sends periodically (of course, this means
1224 you have to poll more frequently than the mailserver's expiry period).
1225 If you can't arrange this, try setting up a UUCP feed.<P>
1227 If neither of these alternatives is available, multidrop mode may do
1228 (though you <em>are</em> going to get hurt by some mailing list
1229 software; see the caveats under THE USE AND ABUSE OF MULTIDROP
1230 MAILBOXES on the man page). If you want to try it, the way to do it
1231 is with the `<CODE>localdomains</CODE>' option.<p>
1233 In general, if you use localdomains you need to make sure of two other
1236 <strong>1. You've actually set up your .fetchmailrc entry to invoke multidrop mode.</strong><p>
1238 Many people set a `<CODE>localdomains</CODE>' list and then forget
1239 that fetchmail wants to see more than one name (or the wildcard `*')
1240 in a `<CODE>here</CODE>' list before it will do multidrop routing.<p>
1242 <strong>2. You may have to set `no envelope'.</strong><p>
1244 Normally, multidrop mode tries to deduce an envelope address from a message
1245 before parsing the To/Cc/Bcc lines (this enables it to avoid losing to mailing
1246 list software that doesn't put a recipient addess in the To lines).<p>
1248 Some ways of accumulating a whole domain's messages in a single server
1249 mailbox mean it all ends up with a single envelope address that is
1250 useless for rerouting purposes. You may have to set `<CODE>no
1251 envelope</CODE>' to prevent fetchmail from being bamboozled by this.<p>
1253 Check also answer <a href="#T1">T1</a> on a reliable way to do multidrop
1254 delivery if your ISP (or your mail redirection provider) is using qmail.<p>
1257 <h2><a name="M3">M3. I tried to run a mailing list using multidrop, and I have a mail loop!</a></h2>
1259 This isn't fetchmail's fault. Check your mailing list. If the list
1260 expansion includes yourself or anybody else at your mailserver (that is, not on
1261 the client side) you've created a mail loop. Just chop the host part off any
1262 local addresses in the list.<p>
1264 If you use sendmail, you can check the list expansion with
1265 <CODE>sendmail -bv</CODE>.<p>
1268 <h2><a name="M4">M4. My multidrop fetchmail seems to be having DNS problems.</a></h2>
1270 We have one report from a Linux user (not the same one as in <a
1271 href="#R1">R1</a>!) who solved this problem by removing the reference
1272 to -lresolv from his link line and relinking. Apparently in some
1273 recent Linux distributions the libc bind library version works
1276 As of 2.2, the configure script has been hacked so the bind library is linked
1277 only if it is actually needed. So under Linux it won't be, and this problem
1281 <h2><a name="M5">M5. I'm seeing long DNS delays before each message is processed.</a></h2>
1283 Use the `<CODE>aka</CODE>' option to pre-declare as many of your
1284 mailserver's DNS names as you can. When an address's host part
1285 matches an aka name, no DNS lookup needs to be done to check it.<p>
1287 If you're sure you've pre-declared all of your mailserver's DNS dames,
1288 you can use the `<CODE>no dns</CODE>' option to prevent other hostname
1289 parts from being looked up at all.<p>
1291 Sometimes delays are unavoidable. Some SMTP listeners try to call DNS
1292 on the From-address hostname as a way of checking that the address is valid.<p>
1295 <h2><a name="M6">M6. How do I get multidrop mode to work with majordomo?</a></h2>
1297 In order for sendmail to execute the command strings in the majordomo
1298 alias file, it is necessary for sendmail to think that the mail it
1299 receives via SMTP really is destined for a local user name. A normal
1300 virtual-domain setup results in delivery to the default mailbox,
1301 rather than expansion through majordomo.<P>
1303 Michael <michael@bizsystems.com> gave us a recipe for dealing
1304 with this case that pairs a run control file like this:<P>
1307 poll your.pop3.server proto pop3:
1309 localdomains virtual.localdomain1.com virtual.localdomain2.com ...
1310 user yourISPusername is root * here,
1311 password yourISPpassword fetchall
1314 with a hack on your local sendmail.cf like this:<P>
1317 #############################################
1318 # virtual info, local hack for ruleset 98 #
1319 #############################################
1321 # domains to treat as direct mapped local domain
1323 CVvirtual.localdomain1.com virtual.localdomain2.com ...
1324 ---------------------------
1326 -------------------------
1327 # handle virtual users
1329 R$+ <@ $=V . > $: $1 < @ $j . >
1330 R< @ > $+ < @ $=V . > $: $1 < @ $j . >
1331 R< @ > $+ $: $1
1332 R< error : $- $+ > $* $#error $@ $1 $: $2
1333 R< $+ > $+ < @ $+ > $: $>97 $1
1336 This ruleset just strips virtual domain names off the addresses of incoming
1337 mail. Your sendmail must be 8.8 or newer for this to work. Michael
1341 I use this scheme with 2 virtual domains and the default ISP
1342 user+domain and service about 30 mail accounts + majordomo on my
1343 inside pop3 server with fetchmail and sendmail 8.83<P>
1347 <h2><a name="X1">X1. Spurious blank lines are appearing in the headers of fetched mail.</a></h2>
1349 What's probably happening is that the POP/IMAP daemon on your
1350 mailserver is inserting a non-RFC822 header (like X-POP3-Rcpt:) and
1351 something in your delivery path (most likely an old version of the
1352 <em>deliver</em> program, which sendmail often calls to do local delivery) is
1353 failing to recognize it as a header.<p>
1355 This is not fetchmail's problem. The first thing to try is installing
1356 a current version of <em>deliver</em>. If this doesn't work, try to
1357 figure out which other program in your mail path is inserting the
1358 blank line and replace that. If you can't do either of these things,
1359 pick a different MDA (such as procmail) and declare it with the
1360 `<CODE>mda</CODE>' option.<p>
1363 <h2><a name="X2">X2. My mail client can't see a Subject line.</a></h2>
1365 First, see <a href="#X1">X1</a>. This is quite probably the same
1366 problem (X-POP3-Rcpt header or something similar being inserted by
1367 the server and choked on by an old version of <em>deliver</em>).<p>
1369 The O'Reilly sendmail book does warn that IDA sendmail doesn't process
1370 X- headers correctly. If this is your problem, all I can suggest is
1371 replacing IDA sendmail, because it's broken and not RFC822 conformant.<p>
1374 <h2><a name="X3">X3. Messages containing "From" at start of line are being split.</a></h2>
1376 If you know the messages aren't split in your server mailbox, then this
1377 is a problem with your POP/IMAP server, your client-side SMTP listener or
1378 your local delivery agent. Fetchmail cannot split messages.<p>
1380 Some POP daemons ignore Content-Length headers and split messages on
1381 From lines. We have one report that the 2.1 version of the BSD popper
1382 program (as distributed on Solaris 2.5 and elsewhere) is broken this way.<p>
1384 You can test this. Declare an mda of `cat' and send yourself one
1385 piece of mail containing "From" at start of a line. If you see a
1386 split message, your POP/IMAP server is at fault. Upgrade to a more
1389 Sendmail and other SMTP listeners don't split RFC822 messages either.
1390 What's probably happening is either sendmail's local delivery agent or
1391 your mail reader are not quite RFC822-conformant and are breaking
1392 messages on what it thinks are Unix-style From headers. You can
1393 figure out which by looking at your client-side mailbox with vi or
1394 more. If the message is already split in your mailbox, your local
1395 delivery agent is the problem. If it's not, your mailreader is the
1398 If you can't replace the offending program, take a look at your
1399 sendmail.cf file. There will likely be a line something like<p>
1402 Mlocal, P=/usr/bin/procmail, F=lsDFMShP, S=10, R=20/40, A=procmail -Y -d $u
1405 describing your local delivery agent. Try inserting the `E' option in the
1406 flags part (the F= string). This will make sendmail turn each dangerous
1407 start-of-line From into a >From, preventing programs further downstream
1411 <h2><a name="generic_mangling"><a name="X4">X4. My mail is being mangled in a new and different way</a></a></h2>
1413 The first thing you need to do is pin down what program is doing the
1414 mangling. We don't like getting bug reports about fetchmail that are
1415 actually due to some other program's malfeasance, so please go through
1416 this diagnostic sequence before sending us a complaint.<P>
1418 There are five possible culprits to consider, listed here in the order
1419 they pass your mail:<P>
1422 <li> Programs upstream of your server mailbox.
1423 <li> The POP or IMAP server on your mailserver host.
1424 <li> The fetchmail program itself.
1425 <li> Your local sendmail.
1426 <li> Your LDA (local delivery agent), as called by sendmail or
1427 specified by <code>mda</CODE>.
1430 Often it happens that fetchmail itself is OK, but using it exposes
1431 pre-existing bugs in your downstream software, or your downstream
1432 software has a bad interaction with POP/IMAP. You need to pin down
1433 exactly where the message is being garbled in order to deduce what is
1434 actually going on.<P>
1436 The first thing to do is send yourself a test message, and retrieve it
1437 with a .fetchmailrc entry containing the following (or by running with
1438 the equivalent command-line options):<P>
1441 mda "cat >MBOX" keep fetchall
1444 This will capture exactly what fetchmail gets from the server, except
1445 for (a) the extra Received header line fetchmail prepends, (b) header address
1446 changes due to <code>rewrite</code>, and (c) any changes due to the
1447 <code>forcecr</code> and <code>stripcr</code> options. MBOX will in fact
1448 contain what programs downstream of fetchmail see.<P>
1450 The most common causes of mangling are bugs and misconfigurations in
1451 those downstream programs. If MBOX looks unmangled, you will know
1452 that is what is going on and that it is not fetchmail's problem. Take
1453 a look at the other FAQ items in this section for possible clues about
1454 how to fix your problem.<P>
1456 If MBOX looks mangled, the next thing to do is compare it with your
1457 actual server mailbox (if possible). That's why you specified
1458 <code>keep</code>, so the server copy would not be deleted. If your
1459 server mailbox looks mangled, programs upstream of your server mailbox
1460 are at fault. Unfortunately there is probably little you can do about
1461 this aside from complaining to your site postmaster, and nothing at
1462 all fetchmail can do about it!<P>
1464 More likely you'll find that the server copy looks OK. In that case
1465 either the POP/IMAP server or fetchmail is doing the mangling. To
1466 determine which, you'll need to telnet to the server port and simulate
1467 a fetchmail session yourself. This is not actually hard (both POP3
1468 and IMAP are simple, text-only, line-oriented protocols) but requires
1469 some attention to detail. You should be able to use a fetchmail -v
1470 log as a model for a session, but remember that the "*" in your LOGIN
1471 or PASS command dump has to be replaced with your actual password.<P>
1473 The objective of manually simulating fetchmail is so you can see
1474 exactly what fetchmail sees. If you see a mangled message, then your
1475 server is at fault, and you probably need to complain to your
1476 mailserver administrators. However, we like to know what the broken
1477 servers are so we can warn people away from them. So please send
1478 us a transcript of the session including the mangling <em>and the
1479 server's initial greeting line</em>. Please tell us anything else
1480 you think might be useful about the server, like the server host's
1481 operating system.<P>
1483 If your manual fetchmail simulation shows an unmangled message,
1484 congratulations. You've found an actual fetchmail bug. Complain
1485 to us and we'll fix it. Please include the session transcript of
1486 your manual fetchmail simulation along with the other things described
1487 in the FAQ entry on <a href="#G3">reporting bugs</a>.
1490 <h2><a name="O1">O1. The --logfile option doesn't work if the logfile doesn't exist.</a></h2>
1492 This is a feature, not a bug. It's in line with normal practice for
1493 system daemons and allows you to suppress logging by removing the log,
1494 without hacking potentially fragile startup scripts. To get around
1495 it, just touch(1) the logfile before you run fetchmail (this will have
1496 no effect on the contents of the logfile if it already exists).<P>
1499 <h2><a name="O2">O2. Every time I get a POP or IMAP message the header
1500 is dumped to all my terminal sessions.</a></h2>
1502 Fetchmail uses the local sendmail to perform final delivery, which
1503 Netscape and other clients doen't do; the announcement of new messages
1504 is done by a daemon that sendmail pokes. There should be a ``biff''
1505 command to control this. Type
1511 to turn it off. If this doesn't work, try the command
1517 which is essentially what <code>biff -n</code> will do. If this
1518 doesn't work, comment out any reference to ``comsat'' in your
1519 /etc/inetd.conf file and restart inetd.<P>
1521 In Slackware Linux distributions, the last line in /etc/profile is
1533 to solve the problem system-wide.<P>
1536 <h2><a name="O3">O3. Does fetchmail reread its rc file every poll cycle?</a></h2>
1538 No. Fetchmail only reads the rc file once, when it starts up. To
1539 force an rc file reread, do <code>fetchmail -q; fetchmail</code>.<P>
1542 <h2><a name="O4">O4. Why do deleted messages show up again when I take
1543 a line hit while downloading?</a></h2>
1545 Because you're using a POP3 other than Qualcomm qpopper, or an IMAP
1546 with a long expunge interval.<P>
1548 According to the POP3 RFCs, deletes aren't actually performed until
1549 you issue the end-of-session QUIT command. Fetchmail cannot fix this,
1550 it takes cooperation from the. server. There are two possible
1553 One is to switch to qpopper (the freeware POP3 server from Qualcomm,
1554 the Eudora people). The qpopper software violates the POP3 RFCs by
1555 doing an expunge (removing deleted messages) on a line hangup, as well
1556 as on processing a QUIT command.<P>
1558 The other (which we recommend) is to switch to <a
1559 href="http://www.imap.org">IMAP</a>. IMAP has an explicit expunge
1560 command and fetchmail normally uses it to delete messages immediately
1561 after they are downloaded.<P>
1563 If you get very unlucky, you might take a line hit in the window
1564 between the delete and the expunge. If you've set a longer expunge
1565 interval, the window gets wider. This problem should correct itself
1566 the next time you complete a successful query.<P>
1569 <h2><a name="O5">O5. Why is fetched mail being logged with my name, not the real From address?</a></h2>
1571 Because logging is done based on the address indicated by the sending
1572 SMTP's MAIL FROM, and some listeners are picky about that address.<p>
1574 Some SMTP listeners get upset if you try to hand them a MAIL FROM
1575 address naming a different host than the originating site for your
1576 connection. This is a feature, not a bug -- it's supposed to help
1577 prevent people from forging mail with a bogus origin site. (RFC 1123
1578 says you shouldn't do this exclusion...)<p>
1580 Since the originating site of a fetchmail delivery connection is
1581 localhost, this effectively means these picky listeners will barf on
1582 any MAIL FROM address fetchmail hands them with an @ in it!<p>
1584 Versions 2.1 and up try the header From address first and fall back to
1585 the calling-user ID. So if your SMTP listener isn't picky, the log
1589 <table width="100%" cellpadding=0><tr>
1590 <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a>
1591 <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a>
1592 <td width="30%" align=right>$Date: 1997/10/06 20:34:27 $
1595 <P><ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com"><esr@snark.thyrsus.com></A></ADDRESS>