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: 24858
Status: resolved
Priority: 0/
Queue: Email-MIME

People
Owner: Nobody in particular
Requestors: banb [...] yahoo.co.jp
Cc: WURBLZAP [...] cpan.org
AdminCc:

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



Subject: cannot parse multipart message with Email::Simple 1.998
Dear, maintainer With Email::MIME-1.857 and Email::Simple-1.998 combination, multipart messages are misparsed, so 2.t and nested-parts.t fail. Two reasons: 1) Email::MIME splits multipart message with extra CRLF. In sub parts_multipart(), message body is splited as follows: my @bits = split /^--\Q$boundary\E\s*$/sm, ($body||''); But, regex/sm's $ doesn't contain CRLF in tail, so for example: "abc\n\n--boundary\ndef\n\n--boundary\nghi" will be splited into: "abc\n\n", "\ndef\n\n", "\nghi" 2) Since Email::Simple 1.997, CRLF prefixed message header is ignored. This module changed drastically. With content "\nContent-Type: text/plain\n\nmessage body\n", the module prior to 1.996 handles header as 'Content-Type: text/plain', but with version 1.997 header is recognized as empty. I do not have an idea which module should owe the responsibility. Replacing the above code with following code makes tests success. my @bits = split /^--\Q$boundary\E\s*$(?:\r?\n?)/sm, ($body||'');
From: WURBLZAP [...] cpan.org
At least the second part appears to me to be fixed in Email::MIME 1.861 or Email::Simple 2.003: Show quoted text
> 2) Since Email::Simple 1.997, CRLF prefixed message header is ignored. > > This module changed drastically. > With content "\nContent-Type: text/plain\n\nmessage body\n", > the module prior to 1.996 handles header as 'Content-Type: text/plain', > but with version 1.997 header is recognized as empty.
The attached test script failed for me with earlier versions around Email::Simple 1.997, but succeeds now.
#!/usr/bin/perl -w use strict; use Test::More tests => 8; use Email::MIME::Modifier; my $plain_mail = <<EOT From: bugzilla-daemon\@localhost To: wurblzap\@example.net Subject: [bz-head] Doubles MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----------6052--1183018980-----" Date: Thu, 28 Jun 2007 10:23:00 +0200 ------------6052--1183018980----- Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Double B=C3=BCgs ------------6052--1183018980----- Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head><title>[bz-head] Doubles</title></head> <body><p align=3D"left">Double B=C3=BCgs</p></body> </html> ------------6052--1183018980------- EOT ; my $mail = new Email::MIME($plain_mail); ok(defined($mail), 'EMail::Mime defined'); $mail->walk_parts(sub { my ($part) = @_; ok(defined($part), 'Mail part defined'); return if $part->parts > 1; # Top-level my $content_type = $part->content_type; ok(defined($content_type), 'content_type defined'); SKIP: { skip('content_type not defined', 1) unless defined($content_type); ok($content_type eq 'text/plain; charset="UTF-8"' || $content_type eq 'text/html; charset="UTF-8"', 'content_type validity'); } });
I believe this has been resolved for a while now. -- rjbs