Patrick Nagel
2008-Jun-03 16:33 UTC
[Dovecot] How to set MDNSent flag on a large amount of mails?
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 (>10000 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
Timo Sirainen
2008-Jun-03 16:37 UTC
[Dovecot] How to set MDNSent flag on a large amount of mails?
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 (>10000 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20080603/50619172/attachment-0002.bin>
Patrick Nagel
2008-Jun-03 17:17 UTC
[Dovecot] How to set MDNSent flag on a large amount of mails?
Hi, On Tue, 03 Jun 2008 19:37:50 +0300, Timo Sirainen <tss at iki.fi> 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 $MDNSentThanks, 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