Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Phred (5358)

Phred
  fredNO@SPAMtaperfriendlymusic.org
http://www.redhotpenguin.com/

Fred is a Perl and PostgreSQL geek. He has made some very small contributions to a few cpan modules and mod_perl.

Journal of Phred (5358)

Friday October 20, 2006
11:18 AM

More adventures in Qpsmtpd.pm

[ #31366 ]

So I've been getting mail forwarded to me from a previous job, the people there were kind enough to do that for me so that I could receive emails from an article I wrote at perl.com. This allowed me to give them some props while still responding to emails about the article.

Now the problem here has been that the volume of spam I get through that link has gotten out of control. I get about 100 spams from when I go to sleep and when I wake up.

So I wrote a short qpsmtpd plugin to take care of this problem.

sub hook_data_post {
  my ( $self, $transaction ) = @_;
  my $recipient = $transaction->header->get('To');
  chomp($recipient);
  my $addr = 'fmoyer@xxxxxxx.com';
  if (lc($recipient) eq $addr) {
    $self->log(LOGINFO, "$domain BLOCKED");
    return (DENY, "New address is fred at redhotpenguin dot com");
  }
  return DECLINED;
}

This stops the spam, but allows anyone legitimate who gets the bounce message to be informed of my new address. I had to use the hook _data_post callback instead of hook_rcpt since the rcpt hook picks up the address the mail was forwarded to. Another problem solved :)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.