procmail
[Top] [All Lists]

Re: set status of mails in maildirs?

2007-07-31 10:27:46
Am 2007-07-30 18:51:30, schrieb N.J. Mann:
I use the following to set the "flagged" flag:

:0
* my-regexp-here
{ TRAP='mv $LASTFOLDER ${LASTFOLDER}:2,F' }
:0
my-maildir-mail-box/

It works like a charm.  To mark the mail as READ rather than "flagged"
the filename extension should be R rather than F, i.e.

{ TRAP='mv $LASTFOLDER ${LASTFOLDER}:2,R' }

but I haven't tested this.

It should be:

----8<----------------------------------------------------------
:0
* my-regexp-here
{ 
  :0fw
  |formail -I Status: RO

  TRAP='mv $LASTFOLDER ${LASTFOLDER}:2,S'

  :0
  my-maildir-mail-box/
}
----8<----------------------------------------------------------

and since he use Maildir-Format, ${LASTFOLDER} should be

----8<----------------------------------------------------------------
:0
* my-regexp-here
{ 
  :0fw
  |formail -I Status: RO

  TRAP='mv $LASTFOLDER `echo ${LASTFOLDER} |sed 's|/new/|/cur/|'`:2,S'

  :0
  my-maildir-mail-box/
}
----8<----------------------------------------------------------------

And if you do not want o be bothered by mutt using courier-imap, you
must put

    `echo ${LASTFOLDER} |sed 's|/new/|/cur/|'`:2,S'

also in ${FOLDER}/courierimapuiddb which has the format:

1 ${UNIX_SERIALDATE} ${N+3}
N+1 ${filename},S=xxxx
N+2 ${filename},S=xxxx

which mean, you have to update

  1.  The ${UNIX_SERIALDATE} using `date +%s`
  2.  Adding the new filename with size as N+3
  3.  increasing the number ${N+3} to ${N+4}
  4.  touching the FOLDER with the same time of the ${INIX_SERIALDATE}

and now, courier-imap will never know, that you have fooled it...  :-)
Since it is a little bit more complex, I would it pack into a SHELL
script and call it with

  TRAP='fool_courier ${LASTFOLDER}'

Greetings
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSN LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)
____________________________________________________________
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

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