Subject: | Issue - Mail::SPF - Parentheses in comments/text et. al. |
Date: | Wed, 24 Aug 2011 15:33:01 -0700 (PDT) |
To: | bug-Mail-SPF [...] rt.cpan.org |
From: | d.stussy [...] yahoo.com |
Typical usage (example - Sendmail virtual hosting and MimeDefang):
my $spfserver = Mail::SPF::Server->new(max_void_dns_lookups => undef,
hostname => $SendmailMacros{'if_name'} );
my $spfrequest = Mail::SPF::Request->new(versions=>[1], scope=>'mfrom',
identity => $id, ip_address => $ip, helo_identity => $helo);
my $r = $spfserver->process($spfrequest);
my $result = $r->code;
my $local = $r->local_explanation;
my $label = ($sender eq "<>") ? 'helo' : 'mailfrom';
...
action_insert_header('Authentication-Results',$SendmailMacros{'if_name'}.
"; SPF=$result smtp.$label=$1 ($local)", 1) if ...;
Result inserted into message (RFC 5451 format):
Authentication-Results: example.com; SPF=pass smtp.mailfrom=example.net (example.net: 2001:db8::dead:beef:cafe is authorized to use 'sysop@example.net' in 'mfrom' identity (mechanism 'mx' matched))
$r->local_explanation returns a text string that is meant to be used as a comment for the result.
However, SMTP messages (STD 10: RFC 5321 and 5322) do not allow nested comments. Parentheses may not appear in comments. The problem is that "local_explanation" returns parentheses in its string, so when the string is turned into a comment, it causes nested comments in violation of Internet mail standards.
Please, would "local_explanation" be rewritten so that no result returned contains parentheses? It would also be cleaner not to have the domain queried about repeated in the explanation at the beginning of the string, as it is redundant when quoting the mailbox tested.
Since I'm using the RFC 5451 format for reporting the results, not RFC 4408's original format of "Received-SPF:" headers, the returned variable received_spf_header has not been checked for similar problems. I leave that to the author/maintainer to determine.