[Mimedefang] stream_by_recipient() and Postfix
Philip Prindeville
philipp_subx at redfish-solutions.com
Thu Sep 13 01:15:52 EDT 2012
On 9/12/12 9:17 PM, Philip Prindeville wrote:
> [snip] Then it worked.
> Not thrilled about having 2 Received: lines, but what can you do; I could tweak resend_message_specifying_mode() to not add the synthesized header...
Well, it nearly worked.
I should add that even doing:
sub filter {
...
if (lc($type) eq "application/xyzzy") {
if (@Recipients > 1) {
$sawXyzzyAttachment++;
} else {
my $uri = $root_entity->get('X-Xyzzy-URI');
chomp($uri);
my $link = Xyzzy::Link->new($uri, $Recipients[0]);
my $text = $entity->bodyhandle()->as_string();
my $pkg = Xyzzy::Package->parse($text);
md_graphdefang_log('application/xyzzy');
my $sender = $Sender;
# defocus
if (substr($sender, 0, 1) eq '<' && substr($sender, -1) eq '>') {
$sender = substr($sender, 1, -1);
}
# generate an note with a URL and explaining who sent the attachment,
# what the filename was, what its mime-type was, and its size.
return action_replace_with_indirect($link->as_string(), $sender, $pkg->name(), $pkg->type(), $pkg->size());
}
...
}
sub filter_end {
...
# if we saw attachments, and there was more than one recipient,
# then we need to split the message into individual deliveries
# so we can rewrite each one-off.
if ($sawXyzzyAttachment && stream_by_recipient()) {
md_syslog('info', "contained xyzzy attachments; resubmitting");
return action_discard();
}
...
this still caused double submission of the email. Once of the unmodified message as a delivery to multiple recipients, and the 2nd delivery individually (at which time it got rewritten as part of the 2nd pass).
This latter detail surprised me, because of:
sub stream_by_recipient() {
...
$TerminateAndDiscard = 1;
return 1;
}
Why did I need to have an action_discard() to stop the double-delivery right after the stream_by_recipient()?
You'd think that stream_by_recipient() would take care of the original (if there were multiple recipients originally).
What am I missing?
-Philip
More information about the MIMEDefang
mailing list