procmail
[Top] [All Lists]

RE: set status of mails in maildirs?

2007-08-02 09:02:01
LuKreme ("Kreemy") wrote on 1 August 2007:


On 30-Jul-2007, at 11:55, N.J. Mann wrote:
  { TRAP='mv $LASTFOLDER ${LASTFOLDER}:2,F' }


Sorry, I just have no idea what that is supposed to do.  I 
don't even know where to begin.

Well, gee, Kreemy.  We discussed it a couple or three years
ago when you were on the list.

LASTFOLDER knows where in the maildir hierarchy the file was
saved and what its name is.  Maildir uses that :2,F thing
on the end to mark messages read.  Voila.

OK, first off, wouldn't this TRAP need to be enclosed in backticks  
instead of single quotes? Second off, what's it do?

No.  See "man procmailex" for at least three examples of TRAP.
Here's one of them:

       If you are using temporary files in a procmailrc file,
       and want to make sure that they are removed just before
       procmail exits, you could use something along the lines
       of:

              TEMPORARY=$HOME/tmp/pmail.$$
              TRAP="/bin/rm -f $TEMPORARY"

See "man procmailrc" for how TRAP works.

Basically, when procmail is exiting, it runs whatever TRAP
was set to, in the shell.  (Set SHELL = /bin/sh, is my advice.)

If we move the message that procmail just wrote to the maildir folder
and left in a state such that the MUA will see the message as "New,"
then renaming that file as N.J. Mann showed would let most MUAs
show the mail as "Read" instead.

Oh, and ignore that mess that Michelle posted with all sorts of
unnecessary pipes to sed, formail, etc.  I can't even bring
myself to answer that directly, as it raises my blood pressure
too much. :-)

-- 
dman
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail