Re: Marking a message read when delivering to a Maildir

Milan Obuch <[email protected]>
Newsgroups gmane.mail.maildrop
Message-ID <[email protected]>
On Tue, 26 Mar 2013 00:24:17 -0700
Doug Barton <[email protected]> wrote:

> Howdy,
> 
> I have searched the web and cobbled together a process to deliver a 
> message to my Junk folder (Maildir), then immediately mark it read. 
> However, I've run into a small problem, the filter runs faster than
> the actual delivery, so I have to spin waiting for the file to
> appear. My filter is below.
> 
> I'm wondering, is there an easier/better way to do this in the first 
> place? Is it ever contemplated to add this as a feature?
> 
> Thanks,
> 
> Doug
> 
> if (/^X-Spam-Status: Yes/:h)
> {
>          cc Maildir/.Junk
>          `until [ -f ${HOME}/Maildir/.Junk/cur/1*:2, ]; do sleep 0.1;
> done` `for m in ${HOME}/Maildir/.Junk/cur/1*:2,; do mv $m ${m}S; done`
>          exit
> }
>

Hi,

look at thread beginning at Thu, 5 May 2011 titled 'Adding flags during
filtering'. A discussion about small patch enabling adding flags (your
'S' is one of them) in maildrop process directly is here. This patch is
even added as experimental in FreeBSD courier port, so if you were
using it, it just needs to be enabled in config. I do not know about
standalone maildrop port, but I think it could be added easily.

With this patch, your filtering snippet would be

if (/^X-Spam-Status: Yes/:h)
{MFLAGS=S
 to Maildir/.Junk
}

I am using it with F flag for marking some mail as important for some
years already with no known side effect or problem.

Your delay may be caused by other reason - I think mail is delivered
into new directory and moved into cur directory after some mail agent
sees it. I did not bother with this, simple patch mentioned in that
mail thread was just enough for me. See that thread for some more
discussion.

Regards,
Milan

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.