Thanks Mark and Benny! I will look into these solutions today.

-Ryan

-----Original Message-----

Indeed, the recipients of a message are passed from MTA to MTA in the
SMTP 'envelope' and not in the mail header section. The To and Cc
mail header fields may or may not bear any relationship with the
actual list of recipients of a message. This is especially so for spam mail
(and for mailing lists), so you need to collect these numbers from
where they are still available.

/etc/amavisd-custom.conf :

package Amavis::Custom;
use strict;
BEGIN { import Amavis::Util qw(do_log) }
sub new {
  my($class,$conn,$msginfo) = @_;
  my(@recip_objects) = @{$msginfo->per_recip_data};
  do_log(0, "Mail from %s, number of recipients is %d",
    $msginfo->sender, scalar(@recip_objects));
  # do whatever you want with this number here
  bless {}, $class;
}
1;  # insure a defined return


Put the following somewhere in amavisd.conf:

  include_config_files('/etc/amavisd-custom.conf');


Mark

Reply via email to