qpsmtpd Wiki


You are here: start » plugins » spam » denybounce


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


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

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

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 <>");

  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");


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