That could be something like that script (test and adapt). I'm just a beginer with Mail::IMAPTalk and I don't use correctly search method<br>The trick will be to find the from and subject and/or the date..<br><br>Dom<br>
<br>#!/usr/bin/perl<br>use Mail::IMAPTalk;<br><br>$IMAP = Mail::IMAPTalk->new(<br> Server => 'localhost',<br> Username => 'cyrus',<br> Password => 'xxx',<br>
Uid => 1 )<br> || die "Failed to connect/login to IMAP server";<br><br>#<a href="http://linuxfr.org/forums/27/21722.html">http://linuxfr.org/forums/27/21722.html</a><br>$IMAP->set_root_folder('inbox', '/', 1, 'user');<br>
@folder=$IMAP->list("user.%",'*');<br>foreach $bals (@folder){<br>$tot=0;<br>$msgnb=0;<br> foreach $bal (@$bals){<br> if ($bal=~/user\//){<br> #$IMAP->examine($_);<br> #$count=$IMAP->message_count($_);<br>
$IMAP->select($bal) || warn "cant access $bal: $@";<br> $ResSearch = $IMAP->search('1:*', 'FROM', 'xxx'); # find the good search to do<br> $Res = $IMAP->fetch($Res, '(rfc822.size envelope)') || die "cant access $bal: $@";<br>
foreach $id (keys %$Res){<br> $size=$Res->{$id}->{'rfc822.size'};<br> $subject=$Res->{$id}->{'envelope'}->{'Subject'};<br> print "id=$id size=$size sub=$subject\n";<br>
}<br> $IMAP->store($ResSearch, '+flags', '(\\deleted)');<br> $lasterr=$IMAP->get_last_error();<br> if (defined $lasterr){<br> next if ($lasterr=~/No fetch data/);<br>
warn " $bal: $@";<br> next;<br> }<br> }<br> }<br>}<br>$IMAP->logout();<br><br><br><div class="gmail_quote">2009/5/11 Gerald Nowitzky <span dir="ltr"><<a href="mailto:whl@igne.de">whl@igne.de</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello!<br>
<br>
I have been confronted with a request today: We are running cyrus as imap<br>
server. We have currently about 3 million files and 150GB in our mail dir.<br>
One user has accidently sent something confidential to all users via a list.<br>
The request was, of course, to delete the mail from all mailboxes. Is there<br>
any reasonable approach to do something like this?<br>
<br>
Thanks!<br>
(Gerald)<br>
<br>
----<br>
Cyrus Home Page: <a href="http://cyrusimap.web.cmu.edu/" target="_blank">http://cyrusimap.web.cmu.edu/</a><br>
Cyrus Wiki/FAQ: <a href="http://cyrusimap.web.cmu.edu/twiki" target="_blank">http://cyrusimap.web.cmu.edu/twiki</a><br>
List Archives/Info: <a href="http://asg.web.cmu.edu/cyrus/mailing-list.html" target="_blank">http://asg.web.cmu.edu/cyrus/mailing-list.html</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Dominique LALOT<br>Ingénieur Systèmes et Réseaux<br><a href="http://annuaire.univmed.fr/showuser.php?uid=lalot">http://annuaire.univmed.fr/showuser.php?uid=lalot</a><br>