Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-MIME CPAN distribution.

Report information
The Basics
Id: 78280
Status: resolved
Priority: 0/
Queue: Email-MIME

People
Owner: Nobody in particular
Requestors: chadd [...] fidelissys.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: MIME-Q / _header_to_list interaction produces broken headers
Some of my email is being rejected by SES (AWS Simple Email Service) with an error of "Domain contains whitespace or control." It turns out that some mail is ultimately being submitted with headers like "From: Really Long Name\n\x20<source@example.\x20com>", which results from this series of events: 1. Call Email::MIME->create with From => '...' containing no newlines or spaces within the angle brackets. 2. The creation process builds up a text header, using MIME-Q encoding, which for certain lengths of From value, triggers a fold inside the addr-spec. 3. This text header is passed into Email::Simple::Header->new which parses it, but unfolds by removing only "\n", leaving the space in the domain. 4. Later, when I call as_string() and the final header is constructed, the address is split at an earlier point, and the leftover space stays in the domain to confuse Amazon SES. I believe SES is technically in the wrong here, but I'd prefer Email::* to avoid generating obsolete (RFC 2822 section 4.4) output. I think fixing issue #62913 would also fix this problem as a side effect. The specific length of From value I'm seeing this problem with is 78 US-ASCII characters (78 bytes) which exceeds the bytes-per-line value by less than the length of the addr-spec. $Email::MIME::VERSION eq '1.910', $Email::Simple::VERSION eq '2.101'. Test case: use Email::MIME; $m = Email::MIME->create(header_str => [ From => join(' ', qw(Initech Global Services Marketplace Group IntelliSpam <gsmgi-spam@example.com> ))]); print $m->as_string;
From: chadd [...] fidelissys.com
Forgot: Perls 5.10.0 and 5.10.1 (the latter from Amazon Linux on EC2) using their core Encode module. $Encode::VERSION eq '2.23' and '2.35' respectively.
I believe this is a real bug, due to foolish behavior by Encode. I hope to have some changes merged soon to address this viz https://github.com/rjbs/Email-MIME/pull/2 -- rjbs
In fact, this work was already merged some time ago; that the pull request remained open was a mistake. I think this should be fine now. -- rjbs