fetchmail-friends
[Top] [All Lists]

Re: [fetchmail] How to delete mail exceeding a certain size?

2002-12-12 12:55:24
Some of the list members probably remember my question about how fetchmail 
can be configured to delete mail exceeding a certain size without 
retrieving them from the mail server. I suspected that the "limit" option 
might be involved somehow, and Jakob Hirsch suggested adding the "flush" 
option. Before experimenting with this, I read the manual page entries for 
both options, and found the following description:

    flush  -F  Flush all seen messages before querying

I thus believed that "flush" would not help me. But as I tried to add code 
for the feature I wanted, and while discussing means to accomplish it with 
Jakob, we both focused on the following lines (driver.c, V6.1.3, starting 
at line 686):

    else if (ctl->server.base_protocol->delete
        && !suppress_delete
        && ((msgcodes[num-1] >= 0) ? !ctl->keep : ctl->flush))
    {
        /* code to delete the current message */
    }

If I read this correctly, the message will be deleted if the message code 
signals "no errors" (>= 0) and "keep" is FALSE. This would probably be the 
case for standard processing. The message will also be deleted if the 
message code is MSGLEN_INVALID, MSGLEN_TOOLARGE or MSGLEN_OLD (< 0) and if 
"flush" is TRUE. This means that combining "limit NNN" and "flush" will 
actually delete messages exceeding the given size limit, i.e. using a 
configuration similar to these lines:

    poll mail.server.org proto pop3
        user "johndoe" password "secret"
        limit 15000 flush

As far as I can see, this is not documented. It might thus not be 
considered a feature, but more of a side effect (no offense meant). Maybe 
Eric can comment this? Personally, I like this behaviour and find it 
useful, but I think it should be pointed out in the fetchmail docs, 
especially because the removal of messages is a sensitive matter.

Comments are welcome.


Mit freundlichen Grüßen / Regards

Dipl. Inform. Ralph Seichter
mailto:ralph(_at_)seichter(_dot_)de

<Prev in Thread] Current Thread [Next in Thread>