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||'');