qpsmtpd Wiki

[[plugins:spam:denybounce]]

You are here: start » plugins » spam » denybounce

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

You don't have an account yet? Just get one: Register

Forgotten your password? Get a new one: Set new password

Plug-in Summary

Plug-in name: denybounce
Info: Deny bounces for some addresses
Author: tyskjohan
Email: Won't say
Compatibility: all
Download: here

denybounce

This plugin will deny bounces to addresses. Good for addresses that receive mail but never send mail.

sub hook_mail {
  my ($self, $transaction, $sender) = @_;

  return (DECLINED) unless ($sender->format eq "<>");

  $self->log(LOGDEBUG, "sender is <>");
  $transaction->notes('bounce',1);

  return (DECLINED);
}

sub hook_rcpt {
  my ($self, $transaction, $rcpt) = @_;
  my $note = $transaction->notes('bounce');
  return DECLINED unless $note;
  
  my @acceptbounce = $self->qp->config("acceptbounce");
  return DECLINED unless (@acceptbounce);

  my $user = lc($rcpt->user);
  my $addr = $user . '@' . lc($rcpt->host);

  foreach my $to (@acceptbounce) {
        chomp $to;
        return DECLINED if ($user eq $to);
        return DECLINED if ($addr eq $to);
  }
  $self->log(LOGDEBUG, "not accepting bounces for $addr");
  return (DENY, "sorry, $user never sends mail ".
                "and therefore does not accept bounces");
}

Configuration

The acceptbounce file contains mail addresses (fully qualified or local part only) that do accept bounces.