in reply to finding unread emails in IMAP maildir
Sometimes, Email::Simple and friends are too simple. I strongly suggest you look at Mail::Box. It looks big and complicated because of the incredibly complex class heirarchy, but read the Mail::Box::Cookbook and experiment with it and you'll find it's not terribly hard to use. Once you get used to it (and there is a big learning curve) it's a swiss-army-chainsaw for mail processing.
Given your question, you probably want something like this (not tested):
my $manager = Mail::Box::Manager->new; my $folder = $manager->open( folder => $ENV{MAIL} ); foreach my $message ( $folder->messages ) { next if $message->label( 'seen' ); my $bounce = $message->bounce( To => 'you@somewhere.com' ); $bounce->send; $message->label( 'seen' => 1 ); } $folder->close;
Look at Mail::Message for other things you can do with a message (reply, forward, etc.) There's also very good online documentation with links for a mailing list that is very responsive to questions.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: finding unread emails in IMAP maildir
by chrisj0 (Acolyte) on Aug 08, 2005 at 20:54 UTC | |
by xdg (Monsignor) on Aug 08, 2005 at 21:48 UTC | |
by chrisj0 (Acolyte) on Aug 08, 2005 at 23:21 UTC |