Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5286116
  • 博文数量: 1144
  • 博客积分: 11974
  • 博客等级: 上将
  • 技术积分: 12312
  • 用 户 组: 普通用户
  • 注册时间: 2005-04-13 20:06
文章存档

2017年(2)

2016年(14)

2015年(10)

2014年(28)

2013年(23)

2012年(29)

2011年(53)

2010年(86)

2009年(83)

2008年(43)

2007年(153)

2006年(575)

2005年(45)

分类: 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";
		}
	}
}
阅读(547) | 评论(0) | 转发(0) |
0

上一篇:perlpop.pl

下一篇:sgal.pl

给主人留下些什么吧!~~