Terry,

> I have a small filter app that adds a message header containing the
> message size both in bytes and as a string of asterisks (available here:
> http://www.cnysupport.com/index.php/source-code/postfix-message-size-header
>-utility).
>
> It's a small C app that runs as a filter. It reads the message from
> stdin, prepends the above headers, then writes to stdout) Right now it
> runs as:
>
> filter unix  -       n       n     -     -   pipe
>         user=filter argv=/usr/bin/spamc -e /usr/sbin/ContentFilter -oi
> -f ${sender} ${recipient}
>
> since I'm feeding spamassassin directly, however I'd like to switch to
> amavisd-new, which will then call spamassassin and the AV scanners.
>
> Does anybody have any idea how I could get amavis to pass each message
> though the filter, regardless of whether or not it's spam or infected? I
> use it to hold/reject messages that exceed the size allowed by some
> downstream mail processing applications.

If all you need to do is to add two header fields based on mail size,
the simplest way is to call add_header() from a custom hook, e.g.:


somewhere in amavisd.conf add:

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


then in /etc/amavisd-custom.conf :


package Amavis::Custom;
use strict;

# invoked at child process creation time;
# return an object, or just undef when custom checks are not needed
sub new {
  my($class,$conn,$msginfo) = @_;
  my($self) = bless {}, $class;
  my($mail_size) = $msginfo->msg_size;   # mail size in bytes
  my($mail_size_mb) = $mail_size/(1024*1024);
  my($hdr_edits) = $msginfo->header_edits;
  $hdr_edits->add_header('X-ActualMessageSizeBytes', $mail_size);
  $hdr_edits->add_header('X-ActualMessageSize',
                         '*' x ($mail_size_mb > 50 ? 50 : $mail_size_mb));
  $self;  # returning an object activates further callbacks,
          # returning undef disables them
}
1;  # insure a defined return



  Mark

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 
 AMaViS-HowTos:http://www.amavis.org/howto/ 

Reply via email to