http://www.perlmonks.org?node_id=688090


in reply to Mirror/Copy Mozilla thunderbird emails to IMAP server

The only thing that was wrong after uploading the mails with this script was, that all mails were 'marked as unread' (i.e. no 'Seen' flag was set). After looking into the Mail::IMAPClient documentation, I figured out how to change the script, so that all mails are 'marked as read' on the server. I think that's what most people need...

Here is the patch (just add '\Seen' as the third argument to the append_string() call):

--- original.pl 2008-05-23 14:10:40.000000000 +0800 +++ mark_as_read.pl 2008-05-23 14:11:51.000000000 +0800 @@ -63,7 +63,7 @@ $folder_name =~ s/^\.//; $imap->create($folder_name) or warn "unable to create $fo +lder_name: $@\n"; - unless($imap->append_string($folder_n +ame, $msg)) { + unless($imap->append_string($folder_n +ame, $msg, '\Seen')) { warn "Couldn't append " . $ms +g->header->{subject} . " to $folder_name: $@\n"; warn "Skipping\n"; next;