Skip Menu |

This queue is for tickets about the MailTools CPAN distribution.

Report information
The Basics
Id: 52084
Status: rejected
Priority: 0/
Queue: MailTools

People
Owner: Nobody in particular
Requestors: icestar [...] inbox.ru
Cc:
AdminCc:

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



Subject: Encoded header glued together in one string
Hello! It seems to me there is a bug in Mail::Header module. Suppose I want to add a new tag to the header with <add> method and the value of this tag is encoded, for example: To: =?utf-8?B?0KDQsNCx0L7RgtCwIDxkaW1hQGFkcml2ZXIucnU +LCBJY2VTdGFyIDxpY2VzdGFyQGluYm94LnJ1?= =?utf-8?B?Piwg0J/RgNC40YjQtdC70LXRhiA8YWxpZW4uY29zbW9zQGdtYWlsLmNvbT4=?= Here are two lines, the second line starts from =?utf-8?B? but sub _fold_line removes all new line symbols from the value and I get one string. Not all mail clients can parse such result. RFC 2047 says: While there is no limit to the length of a multiple-line header field, each line of a header field that contains one or more 'encoded-word's is limited to 76 characters. So, is this a limitation or bug?
Subject: Re: [rt.cpan.org #52084] Encoded header glued together in one string
Date: Thu, 26 Nov 2009 12:07:47 +0100
To: Dmitry Bigunyak via RT <bug-MailTools [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Dmitry Bigunyak via RT (bug-MailTools@rt.cpan.org) [091126 10:55]: Show quoted text
> Thu Nov 26 05:55:44 2009: Request 52084 was acted upon. > Transaction: Ticket created by Alien > Queue: MailTools > Subject: Encoded header glued together in one string > Broken in: 2.04
Show quoted text
> Suppose I want to add a new tag to the header with <add> method and the > value of this tag is encoded, for example: > To: =?utf-8?B?0KDQsNCx0L7RgtCwIDxkaW1hQGFkcml2ZXIucnU > +LCBJY2VTdGFyIDxpY2VzdGFyQGluYm94LnJ1?= > =?utf-8?B?Piwg0J/RgNC40YjQtdC70LXRhiA8YWxpZW4uY29zbW9zQGdtYWlsLmNvbT4=?= > > Here are two lines, the second line starts from =?utf-8?B? but sub > _fold_line removes all new line symbols from the value and I get one > string. Not all mail clients can parse such result.
First it removes the new-lines, then it breaks the line into separate parts again, based on some logic. What I see from your example, is that you lack leading blanks for the second and third line. You can either specify an unfolded (maybe very long) line, or a folded line. First the new-lines are removed, but when these other lines do not start with a blank, these are glued into on big word. #!/usr/bin/perl use warnings; use strict; use Mail::Header; my $h = Mail::Header->new; $h->add(To => '=?utf-8?B?0KDQsNCx0L7RgtCwIDxkaW1hQGFkcml2ZXIucnU +LCBJY2VTdGFyIDxpY2VzdGFyQGluYm94LnJ1?= =?utf-8?B?Piwg0J/RgNC40YjQtdC70LXRhiA8YWxpZW4uY29zbW9zQGdtYWlsLmNvbT4=?='); use Data::Dumper; warn Dumper $h; -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Now I see... The problem is in MIME::Entity module and MIME::Head which inherits from your Mail::Header, I'm using them on the top. In MIME::Entity module hardcoded $head->modify(1) in this case you call _fold_line $line, $maxlen if $modify && defined $maxlen; And I get the single-line :( Thanks a lot for your quick reply and sorry for the false alarm.
Subject: Re: [rt.cpan.org #52084] Encoded header glued together in one string
Date: Thu, 26 Nov 2009 13:13:01 +0100
To: Dmitry Bigunyak via RT <bug-MailTools [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Dmitry Bigunyak via RT (bug-MailTools@rt.cpan.org) [091126 12:06]: Show quoted text
> Queue: MailTools > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52084 > > > Now I see... The problem is in MIME::Entity module and MIME::Head which > inherits from your Mail::Header, I'm using them on the top. In > MIME::Entity module hardcoded $head->modify(1) in this case you call > > _fold_line $line, $maxlen if $modify && defined $maxlen; > And I get the single-line :(
If you start a new project, use Mail::Box. It far out-classes the ancient MailTools and MIMETools. -- MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Show quoted text
> > If you start a new project, use Mail::Box. It far out-classes the > ancient MailTools and MIMETools.
Thanks for suggestion, I'll examine it! :)