diff options
author | Guilhem Moulin <guilhem.moulin@ens-lyon.org> | 2011-10-26 20:30:16 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem.moulin@ens-lyon.org> | 2011-10-26 20:30:16 +0200 |
commit | 2ac97a96ec1207e83e7c2277440acdac30608985 (patch) | |
tree | 552af3bc51f2a5250360427f0dd1802538762fda | |
parent | 77fe969e15710e29f4e08dacdf7a4a7aa7f193a6 (diff) |
bug; undrafts
-rwxr-xr-x | imapurge.pl | 15 |
1 files 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<imapurge.pl> =head1 DESCRIPTION -B<IMAPurge> cleans up your accounts from old seen and unflagged emails. It -connects on the IMAP servers via SSL on port 993. +B<IMAPurge> 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<only>. The default behavior is to explore all the folders on the server. By setting the field I<oldest>, 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" |