> On Mar 14, 2024, at 12:57 PM, Dianne Skoll <[email protected]> wrote: > > On Thu, 14 Mar 2024 11:58:59 -0600 > Philip Prindeville <[email protected]> wrote: > >> Thanks for that. So is there an easy way to snapshot the message >> in-the-raw as the final version before it gets sent out? > > MIMEDefang, no. Mailmunge, yes, with: > > $ctx->mime_entity->stringify() > > as the last thing in filter_wrapup. > >> Also, action_add_header() doesn't say if, in the case of a multiline >> value, should the lines be split with \n or \r\n? > > \n. There's another bug that was fixed in Mailmunge; don't know if it > was fixed in MIMEDefang. > > https://git.skoll.ca/Skollsoft-Public/mailmunge/commit/fc9d099a863725eac9ac6285416bc5cfd9c90471 > > Regards, > > Dianne.
Looking at: https://github.com/The-McGrail-Foundation/MIMEDefang/blob/master/modules/lib/Mail/MIMEDefang.pm#L735 Yeah, this probably doesn't handle things as well as it might. It look like it takes multiple values because of the @_ to map, but if you look at how it's called: https://github.com/The-McGrail-Foundation/MIMEDefang/blob/master/modules/lib/Mail/MIMEDefang/Actions.pm#L243-L244 Then $value is always going to be a scalar. I also see from: https://github.com/The-McGrail-Foundation/MIMEDefang/blob/master/mimedefang.pl.in#L1362 That the header value shouldn't a trailing newline, or that might confuse the Milter... but in fact that Mail::DKIM::Signer->as_string() does indeed embed \r\n between the continuation lines and add a trailing one as well. This seems to be what has been biting me. I've amended my code to: my ($header, $signature) = split(/:\s+/i, $dkim->signature()->as_string(), 2); $signature =~ s/\r\n/\n/g; chomp $signature; action_add_header($header, $signature); instead and we'll see how that works. I tried to follow the thread of where Mail::DKIM::Signer->as_string() actually did the work: https://metacpan.org/dist/Mail-DKIM/source/lib/Mail/DKIM/KeyValueList.pm#L136 Since Mail::DKIM::Signer->signature() returns a Mail::DKIM::Signature object, and that's based on a Mail::DKIM::KeyValueList object. And then the trail of {tags}->{raw} went cold. _______________________________________________ NOTE: If there is a disclaimer or other legal boilerplate in the above message, it is NULL AND VOID. You may ignore it. MIMEDefang mailing list [email protected] https://lists.mimedefang.org/mailman/listinfo/mimedefang_lists.mimedefang.org
