Amavis Whitelist IPs

I had issues where amavisd was flagging legitimate email as spam, even though it was coming from a trusted network (logs showed that the email was flagged because it was missing some headers, used an IP instead of a domain for the sender, etc.).
It was email sent as notification from a RAID device to let us know if an error was detected - a somewhat important message!

I wanted to know how to whitelist an entire IP range/network. We have several devices on the network that may need to send email.

I finally found some working information. All I had to do was add two parts to the /etc/amavis/conf.d/50-user file:


# list of local IPs:
@mynetworks = qw( 127.0.0.0/8 192.168.1.0/24 );

# allow all mail from local IPs:
$policy_bank{'MYNETS'} = {  # clients in @mynetworks
  bypass_spam_checks_maps   => [1],  # don't spam-check internal mail
  bypass_banned_checks_maps => [1],  # don't banned-check internal mail
  bypass_header_checks_maps => [1],  # don't header-check internal mail
};

I ran service amavis restart, and I could send email again.