[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:

* ^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:

     I made a copy of the file for comparison purposes:

cp  1124819342.26693_1.straw:2, ~/unread- 

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

FILENAME:                        MESSAGE-ID:

     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- 

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  

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

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

which returned this:


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:

*^Sender: procmail-bounces(_at_)lists\(_dot_)RWTH-Aachen\(_dot_)DE

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!


procmail mailing list   Procmail homepage: