diff options
Diffstat (limited to 'imapurge.pl')
| -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" | 
