[Dovecot] How to set MDNSent flag on a large amount of mails?

2008-06-03 Thread Patrick Nagel
Hi,

after having moved a big mail archive to IMAP, I've now got the following
problem: The MUA asks to send an MDN on all those old messages that contain
the 'Disposition-Notification-To' header when opened. I'd like to set the
$MDNSent flag on those (1 in a deeply nested directory structure)
mails.

After having read http://wiki.dovecot.org/MailboxFormat/Maildir I wrote a
script that changed the filename of mails in all directories that contained
the header, so that the filename contained a 'b' in the last part of the
filename (after the comma), because I found '1 $MDNSent' in
Maildir/dovecot-keywords. I then discovered that there can be a
'dovecot-keywords' file in each directory, and all of those files can have
different flags in different order.

Do I really need to write a script that evaluates each dovecot-keywords
file, figures out which letter corresponds to the flag and rename the files
(per directory) accordingly? Isn't there a more simple way?

Patrick.

-- 
STAR Software (Shanghai) Co., Ltd.http://www.star-group.net/
Phone:+86 (21) 3462 7688 x 826 Fax:   +86 (21) 3462 7779

PGP key: https://stshacom1.star-china.net/keys/patrick_nagel.asc
Fingerprint:   E09A D65E 855F B334 E5C3 5386 EF23 20FC E883 A005



Re: [Dovecot] How to set MDNSent flag on a large amount of mails?

2008-06-03 Thread Timo Sirainen
On Wed, 2008-06-04 at 00:33 +0800, Patrick Nagel wrote:
 after having moved a big mail archive to IMAP, I've now got the following
 problem: The MUA asks to send an MDN on all those old messages that contain
 the 'Disposition-Notification-To' header when opened. I'd like to set the
 $MDNSent flag on those (1 in a deeply nested directory structure)
 mails.
..
 Do I really need to write a script that evaluates each dovecot-keywords
 file, figures out which letter corresponds to the flag and rename the files
 (per directory) accordingly? Isn't there a more simple way?

How about making your script use IMAP protocol?

1 list  *
2 select each mailbox
3 uid search header Disposition-Notification-To 
4 uid store search result as msgset +flags $MDNSent



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] How to set MDNSent flag on a large amount of mails?

2008-06-03 Thread Patrick Nagel
Hi,

On Tue, 03 Jun 2008 19:37:50 +0300, Timo Sirainen [EMAIL PROTECTED] wrote:
 How about making your script use IMAP protocol?
 
 1 list  *
 2 select each mailbox
 3 uid search header Disposition-Notification-To 
 4 uid store search result as msgset +flags $MDNSent

Thanks, Timo! Never thought of that :)

I'll give it a try tomorrow... netcat would be the bridge between my shell
and dovecot then, I guess?

Patrick.

-- 
STAR Software (Shanghai) Co., Ltd.http://www.star-group.net/
Phone:+86 (21) 3462 7688 x 826 Fax:   +86 (21) 3462 7779

PGP key: https://stshacom1.star-china.net/keys/patrick_nagel.asc
Fingerprint:   E09A D65E 855F B334 E5C3 5386 EF23 20FC E883 A005



Re: [Dovecot] How to set MDNSent flag on a large amount of mails?

2008-06-03 Thread Johannes Berg
On Wed, 2008-06-04 at 01:17 +0800, Patrick Nagel wrote:
 Hi,
 
 On Tue, 03 Jun 2008 19:37:50 +0300, Timo Sirainen [EMAIL PROTECTED] wrote:
  How about making your script use IMAP protocol?
  
  1 list  *
  2 select each mailbox
  3 uid search header Disposition-Notification-To 
  4 uid store search result as msgset +flags $MDNSent
 
 Thanks, Timo! Never thought of that :)
 
 I'll give it a try tomorrow... netcat would be the bridge between my shell
 and dovecot then, I guess?

That'll work, I tend to use python because it comes with error checking,
you can use http://johannes.sipsolutions.net/files/cleanspam.txt and
modify.

johannes


signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] How to set MDNSent flag on a large amount of mails?

2008-06-03 Thread Patrick Nagel
Hi,

On Tue, 03 Jun 2008 19:20:43 +0200, Johannes Berg
[EMAIL PROTECTED] wrote:
 On Wed, 2008-06-04 at 01:17 +0800, Patrick Nagel wrote:
 I'll give it a try tomorrow... netcat would be the bridge between my
shell
 and dovecot then, I guess?
 
 That'll work, I tend to use python because it comes with error checking,
 you can use http://johannes.sipsolutions.net/files/cleanspam.txt and
 modify.

Thanks, Johannes :) My python skills are very limited, but your example
script looks straight forward, and the 'difficult' part isn't even needed
for my task, so I'll give it a try.

Patrick.

-- 
STAR Software (Shanghai) Co., Ltd.http://www.star-group.net/
Phone:+86 (21) 3462 7688 x 826 Fax:   +86 (21) 3462 7779

PGP key: https://stshacom1.star-china.net/keys/patrick_nagel.asc
Fingerprint:   E09A D65E 855F B334 E5C3 5386 EF23 20FC E883 A005



Re: [Dovecot] How to set MDNSent flag on a large amount of mails?

2008-06-03 Thread Kenneth Porter
--On Wednesday, June 04, 2008 1:17 AM +0800 Patrick Nagel 
[EMAIL PROTECTED] wrote:



I'll give it a try tomorrow... netcat would be the bridge between my shell
and dovecot then, I guess?


Another possibility would be to use the c-client library, part of the 
uw-imap package:


http://www.washington.edu/imap/