I've been using fetchmail 5.2.7 on HP-UX for quite a while without
problems. Several times I've tried to upgrade to the latest version, but
had problems and since I didn't have time to look into it, just stuck with
5.2.7.
The problem I've encountered with versions > 5.2.7, is that the mail is
never retrieved. Looking at the log output, it's clear the messages are
available, but it appears fetchmail thinks it's already seen them.
Here's a log from HP-UX with fetchmail 5.6.0, followed by 5.2.7:
fetchmail: 5.6.0 querying <user> (protocol IMAP) at Fri, 01 Dec 2000 11:02:49
-0500 (EST)
fetchmail: 95 messages (95 seen) for <user> at <host>.
fetchmail: terminated with signal 15
fetchmail: starting fetchmail 5.2.7 daemon
fetchmail: 5.2.7 querying <user> (protocol IMAP) at Fri, 01 Dec 2000 11:04:19
-0500 (EST)
fetchmail: 95 messages (92 seen) for <user> at <host>.
fetchmail: reading message 93 of 95 (857 header octets) fetchmail: (249 body
octets) fetchmail: not flushed
fetchmail: reading message 94 of 95 (855 header octets) fetchmail: (247 body
octets) fetchmail: not flushed
fetchmail: reading message 95 of 95 (327 header octets) fetchmail: (134 body
octets) fetchmail: not flushed
fetchmail: 5.2.7 querying <user> (protocol IMAP) at Fri, 01 Dec 2000 11:14:26
-0500 (EST)
fetchmail: 95 messages for <user> at <host>.
The 5.6.0 run sees there's 95 messages, but thinks it's already seen
all 95. Stopping 5.6.0 and restarted with 5.2.7 correctly sees that 3 of
the 95 messages have not been seen.
On HP-UX I know I've tried at least 5.3.8, 5.4.3 and 5.6.0 and none worked
corrected.
Recently, I've migrated my workstation to RH Linux 7.1. The version of
fetchmail that comes with RH 7.1 is 5.7.4. I saw the same problem I'd
seen before, so I decided to upgrade to the latest 5.8.4. I'm still
seeing the same problem.
Here's a log from RH 7.1 with fetchmail 5.8.4:
fetchmail: 5.8.4 querying <user> (protocol IMAP) at Fri, 25 May 2001 11:09:02
-0400 (EDT)
fetchmail: 68 messages (68 seen) for <user> at <host>.
fetchmail: skipping message 1 (1361 octets) not flushed
fetchmail: skipping message 2 (4489 octets) not flushed
...
fetchmail: skipping message 67 (2474 octets) not flushed
fetchmail: skipping message 68 (2405 octets) not flushed
fetchmail: 5.8.4 querying <user> (protocol IMAP) at Fri, 25 May 2001 11:24:07
-0400 (EDT)
fetchmail: 70 messages (70 seen) for <user> at <host>.
fetchmail: skipping message 1 (1361 octets) not flushed
fetchmail: skipping message 2 (4489 octets) not flushed
...
fetchmail: skipping message 69 (1121 octets) not flushed
fetchmail: skipping message 70 (21568 octets) not flushed
The log shows there were 68 messages (all seen) at 11:09:02, 15 minutes
later, 2 more messages arrived bringing the total to 70, but fetchmail
thinks all 70 have been seen.
Here's the relevant parts of my .fetchmailrc:
set daemon 900 # Poll at 15-min intervals
set logfile log/fetchmail.log
defaults
poll <name> via <host> protocol IMAP:
user <ruser> is <luser> here password <passwd> keep;
Other than a new password, nothing in .fetchmailrc has changed for quite
some time... way before 5.2.7 in fact.
And finally, here's a verbose log with the IMAP commands for the
above situation:
fetchmail: starting fetchmail 5.8.4 daemon
fetchmail: 5.8.4 querying <user> (protocol IMAP) at Fri, 25 May 2001 11:51:59
-0400 (EDT)
fetchmail: IMAP< * OK imap-r01 v21_r5.2 server ready
fetchmail: IMAP> A0001 CAPABILITY
fetchmail: IMAP< * CAPABILITY IMAP4rev1 LITERAL+ XAOL-ENVELOPE XAOL-NETMAIL
XAOL-OPTION XAOL-NOFLAGS XAOL-NOFOLDER
fetchmail: IMAP< A0001 OK CAPABILITY completed
fetchmail: Protocol identified as IMAP4 rev 1
fetchmail: IMAP> A0002 LOGIN "<user>" "*"
fetchmail: IMAP< A0002 OK LOGIN completed
fetchmail: selecting or re-polling default folder
fetchmail: IMAP> A0003 SELECT "INBOX"
fetchmail: IMAP< * 70 EXISTS
fetchmail: IMAP< * OK [UIDVALIDITY 1] UID validity status
fetchmail: IMAP< * OK [UIDNEXT 1843138] predicted next UID
fetchmail: IMAP< * FLAGS (\Deleted \Seen)
fetchmail: IMAP< * OK [PERMANENTFLAGS (\Seen \Deleted)] Permanent flags
fetchmail: IMAP< * 8 RECENT
fetchmail: IMAP< * OK [UNSEEN 33] First unseen
fetchmail: IMAP< A0003 OK [READ-WRITE] SELECT completed
fetchmail: 70 messages waiting after first poll
fetchmail: IMAP> A0004 SEARCH UNSEEN
fetchmail: IMAP< A0004 NO Command 'SEARCH' not supported
fetchmail: 70 messages (70 seen) for <user> at <host>.
fetchmail: IMAP> A0005 FETCH 1:70 RFC822.SIZE
fetchmail: IMAP< * 1 FETCH (RFC822.SIZE 1361)
fetchmail: IMAP< * 2 FETCH (RFC822.SIZE 4489)
...
fetchmail: IMAP< * 69 FETCH (RFC822.SIZE 1121)
fetchmail: IMAP< * 70 FETCH (RFC822.SIZE 21568)
fetchmail: IMAP< A0005 OK FETCH command completed
fetchmail: skipping message 1 (1361 octets) not flushed
fetchmail: skipping message 2 (4489 octets) not flushed
...
fetchmail: skipping message 69 (1121 octets) not flushed
fetchmail: skipping message 70 (21568 octets) not flushed
fetchmail: IMAP> A0006 LOGOUT
fetchmail: IMAP< * BYE IMAP4rev1 Server logging out
fetchmail: IMAP< A0006 OK LOGOUT completed
fetchmail: not swapping UID lists, no UIDs seen this query
fetchmail: Query status=1 (NOMAIL)
fetchmail: Deleting fetchids file.
fetchmail: fetchmail: sleeping at Fri, 25 May 2001 11:52:00 -0400 (EDT)
fetchmail: awakened by User defined signal 1
fetchmail: 5.8.4 querying <user> (protocol IMAP) at Fri, 25 May 2001 11:55:33
-0400 (EDT)
fetchmail: IMAP< * OK imap-r01 v21_r5.2 server ready
fetchmail: IMAP> A0001 CAPABILITY
fetchmail: IMAP< * CAPABILITY IMAP4rev1 LITERAL+ XAOL-ENVELOPE XAOL-NETMAIL
XAOL-OPTION XAOL-NOFLAGS XAOL-NOFOLDER
fetchmail: IMAP< A0001 OK CAPABILITY completed
fetchmail: Protocol identified as IMAP4 rev 1
fetchmail: IMAP> A0002 LOGIN "<user>" "*"
fetchmail: IMAP< A0002 OK LOGIN completed
fetchmail: selecting or re-polling default folder
fetchmail: IMAP> A0003 SELECT "INBOX"
fetchmail: IMAP< * 71 EXISTS
fetchmail: IMAP< * OK [UIDVALIDITY 1] UID validity status
fetchmail: IMAP< * OK [UIDNEXT 1843254] predicted next UID
fetchmail: IMAP< * FLAGS (\Deleted \Seen)
fetchmail: IMAP< * OK [PERMANENTFLAGS (\Seen \Deleted)] Permanent flags
fetchmail: IMAP< * 9 RECENT
fetchmail: IMAP< * OK [UNSEEN 33] First unseen
fetchmail: IMAP< A0003 OK [READ-WRITE] SELECT completed
fetchmail: 71 messages waiting after first poll
fetchmail: IMAP> A0004 SEARCH UNSEEN
fetchmail: IMAP< A0004 NO Command 'SEARCH' not supported
fetchmail: 71 messages (71 seen) for <user> at <host>.
fetchmail: IMAP> A0005 FETCH 1:71 RFC822.SIZE
fetchmail: IMAP< * 1 FETCH (RFC822.SIZE 1361)
fetchmail: IMAP< * 2 FETCH (RFC822.SIZE 4489)
...
fetchmail: IMAP< * 69 FETCH (RFC822.SIZE 1121)
fetchmail: IMAP< * 70 FETCH (RFC822.SIZE 21568)
fetchmail: IMAP< * 71 FETCH (RFC822.SIZE 957)
fetchmail: IMAP< A0005 OK FETCH command completed
fetchmail: skipping message 1 (1361 octets) not flushed
fetchmail: skipping message 2 (4489 octets) not flushed
...
fetchmail: skipping message 69 (1121 octets) not flushed
fetchmail: skipping message 70 (21568 octets) not flushed
fetchmail: skipping message 71 (957 octets) not flushed
fetchmail: IMAP> A0006 LOGOUT
fetchmail: IMAP< * BYE IMAP4rev1 Server logging out
fetchmail: IMAP< A0006 OK LOGOUT completed
fetchmail: not swapping UID lists, no UIDs seen this query
fetchmail: Query status=1 (NOMAIL)
fetchmail: Deleting fetchids file.
fetchmail: fetchmail: sleeping at Fri, 25 May 2001 11:55:34 -0400 (EDT)
As I look at the verbose output, it seems the "SEARCH" command (or lack
there of) may be the source of the problem. Did fetchmail start using the
SEARCH command in versions > 5.2.7?
The IMAP server is a proprietary server, so it's quite possible it doesn't
support all the IMAP commands. If this is something the IMAP server is
doing incorrectly, I can pass on the appropriate information to the
developer, but I suspect it will be quite some time before changes can be
made. Is there some way to get the 5.2.7 behavior without downgrading to
5.2.7?