1#!/usr/local/bin/perl 2#$Id$ 3 4use Mail::IMAPClient; 5use IO::File; 6 7# Change the following line (or replace it with something better): 8my($h,$u,$p) = ('cyrus_host','cyrus_admin_id','cyrus_admin_pswd'); 9 10my $imap = Mail::IMAPClient->new( Server => "$h", # imap host 11 User => "$u", # $u, 12 Password=> "$p", # $p, 13 Uid => 1, # True value 14 Port => 143, # Cyrus 15 Debug => 0, # True value 16 Buffer => 4096*10, # True value 17 Fast_io => 1, # True value 18 Timeout => 30, # True value 19 # Debug_fh=> IO::File->new(">out.db"), # fhandle 20 ) 21or die "$@"; 22 23for my $f ( $imap->folders ) { 24 print "Expunging $f\n"; 25 unless ($imap->select($f) ) { 26 $imap->setacl($f,$u,"lrswipcda") or warn "Cannot setacl for $f: $@\n" and next; 27 $imap->select($f) or warn "Cannot select $f: $@" and next; 28 } 29 $imap->expunge; 30} 31 32 33=head1 AUTHOR 34 35David J. Kernen 36 37The Kernen Group, Inc. 38 39imap@kernengroup.com 40 41=head1 COPYRIGHT 42 43This example and Mail::IMAPClient are Copyright (c) 2003 44by The Kernen Group, Inc. All rights reserved. 45 46This example is distributed with Mail::IMAPClient and 47subject to the same licensing requirements as Mail::IMAPClient. 48 49imtest is a utility distributed with Cyrus IMAP server, 50Copyright (c) 1994-2000 Carnegie Mellon University. 51All rights reserved. 52 53=cut 54 55# 56#$Log: cyrus_expunge.pl,v $ 57#Revision 19991216.3 2003/06/12 21:38:31 dkernen 58# 59#Preparing 2.2.8 60#Added Files: COPYRIGHT 61#Modified Files: Parse.grammar 62#Added Files: Makefile.old 63# Makefile.PL Todo sample.perldb 64# BodyStructure.pm 65# Parse.grammar Parse.pod 66# range.t 67# Thread.grammar 68# draft-crispin-imapv-17.txt rfc1731.txt rfc2060.txt rfc2062.txt 69# rfc2221.txt rfc2359.txt rfc2683.txt 70# 71#Revision 1.1 2003/06/12 21:38:14 dkernen 72# 73#Preparing 2.2.8 74#Added Files: COPYRIGHT 75#Modified Files: Parse.grammar 76#Added Files: Makefile.old 77# Makefile.PL Todo sample.perldb 78# BodyStructure.pm 79# Parse.grammar Parse.pod 80# range.t 81# Thread.grammar 82# draft-crispin-imapv-17.txt rfc1731.txt rfc2060.txt rfc2062.txt 83# rfc2221.txt rfc2359.txt rfc2683.txt 84# 85# 86