fetchmail-friends
[Top] [All Lists]

[fetchmail]how to conditionally leave mail on IMAP server?

2001-11-06 14:39:17
I read the man page, the FAQ, and skimmed some archive messages but didn't
see an answer.

Some time ago, our department moved all our unix mail onto a MS Exchange
server.  Some of us used fetchmail over IMAP to continue using our
favourite unix MUAs.  I had set "fetchall" and "nokeep" in .fetchmailrc so
my server mailbox is always empty.

Recently, our department also moved all our calendaring to the Exch server.
This complicates things:

A calendar item created in Outlook triggers a mail to all invited people.
If this mail is fetched into a unix mailbox and deleted from the server, it
loses the Acccept/Decline/Tentative reply functionality in Outlook and
prevents me from adding it to Outlook's calendar.

I tried putting such mail back on the server, but this also breaks the
A/D/T.

Suppose I configure .fetchmailrc to keep mail on the server.  This will let
me manually accept or decline a meeting because I would then use Outlook to
view these mails.  However, all non-meeting mail also remains on the server
which would require me to occasionally clean up my server mailbox to stay
under quota.

What about a conditional nokeep?  I noticed all meeting mail contains
"*~*~*~" in its body.  Can I configure fetchmail to do:

while ( new mail exists ) {
        fetch the mail

        if ( body contains "*~*~*~" ) {
                keep this mail on server
        }
}

This way, I'm still notified if someone invited me to a meeting but only
meeting mail stays on the server.

Alternatively, from fetchmail's manpage:
    (Keyword: mda) You can force mail to be passed to an MDA directly
    (rather than forwarded to port 25) with the -mda or -m option. To
    avoid losing mail, use this option only with MDAs like procmail or
    sendmail that return a nonzero status on disk-full and other
    resource-exhaustion errors; the nonzero status tells fetchmail that
    delivery failed and prevents the message from being deleted off the
    server.

So if I can force procmail to return nonzero, it should leave the mail on
the server.  I'm having trouble figuring out the syntax to do this in
procmail (man procmail, procmailex, procmailrc isn't helping).  In
.procmailrc:

:0 B
* \*\~\*\~.*
{
        EXITCODE=1
        $MAILDIR/test_exitcode
}

I'm expecting this to deliver and return the specified exitcode, but all
such mail still goes to my default mailbox.

--+-_-++_+--+--/>:<:/\/-+-_-++_--++-+-_--_++--+_--++-+-_++--_++--
Undocumented opcode #596:
MPLP  Make Pretty Light Pattern
mailto : dcn @ sector0 .net  |  http :// sector0 .net / dcn/
Repeal the Digital Millennium Copyright Act!  http://anti-dmca.org
Adobe got Sklyarov in, won't help get him out! http://freesklyarov.org



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