Ben Rosengart:
> On Thu, May 17, 2012 at 01:19:52PM -0400, Wietse Venema wrote:
> >
> > Adding headers is implemented in cleanup(8). Headers will never be
> > added when smtpd(8) is followed by a before-queue content filter.
> > Perhaps that is your problem?
>
> No, but I appreciate the process behind the guess.
>
> > Otherwise, can you provide a small Perl sample that reproduces
> > the problem?
I installed Sendmail::PMilter and it works out of the box (I used
TCP instead of UNIX-domain because I didn't want to mess with chroot
configuration).
Wietse
Script code:
#!/usr/bin/perl
use IO::Select;
use IO::File;
use Sendmail::PMilter ':all';
my $sock = "inet:9999";
my $milter = Sendmail::PMilter->new();
# Do this before dropping privs.
$milter->setconn($sock);
$milter->register('floodstopper', { eom => \&eom_callback, },
SMFIF_ADDHDRS);
$milter->set_dispatcher( Sendmail::PMilter::sequential_dispatcher() );
$milter->main();
sub eom_callback {
my $ctx = shift;
$ctx->addheader('X-MS-Floodstopper', 'hi!');
print "addheader 'X-MS-Floodstopper', 'hi!'\n";
return(SMFIS_CONTINUE);
}
Postconf configuration:
non_smtpd_milters = inet:127.0.0.1:9999
Commands 1:
$ perl *pl
addheader 'X-MS-Floodstopper', 'hi!'
Commands 2:
$ echo test|sendmail -f wietse@localhost wietse@localhost
Message in inbox, domain name censored:
From [email protected] Thu May 17 14:23:21 2012
Return-Path: <[email protected]>
X-Original-To: wietse@localhost
Delivered-To: [email protected]
Received: by laptop.example.com (Postfix, from userid 0)
id D8BF020D6C6B; Thu, 17 May 2012 14:23:20 -0400 (EDT)
Message-Id: <[email protected]>
Date: Thu, 17 May 2012 14:23:20 -0400 (EDT)
From: [email protected] (Wietse Venema)
X-MS-Floodstopper: hi!
test