Re: [SLUG] Procmail FAQs

From: Ian C. Blenke (icblenke@nks.net)
Date: Tue Jul 17 2001 - 20:28:10 EDT


On Tue, Jul 17, 2001 at 06:47:32PM -0400, Derek Glidden wrote:

> In the meanwhile, and my main sticking point at the moment, does anyone
> know of a way to make procmail copy an incoming message (based on a
> regex match) to another folder, then "tag" that message as "deleted"
> without actually deleting it from the inbox?

Tagging as "deleted" is an internal construct within your email
reader. Once the reader closes, it will delete those "deleted"
messages.

Marking them as "already read" makes sense.

> My problem is that I like everything to live in my INBOX until I can
> read it, but to also get filed appropriately without my manual
> intervention. I have Netscape configured to copy mail into the
> appropriate folders, but only tag the messages as "deletable" until I
> manually delete them from the INBOX. If stuff automagically moves from
> folder to folder without sticking around in the inbox, I'll have to keep
> my eyes on about 25 or 30 different folders to see if new mail comes in,
> which I think will be more work than just moving stuff out of inbox by
> hand.

At the end of your recipe, merely add a "c" for copy. This will carry
the message along until it falls through the bottom of the procmail
ruleset and into your Inbox. ie:

        :0 c
        * ^.*slug@nks.net
        slug

or, if you want to copy it to one box and save another copy in
another:

        :0
        * ^.*slug@nks.net
        {
                :0 c
                slug

                :0
                redundantslug
        }

I use this quite a bit.

If you want to tag it as read as well, I think you need to run it
through formail (mbox reformatter):

        :0
        * ^.*slug@nks.net
        {
                :0 cw
                | formail -A "Status: RO"

                :0
                slug
        }

The "Status:" header is what marks the state of a message. The value
should be "O" for new mail, and "RO" for already read mail.

As for deleted messages, I think you might be looking at an "X-Status:"
header line. The generally accepted values are "F" for flagged (important),
and "A" for answered messages... but it depends on your mailer.

Realistically, you only see "deleted" emails until you close your
session and delete them. But, again, I think it depends on your MTA.

Note: throughout all of the examples above, I didn't use the "h"
keyword for headers only... I want my patterns to find slug@nks.net
ANYWHERE in the email. You probably will want to change things a bit
in your recipies.

And, yes. Procmail recipies can be a pain.

 - Ian C. Blenke <icblenke@nks.net>

PS. As always, someone please correct me if I've said anything wrong.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:12:37 EDT