Problem with amavis-ng and "From: <>"

2003-03-25
2003-03-25
  • I use amavis-ng with SMTP mode.
    When a message comes with a "MAIL FROM: <>" (empty mail address) the sender is set to "<<>>".
    This is due to the Net::SMTP::_addr function.
    After the scan is over, when resending mail to MTA, this address is passed again to Net::SMTP::_addr function  (in Net::SMTP::mail) and is returned as "<<>". This is an invalid address so the MTA reject it and amavis-ng put the message in the problem directory.
    I solve that by modifying AMAVIS/MTA/SMTP.pm like this:
    @@ -618,7 +618,7 @@
       }

       $$args{'sender'} = $from;
    -  $$args{'sender'} = "<>" if (!$$args{'sender'});
    +  $$args{'sender'} = "<>" if (!$$args{'sender'} || $$args{'sender'} =~ /<+>+/);
       push @{$$args{'recipients'}}, @to;
       return 1;
    }

    This is probably an horrible hack.
    Tell me what you think about that.

    Jrme

    PS: my version of libnet-perl is 1.09.01 (Debian Woody)