diff options
Diffstat (limited to 'expireIMAP.pl')
-rw-r--r-- | expireIMAP.pl | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/expireIMAP.pl b/expireIMAP.pl deleted file mode 100644 index 5f00651..0000000 --- a/expireIMAP.pl +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use Mail::IMAPClient; -use Data::Dumper; -use DateTime; - -my $hostname = "localhost"; -my $login = "matej"; -my $passwd = "lubdkc"; - -die "Just one name of the folder, please." unless $#ARGV == 0; - -# How many months before today the cut date should be? -my $howManyMonths = 3; -my $lengthOfScreen = 65; - -my $imap = Mail::IMAPClient->new(); -$imap = Mail::IMAPClient->new( - Server => $hostname, - User => $login, - Password => $passwd, - UID => 1 -) or die "Cannot connect to localhost as matej: $@"; - -my $cutDate = DateTime->now(); -$cutDate->add( months => -$howManyMonths ); - -# Do the stuff! -$imap->select($ARGV[0]); -my @msgsProc = $imap->search(" UNDELETED BEFORE " . $cutDate->strftime("%d-%b-%Y")); -print "\$#msgsProc = $#msgsProc\n"; -$imap->delete_message(@msgsProc) or die "Cannot delete $#msgsProc messages."; -$imap->close();
\ No newline at end of file |