null sender in releasing email from sql quarantine

Tom Johnson tj at
Fri Jan 22 20:29:56 CET 2016

We're using a sql quarantine. 

We'd like to release emails from the quarantine and have the SMTP envelope MAIL FROM reflect the original sender.

So we set  mailfrom_to_quarantine to undef.

But, since the email is quarantined without a Return-Path or X-Envelope-From header.

Postfix doesn't add those - because it's handling the email only via a relay to amavisd-new.

Amavisd-new doesn't add them - the check for whether to add the X-Envelope-From header looks like this:

    my $mftq = c('mailfrom_to_quarantine');
    if (!defined $mftq || $quar_m_protocol =~ /^(?:bsmtp|sql)\z/) {
      # we keep the original envelope sender address if replacement sender
      # is not provided, or with quarantine methods which store to fixed
      # locations which do not depend on envelope
      $quar_msg->sender($msginfo->sender);  # original sender
      $orig_env_sender_retained = 1;
    if (!$orig_env_sender_retained) { # unless X-Envelope-* would be redundant
      $hdr_edits->prepend_header('X-Envelope-From', $msginfo->sender_smtp);

And when you use amavisd-release to release a message, it's checked only for those two headers for the sender.

So it's always sent from a null sender.  The releasing code only checks the headers of the message for an Return-Path or X-Envelope-From header.  It doesn't even default to using mailfrom_to_quarantine, so setting that doesn't do any good either.

This looks like a bug to me.  Or am I missing something?


More information about the amavis-users mailing list