#!/usr/bin/perl # name: blockedmail.cgi # version: 1.0.0 # author: David McNamara 2000 # email: me@mackers.com # web: http://www.mackers.com/scripts/blockedmail/ # change the following to the location of cgi-lib.pl on your system require "/home/mackers/cgi-lib.pl"; # and that's it. you shouldn't need to change anything else &ReadParse; print "Content-type: text/html\n\n\n\n"; if (($in{'USER'}) && (!$in{'logout'})) { print "
"; print ""; print ""; print ""; print ""; print "" if ($in{'showall'}); if ($in{'delete'}) { $pop = new Mail::POP3Client( USER => $in{'USER'} , PASSWORD => $in{'PASSWORD'} , HOST => $in{'HOST'} , AUTH_MODE => "PASS" , DEBUG => $in{'DEBUG'}); $delete = substr($in{'delete'},7); $pop->Delete($delete); $popstate = $pop->State(); $pop->Close(); } if ($in{'deleteall'}) { $pop = new Mail::POP3Client( USER => $in{'USER'} , PASSWORD => $in{'PASSWORD'} , HOST => $in{'HOST'} , AUTH_MODE => "PASS" , DEBUG => $in{'DEBUG'}); for( $i = 1; $i <= $pop->Count(); $i++ ) { $pop->Delete($i); } $popstate = $pop->State(); $pop->Close(); } use Mail::POP3Client; $pop = new Mail::POP3Client( USER => $in{'USER'} , PASSWORD => $in{'PASSWORD'} , HOST => $in{'HOST'} , AUTH_MODE => "PASS" , DEBUG => $in{'DEBUG'}); for( $i = 1; $i <= $pop->Count(); $i++ ) { $_ = $pop->List($i); ($no, $size) = split(/ /); $size[$no] = $size; foreach( $pop->Head( $i ) ) { $from[$no] = $_ if (/From/); $subject[$no] = $_ if (/Subject:/); #/^(From|Subject):\s+/i && print $_, "\n"; } } $popstate = $pop->State(); $pop->Close(); if (($popstate eq "TRANSACTION") && (@size)) { print "

Showing mailbox for ". $in{'USER'} . "@" . $in{'HOST'} . "

\n"; print "\n"; for ($i=1;$i<=(scalar @size)-1;$i++) { if ($size[$i] >= 600000) { print "\n"; $shownb++; } } for ($i=1;$i<=(scalar @size)-1;$i++) { if (($size[$i] > 100000) && ($size[$i] < 600000)) { print "\n"; $shownb++; } } for ($i=1;$i<=(scalar @size)-1;$i++) { if (($size[$i] <= 100000) && ($in{'showall'})) { print "\n"; $shown++; } } print "
$i
($size[$i])
$from[$i]
$subject[$i]
$i
($size[$i])
$from[$i]
$subject[$i]
$i
($size[$i])
$from[$i]
$subject[$i]

\n"; print "
There are no big messages in this mailbox.

\n" if (!$shownb); print "
Showing messages ". ($shown + $shownb) . " of ". ((scalar @size) -1) .".

\n"; print "
\n"; } elsif ($popstate ne "TRANSACTION") { print "
The password you supplied for ".$in{'USER'} ."@". $in{'HOST'} . " is invalid.

\n"; } elsif (!@size) { print "
The mailbox ".$in{'USER'} ."@". $in{'HOST'} . " is empty.

\n"; } print "
\n"; } else { print "
Blocked Mailbox Fixer
\n"; print "
Username:
Password:
Server:
"; } print "\n\n";