From 2ac97a96ec1207e83e7c2277440acdac30608985 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 26 Oct 2011 20:30:16 +0200 Subject: bug; undrafts --- imapurge.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/imapurge.pl b/imapurge.pl index 7beb0c1..1ea7768 100755 --- a/imapurge.pl +++ b/imapurge.pl @@ -25,8 +25,8 @@ B =head1 DESCRIPTION -B cleans up your accounts from old seen and unflagged emails. It -connects on the IMAP servers via SSL on port 993. +B cleans up your accounts from old seen and unflagged emails +that are not drafts. It connects on the IMAP servers via SSL on port 993. =head1 CONFIGURATION @@ -58,9 +58,9 @@ ignore all the others), you can fill in the field I. The default behavior is to explore all the folders on the server. By setting the field I, you can also define a time limit (in -days) for each account; Seen and unflagged emails that have been sent -before the given value (for the server's time!) will be deleted. Default -value: 90. +days) for each account; Seen and unflagged emails that are not drafts +and have been sent before the given value (for the server's time!) will +be deleted. Default value: 90. =head1 AUTHOR @@ -134,13 +134,14 @@ sub prune { # Explore the folder if ($client->select($folder)) { - # Search the mails + # Search for the mail UIDs I'm gonna delete my @msgs = $client->search( \( 'SENTBEFORE', $maxdate + , 'UNDRAFT' , 'UNFLAGGED' , 'SEEN' ) ); if (@msgs) { - $count += $#msgs; + $count += $#msgs+1; my $del = $client->delete_message(\@msgs) or die "Can't delete messages: $@\n"; warn " Folder `$folder': only $del/$#msgs messages have been deleted.\n" -- cgit v1.2.3