procmail
[Top] [All Lists]

not as easy as the FAQ - (was Re: IMAP filtering, how to mark my own messages read)

2005-08-23 13:22:06

On Aug 23, 2005, at 12:47 PM, Klaus Johannes Rusch wrote:

:0Wfh
* ^From: .*youraddress
| formail -I"Status: RO"

PS. This question has been asked many times before, and answers to  
this and other FAQs can be found in the procmail archives

Ah yes.  I had forgotten that I had tried that some time ago, and it  
did not work (which I absolutely should have mentioned, but, as I  
say, I had forgotten that part).

The header line is added, but it does not effect the (UN)READ status  
of the message.  I presume because of the IMAP method of sorting  
which sends the messages into several different folders.


To investigate further, I logged into the server via ssh and found an  
unread message:

FILENAME:                        MESSAGE-ID:
1124819342.26693_1.straw:2,       
b7e39189ab80927c2ef2f581a95a971d(_at_)appnel(_dot_)com

     I made a copy of the file for comparison purposes:

cp  1124819342.26693_1.straw:2, ~/unread- 
b7e39189ab80927c2ef2f581a95a971d(_at_)appnel(_dot_)com

     I then went and read the message in my mail program, and the  
FILENAME changed:

FILENAME:                        MESSAGE-ID:
1124819342.26693_1.straw:2,S     
b7e39189ab80927c2ef2f581a95a971d(_at_)appnel(_dot_)com

     OK, so the filename changed, did anything else?  I ran 'md5sum'  
on the new filename and compared it to the original:

034e634906bdb4ef5f9eb54b4b0acbb7  1124819342.26693_1.straw:2,S
034e634906bdb4ef5f9eb54b4b0acbb7  /home/tjlists/unread- 
b7e39189ab80927c2ef2f581a95a971d(_at_)appnel(_dot_)com

So the files are identical.  It's the fileNAME which changes.

It appears that sticking the "S" on the end is the key. So I ran this  
command:

     ls -1|grep -v ",S$"

(to show me all the files EXCEPT the ones that end in ",S")

which returned this:

1124120528.M698382P13078V000000000000000DI00565E4F_59.spork,S=4714:2,RS
1124818052.23308_1.straw:2,
1124818662.24791_1.straw:2,
1124819342.26669_1.straw:2,

There were 3 unread messages in that folder, which I presume are the  
last 3 of those 4 files.  The first one (the longest filename) is a  
message that I had replied to (I presume the extra information is  
used by Courier IMAP to connect it to the reply I sent).

To test *this* theory, I renamed all of the files (one at a time),  
simply adding an "S" at the end of the filename, and the messages  
were marked as read.


Now the question is: how do I use procmail to append an "S" onto an  
unknown filename?

As a reminder, the messages are filtered like this:

:0
*^Sender: procmail-bounces(_at_)lists\(_dot_)RWTH-Aachen\(_dot_)DE
$MAILDIR/.INBOX.Procmail/

which then automagically sorts the message.  I am not sure where the  
'new' and 'tmp' folders come into play, but I presume they are used  
during the delivery process, because I see this in the .procmail.log:

  From procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE  Tue Aug 23 
09:30:25 2005
   Subject: IMAP filtering, how to mark my own messages read
    Folder: /home/me/Maildir//.INBOX.Procmail/new/ 
1124814625.14754_     5342

Thanks for any pointers!

TjL


____________________________________________________________
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