kevinsir / php-mime-mail-parser

Automatically exported from code.google.com/p/php-mime-mail-parser
0 stars 0 forks source link

rfc822 (eml) with attachments not correct #25

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Parse a mail with EML-Attachments which contain attachments (e.g. pdf's)
2. getAttachments() returns the EMLs and the attachments are in these.

What is the expected output? What do you see instead?
Not sure, but when I parse a mail i would like to display only the actual level 
(EML-Attachments). but here you become EMLs and their attachments at the same 
"level".

it were very useful to fix this

Original issue reported on code.google.com by kaista...@gmail.com on 31 Aug 2011 at 3:41

GoogleCodeExporter commented 8 years ago
I found that emails sent by outlook had a number of issues with some tags [they 
had an extra newline].
Once I ran the following on the entire email string, everythingthings worked as 
expected (multipart messages, attachments, usw)

  $data = preg_replace ('/;\s*$\s*(boundary|charset|filename|name)\s*=\s*"([^"]+)"/ims',';\1="\2"', $data);

[NOTE: this regex expects the values to be quoted]

For example,

Content-Type: multipart/alternative;
    boundary="----=_NextPart_000_001C_01CC9ED8.68F2D110"
...
Content-Type: text/plain;
    charset="us-ascii"

is changed to:

Content-Type: 
multipart/alternative;boundary="----=_NextPart_000_001C_01CC9ED8.68F2D110"
...
Content-Type: text/plain;charset="us-ascii"

John GIllespie

Original comment by psm...@gmail.com on 23 Nov 2011 at 7:27