fetchmail-friends
[Top] [All Lists]

Re: [fetchmail]Preventing fetchmail from marking message read with pop3

2004-04-25 23:00:05
Donald Thompson wrote:
On Sun, 25 Apr 2004, Rob Funk wrote:
Donald Thompson wrote:
Is it possible to have fetchmail not mark a retrieved message as
being 'read'?

OK, at the low levels, the server will mark a message as read when a client
gets it with the RETR command (shown in your -vvv log).  Under certain
circumstances, fetchmail will use the TOP command instead in order to avoid
the message being marked as read.  (After looking at the code comments....)
This is done as a reliability precaution, so that if the connection dies
between retrieving the message and sending it wherever it needs to go, the
message will still be marked as unseen.

Heres the fetchmailrc:
poll 10.9.1.21 protocol pop3 username XXXX password XXXXX smtpname
dlt(_at_)wherever(_dot_)com keep set logfile /home/dlt/fetchmail.log

OK, you're not using fetchall but you are using keep. When using keep,
fetchmail uses RETR instead of TOP, so that fetchmail doesn't keep getting
the same "unseen" messages over and over.
(If anyone cares, all this is documented in the comments above line 1101 of
pop3.c, at least in version 6.2.5.)

For your purposes, you seem to want fetchmail to get new messages, but not
let them be marked as seen, even though that means fetchmail will get them
again next time around.  The only way I know of to do that is by changing
the code:

--- pop3.c.orig 2003-10-15 15:22:31.000000000 -0400
+++ pop3.c      2004-04-26 01:54:51.000000000 -0400
@@ -1083,6 +1083,8 @@
      * However...*don't* do this if we're using keep to suppress deletion!
      * In that case, marking the seen flag is the only way to prevent the
      * message from being re-fetched on subsequent runs.
+     * XXX Actually in this version we'll go ahead and use TOP with keep,
+     * XXX allowing the message to be re-fetched later.
      *
      * Also use RETR if fetchall is on.  This gives us a workaround
      * for servers like usa.net's that bungle TOP.  It's pretty
@@ -1098,7 +1100,7 @@
      * The line count passed (99999999) is the maximum value CompuServe will
      * accept; it's much lower than the natural value 2147483646 (the maximum
      * twos-complement signed 32-bit integer minus 1) */
-    if (ctl->keep || ctl->fetchall)
+    if (ctl->fetchall)
        gen_send(sock, "RETR %d", number);
     else
        gen_send(sock, "TOP %d 99999999", number);


-- 
==============================| "A slice of life isn't the whole cake
 Rob Funk <rfunk(_at_)funknet(_dot_)net> | One tooth will never make a full 
grin"
 http://www.funknet.net/rfunk |    -- Chris Mars, "Stuck in Rewind"