全部博文(1144)
分类: LINUX
2009-12-09 12:01:34
#!/usr/local/bin/perl
# dont people who send you read receipts annoy the heck out of you?
# let's annoy them.
use Net::SMTP;
while(<>){
last if(/^$/); # only want header
if(/^Disposition-Notification-To\s?:\s?.*[^a-z0-9_\.\+\-\=]+(([a-z0-9_\.\+\-\=])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,4}))+/i){
# regex not quite rfc 822, but, eh..
$email = $1;
}elsif(/^subject\s?:\s?(.+)/i){
$subject = $1;
}elsif(/^List-/i || /^Mailing-List/i){
$list = 1;
}elsif((!/^\s/) && ((/^[^:\s]*\s/) || (!/:/))){
exit; # must be out of header
}
last if(defined($email) && defined($subject) && defined($list));
}
if(defined($email) && defined($list)){
warn "sending annoyance notice to ${email}\n";
my $times = 11;
if($email eq 'winan888@cbn.net.id'){
$times = 31;
} #because he just doesnt seem to care about 11 ;)
for($n ; $n < $times ; $n++){
my $smtp = Net::SMTP->new('localhost');
if(defined($smtp)){
chomp(my $date=`date`);
$smtp->mail("");
$smtp->recipient($email);
$smtp->data();
$smtp->datasend("Date: ${date}\n");
$smtp->datasend("Precedence: bulk\n");
$smtp->datasend("Disposition-Notification-To: ${email}\n");
$smtp->datasend("From: Annoyed User <${email}>\n");
$smtp->datasend("To: ${email}\n");
$smtp->datasend("Subject: Re: ${subject}\n\n");
$smtp->datasend("You asked for a Read Receipt on a public mailing list.\n");
$smtp->datasend("This behavior is highly rude; I insist you desist.\n");
$smtp->datasend("See how annoying that is?\n");
$smtp->dataend();
}else{
die "could not connect to smtp server on localhost\n";
}
}
}