Gary, > i borrowed from the docs + other threads on this list... is this the > most efficient way to add headers to emails originating from a > particular IP for whom we act as relayhost? > > 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($hdr_edits) = $msginfo->header_edits; > my($cl_ip) = $msginfo->client_addr; > if ($cl_ip eq 'xxx.xxx.xxx.xxx') { > $hdr_edits->add_header('X-Abuse', "foo bar foo bar."); > $hdr_edits->add_header('X-Abuse', "foo bar foo bar."); > } > $self; # returning an object activates further callbacks, > # returning undef disables them > } > 1; # insure a defined return
Yes, this is it. The cleanest and the most efficient, if you want it to be done by amavisd (vs. doing it by MTA). > ... should this always return $self or should i place that inside the > if and otherwise return undef? Doesn't really matter. A few extra calls to dummy routines cost nothing. I'd just return $self unconditionally, like you do now - covers the case if in the future you add some other hook. Mark ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ 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/