I have a plugin that has the following lines:

my $header_from = $pms->get('From', 0);
dbg("ZS_HeadersCompare: $functname($rulename): header_from = $header_from")

I am looking to get the entire "From" field, which should be pretty straightforward. I am running this on an email with the following "from":

From: "jerome.o.sim...@gmail.com" <jerome.o.sim...@gmail.com>

When I run it on machine A (Ubuntu 12.04, SpamAssassin version 3.4.1, Perl version 5.14.2), the outcome is as expected:

ocoutu@hostA:~$ spamassassin -D 2>&1 < bug.eml | grep "header_from ="
déc  6 09:47:25.873 [25961] dbg: ZS_HeadersCompare: get_header_from(__Z_SAME_FROM_TRIM_DOM): 
header_from = "jerome.o.sim...@gmail.com" <jerome.o.sim...@gmail.com>
déc  6 09:47:25.883 [25961] dbg: ZS_HeadersCompare: get_header_from(__Z_SAME_FROM_SLD): 
header_from = "jerome.o.sim...@gmail.com" <jerome.o.sim...@gmail.com>
déc  6 09:47:25.884 [25961] dbg: ZS_HeadersCompare: 
get_header_from(__Z_REPLY_TO_IS_FROM_TRIM_DOM): header_from = 
"jerome.o.sim...@gmail.com" <jerome.o.sim...@gmail.com>
[...]

However, if I run that on machine B (Ubuntu 16.04, SpamAssassin version 3.4.1, Perl version 5.22.1) that I have recently created, after the first call to the /get//('From', 0)/ which returns the correct value, the following calls return the values with an added underscore between the from_name and the from_address:

ocoutu@hostB:~$ spamassassin -D 2>&1 < bug.eml | grep "header_from ="
déc  6 09:45:28.331 [13600] dbg: ZS_HeadersCompare: get_header_from(__Z_SAME_FROM_TRIM_DOM): 
header_from = "jerome.o.sim...@gmail.com" <jerome.o.sim...@gmail.com>
déc  6 09:45:28.332 [13600] dbg: ZS_HeadersCompare: get_header_from(__Z_SAME_FROM_SLD): 
header_from = "jerome.o.sim...@gmail.com"_<jerome.o.sim...@gmail.com>
déc  6 09:45:28.334 [13600] dbg: ZS_HeadersCompare: 
get_header_from(__Z_REPLY_TO_IS_FROM_TRIM_DOM): header_from = 
"jerome.o.sim...@gmail.com"_<jerome.o.sim...@gmail.com>
[...]

This can also be illustrated with the /__FROM_RUNION/ rule, which I have not modified in any way:

déc  6 10:59:36.149 [24034] dbg: rules: ran header rule __FROM_RUNON ======> got hit: 
""jerome.o.sim...@gmail.com"_<jerome"

Since this rule is called by the built-in config files with /From =~ /\S+<\w+//, it appears like the problem is not just with the way I am calling it.

I have a similar piece of code that uses /$pms->get('To', 0)/ and has the same issue.

The bug appears whether the domain is a freemailer or not, but does not happen when there is no from_name.

I am looking for tips as to where the problem might be. Is it possible that my /get/ or other calls are modifying the PerMsgStatus? Could it be related to patches that have been applied with the Ubuntu install?

--
Olivier Coutu
n...@zerospam.ca

Reply via email to