PHP Classes

Inline text attachments not parsed

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  Inline text attachments not parsed  >  (Un) Subscribe thread alerts  
Subject:Inline text attachments not parsed
Summary:text inline atts. base64 encoded are not extracted from body
Messages:9
Author:Sean
Date:2009-12-04 08:19:35
Update:2011-07-22 09:05:17
 

  1. Inline text attachments not parsed   Reply   Report abuse  
Picture of Sean Sean - 2009-12-04 08:19:35
Thanks for creating a wonderful mime parser!
I'm having a problem with plain text attachment as follows..

I created an email from Thunderbird.
subject: My subject
body: My Body
attachments: 1 plain text file

Expected result: to see attachment & it's content in the decoded array
Actual result: attachment is a base64 encoded inline attachment that is not extracted from message body or in any 'parts' arrays.

Below I provide:
1. message in .eml format
2. array of $decided & results when mbox = 0
3. array of $decided & results when mbox = 1

MESSAGE (EML):

From - Fri Dec 04 08:58:26 2009
X-Account-Key: account10
X-UIDL: UID78248-1207067163
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from xxxx.xxx (xxxx.xxx [xxx.xxx.xxx.xxx])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(No client certificate requested)
by xxxx.xxx (Postfix) with ESMTPS id 3EB5DCF40F
for <[email protected]>; Thu, 3 Dec 2009 23:58:18 -0800 (PST)
Received: (qmail 7872 invoked by uid 110); 4 Dec 2009 08:54:09 +0100
Date: 4 Dec 2009 08:54:09 +0100
Message-ID: <[email protected]>
From: [email protected]
To: [email protected]
Subject: email received
X-Antivirus: avast! (VPS 091203-1, 03/12/2009), Inbound message
X-Antivirus-Status: Clean

Received: (qmail 7867 invoked by uid 110); 4 Dec 2009 08:54:09 +0100
Delivered-To: [email protected]
Received: (qmail 7864 invoked from network); 4 Dec 2009 08:54:09 +0100
Received: from xxxx.xxxx.xxx (xxx.xxx.xxx.xxx)
by xxxx.xxxx.xxx with SMTP; 4 Dec 2009 08:54:09 +0100
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AvEAAG5OGEvZiEB+/2dsb2JhbAAIlBeFCrwghDIEgWc
Received: from xxxx.xxxx.xxx (HELO [127.0.0.1]) ([xxx.xxx.xxx.xxx])
by xxx.xxxx.xxx with ESMTP; 04 Dec 2009 08:58:16 +0100
Message-ID: <[email protected]>
Date: Fri, 04 Dec 2009 08:58:22 +0100
From: Sean Kelly <[email protected]>
Reply-To: [email protected]
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: [email protected]
Subject: My Test Subject
Content-Type: multipart/mixed;
boundary="------------040005020003090605020102"
X-Antivirus: avast! (VPS 091203-1, 03/12/2009), Outbound message
X-Antivirus-Status: Clean

This is a multi-part message in MIME format.
--------------040005020003090605020102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

My Test Body

--------------040005020003090605020102
Content-Type: text/plain;
name="example.txt"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="example.txt"

VGhpcyBpcyBteSB0ZXh0IGZpbGUgYXR0YWNobWVudCBwbGFpbiBjb250ZW50LiBJdCBzaG91
bGQgYmUgYmFzZTY0IGVuY29kZWQgYXQgc29tZSBwb2ludC4u
--------------040005020003090605020102--


**************************************
VAR DUMP WITH MBOX = 0:
**************************************

$mime->mbox = 0;
$mime->decode_bodies = 1;
$mime->ignore_syntax_errors = 1;
$mime->track_lines = 1;

'SkipBody'=>0

This is a var_dump of $decoded after
$mime->Decode($parameters, $decoded);

array(1) {
[0]=>
array(6) {
["HEADERS"]=>
array(17) {
["FROM "]=>
string(26) "- Fri Dec 04 08:58:26 2009"
["X-ACCOUNT-KEY:"]=>
string(9) "account10"
["X-UIDL:"]=>
string(19) "UID78248-1207067163"
["X-MOZILLA-STATUS:"]=>
string(4) "0001"
["X-MOZILLA-STATUS2:"]=>
string(8) "00000000"
["X-MOZILLA-KEYS:"]=>
string(0) ""
["RETURN-PATH:"]=>
string(15) "<[email protected]>"
["X-ORIGINAL-TO:"]=>
string(13) "[email protected]"
["DELIVERED-TO:"]=>
string(13) "[email protected]"
["RECEIVED:"]=>
array(2) {
[0]=>
string(239) "from xxxx.xxx (xxxx.xxx [xxx.xxx.xxx.xxx])(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))(No client certificate requested)by xxxx.xxx (Postfix) with ESMTPS id 3EB5DCF40Ffor <[email protected]>; Thu, 3 Dec 2009 23:58:18 -0800 (PST)"
[1]=>
string(58) "(qmail 7872 invoked by uid 110); 4 Dec 2009 08:54:09 +0100"
}
["DATE:"]=>
string(25) "4 Dec 2009 08:54:09 +0100"
["MESSAGE-ID:"]=>
string(36) "<[email protected]>"
["FROM:"]=>
string(13) "[email protected]"
["TO:"]=>
string(13) "[email protected]"
["SUBJECT:"]=>
string(14) "email received"
["X-ANTIVIRUS:"]=>
string(50) "avast! (VPS 091203-1, 03/12/2009), Inbound message"
["X-ANTIVIRUS-STATUS:"]=>
string(5) "Clean"
}
["PARTS"]=>
array(0) {
}
["BODY"]=>
string(1486) "Received: (qmail 7867 invoked by uid 110); 4 Dec 2009 08:54:09 +0100
Delivered-To: [email protected]
Received: (qmail 7864 invoked from network); 4 Dec 2009 08:54:09 +0100
Received: from xxxx.xxxx.xxx (xxx.xxx.xxx.xxx)
by xxxx.xxxx.xxx with SMTP; 4 Dec 2009 08:54:09 +0100
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AvEAAG5OGEvZiEB+/2dsb2JhbAAIlBeFCrwghDIEgWc
Received: from xxxx.xxxx.xxx (HELO [127.0.0.1]) ([xxx.xxx.xxx.xxx])
by xxx.xxxx.xxx with ESMTP; 04 Dec 2009 08:58:16 +0100
Message-ID: <[email protected]>
Date: Fri, 04 Dec 2009 08:58:22 +0100
From: Sean Kelly <[email protected]>
Reply-To: [email protected]
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: [email protected]
Subject: My Test Subject
Content-Type: multipart/mixed;
boundary="------------040005020003090605020102"
X-Antivirus: avast! (VPS 091203-1, 03/12/2009), Outbound message
X-Antivirus-Status: Clean

This is a multi-part message in MIME format.
--------------040005020003090605020102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

My Test Body

--------------040005020003090605020102
Content-Type: text/plain;
name="example.txt"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="example.txt"

VGhpcyBpcyBteSB0ZXh0IGZpbGUgYXR0YWNobWVudCBwbGFpbiBjb250ZW50LiBJdCBzaG91
bGQgYmUgYmFzZTY0IGVuY29kZWQgYXQgc29tZSBwb2ludC4u
--------------040005020003090605020102--


"
["BODYPART"]=>
int(1)
["BODYLENGTH"]=>
int(1486)
["EXTRACTEDADDRESSES"]=>
array(3) {
["RETURN-PATH:"]=>
array(1) {
[0]=>
array(1) {
["ADDRESS"]=>
string(13) "[email protected]"
}
}
["FROM:"]=>
array(1) {
[0]=>
array(1) {
["ADDRESS"]=>
string(13) "[email protected]"
}
}
["TO:"]=>
array(1) {
[0]=>
array(1) {
["ADDRESS"]=>
string(13) "[email protected]"
}
}
}
}
}

Then when I var_dump $results I get this (no attachment content):

array(2) {
["TYPE"]=>
string(4) "text"
["DESCRIPTION"]=>
string(12) "Text message"
}


**************************************
VAR DUMP WITH MBOX = 1:
**************************************

$mime->mbox = 1;
$mime->decode_bodies = 1;
$mime->ignore_syntax_errors = 1;
$mime->track_lines = 1;

'SkipBody'=>0

This is a var_dump of $decoded after
$mime->Decode($parameters, $decoded);

array(1) {
[0]=>
array(6) {
["HEADERS"]=>
array(17) {
["FROM "]=>
string(26) "- Fri Dec 04 08:58:26 2009"
["X-ACCOUNT-KEY:"]=>
string(9) "account10"
["X-UIDL:"]=>
string(19) "UID78248-1207067163"
["X-MOZILLA-STATUS:"]=>
string(4) "0001"
["X-MOZILLA-STATUS2:"]=>
string(8) "00000000"
["X-MOZILLA-KEYS:"]=>
string(0) ""
["RETURN-PATH:"]=>
string(15) "<[email protected]>"
["X-ORIGINAL-TO:"]=>
string(13) "[email protected]"
["DELIVERED-TO:"]=>
string(13) "[email protected]"
["RECEIVED:"]=>
array(2) {
[0]=>
string(239) "from xxxx.xxx (xxxx.xxx [xxx.xxx.xxx.xxx])(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))(No client certificate requested)by xxxx.xxx (Postfix) with ESMTPS id 3EB5DCF40Ffor <[email protected]>; Thu, 3 Dec 2009 23:58:18 -0800 (PST)"
[1]=>
string(58) "(qmail 7872 invoked by uid 110); 4 Dec 2009 08:54:09 +0100"
}
["DATE:"]=>
string(25) "4 Dec 2009 08:54:09 +0100"
["MESSAGE-ID:"]=>
string(36) "<[email protected]>"
["FROM:"]=>
string(13) "[email protected]"
["TO:"]=>
string(13) "[email protected]"
["SUBJECT:"]=>
string(14) "email received"
["X-ANTIVIRUS:"]=>
string(50) "avast! (VPS 091203-1, 03/12/2009), Inbound message"
["X-ANTIVIRUS-STATUS:"]=>
string(5) "Clean"
}
["PARTS"]=>
array(0) {
}
["BODY"]=>
string(1486) "Received: (qmail 7867 invoked by uid 110); 4 Dec 2009 08:54:09 +0100
Delivered-To: [email protected]
Received: (qmail 7864 invoked from network); 4 Dec 2009 08:54:09 +0100
Received: from xxxx.xxxx.xxx (xxx.xxx.xxx.xxx)
by xxxx.xxxx.xxx with SMTP; 4 Dec 2009 08:54:09 +0100
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AvEAAG5OGEvZiEB+/2dsb2JhbAAIlBeFCrwghDIEgWc
Received: from xxxx.xxxx.xxx (HELO [127.0.0.1]) ([xxx.xxx.xxx.xxx])
by xxx.xxxx.xxx with ESMTP; 04 Dec 2009 08:58:16 +0100
Message-ID: <[email protected]>
Date: Fri, 04 Dec 2009 08:58:22 +0100
From: Sean Kelly <[email protected]>
Reply-To: [email protected]
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: [email protected]
Subject: My Test Subject
Content-Type: multipart/mixed;
boundary="------------040005020003090605020102"
X-Antivirus: avast! (VPS 091203-1, 03/12/2009), Outbound message
X-Antivirus-Status: Clean

This is a multi-part message in MIME format.
--------------040005020003090605020102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

My Test Body

--------------040005020003090605020102
Content-Type: text/plain;
name="example.txt"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="example.txt"

VGhpcyBpcyBteSB0ZXh0IGZpbGUgYXR0YWNobWVudCBwbGFpbiBjb250ZW50LiBJdCBzaG91
bGQgYmUgYmFzZTY0IGVuY29kZWQgYXQgc29tZSBwb2ludC4u
--------------040005020003090605020102--


"
["BODYPART"]=>
int(1)
["BODYLENGTH"]=>
int(1486)
["EXTRACTEDADDRESSES"]=>
array(3) {
["RETURN-PATH:"]=>
array(1) {
[0]=>
array(1) {
["ADDRESS"]=>
string(13) "[email protected]"
}
}
["FROM:"]=>
array(1) {
[0]=>
array(1) {
["ADDRESS"]=>
string(13) "[email protected]"
}
}
["TO:"]=>
array(1) {
[0]=>
array(1) {
["ADDRESS"]=>
string(13) "[email protected]"
}
}
}
}
}

Then when I var_dump $results I get this (no attachment content):

array(2) {
["TYPE"]=>
string(4) "text"
["DESCRIPTION"]=>
string(12) "Text message"
}

  2. Re: Inline text attachments not parsed   Reply   Report abuse  
Picture of Sean Sean - 2009-12-04 08:54:03 - In reply to message 1 from Sean
Hey I found the solution...

The eml file I provided includes an extra set of unnecessary headers.
When I remove them this all works just fine.

I had my server email me the received message not thinking that the emailed message has it's own set of headers. d'oh!

Now the 'parts' array is working as expected..

["PARTS"]=>
array(2) {
[0]=>
array(5) {
["HEADERS"]=>
array(2) {
["CONTENT-TYPE:"]=>
string(45) "text/plain; charset=ISO-8859-1; format=flowed"
["CONTENT-TRANSFER-ENCODING:"]=>
string(4) "7bit"
}
["PARTS"]=>
array(0) {
}
["BODY"]=>
string(16) "My Test Body

"
["BODYPART"]=>
int(1)
["BODYLENGTH"]=>
int(16)
}
[1]=>
array(7) {
["HEADERS"]=>
array(3) {
["CONTENT-TYPE:"]=>
string(29) "text/plain;name="example.txt""
["CONTENT-TRANSFER-ENCODING:"]=>
string(6) "base64"
["CONTENT-DISPOSITION:"]=>
string(29) "inline;filename="example.txt""
}
["PARTS"]=>
array(0) {
}
["FILENAME"]=>
string(11) "example.txt"
["FILEDISPOSITION"]=>
string(6) "inline"
["BODY"]=>
string(90) "This is my text file attachment plain content. It should be base64 encoded at some point.."
["BODYPART"]=>
int(2)
["BODYLENGTH"]=>
int(90)
}
}

Again, thanks for this great parser, it's a bit tricky but it's the only one that can do what I need :)

Issue resolved.

  3. Re: Inline text attachments not parsed   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-12-04 13:35:24 - In reply to message 1 from Sean
This seems to be a message pasted inside another. After the X-Antivirus-Status: Clean header line there is an extra line break.

I don't know who inserted that line, but it makes the rest of the message be treated as part of the message body.

If this is a mbox message, the rest of the message should start with From header, which is not the case.

  4. Re: Inline text attachments not parsed   Reply   Report abuse  
Picture of M. Arifur Rahman M. Arifur Rahman - 2011-07-22 03:45:04 - In reply to message 3 from Manuel Lemos
Hi,
For the same configuration and similar email I am missing the content of my attachment.
Please note that I am receiving an email with an attachment which is in turn an email. I am entering the content of the email I am receiving :
~~~~~~~~~~~~~Email~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Return-path: <[email protected]>
Envelope-to: [email protected]
Delivery-date: Wed, 20 Jul 2011 17:55:53 -0400
Received: from bay0-omc4-s15.bay0.hotmail.com ([65.54.190.217])
by ets2057.easytosendmail.com with esmtp (Exim 4.69)
(envelope-from <[email protected]>)
id 1Qjek9-0005et-Ds
for [email protected]; Wed, 20 Jul 2011 17:55:53 -0400
Received: from BAY0-XMR-023.phx.gbl ([65.54.190.199]) by bay0-omc4-s15.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675);
Wed, 20 Jul 2011 14:55:47 -0700
Received: from mail pickup service by BAY0-XMR-023.phx.gbl with Microsoft SMTPSVC;
Wed, 20 Jul 2011 14:55:46 -0700
Date: Wed, 20 Jul 2011 14:55:46 -0700
From: [email protected]
Subject: complaint about message from 69.64.40.240
To: [email protected]
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="1BF3A9E0-13F5-41C9-8EC0-3FA792E9B1AB"
Message-ID: <[email protected]>
X-OriginalArrivalTime: 20 Jul 2011 21:55:46.0884 (UTC) FILETIME=[C7D54040:01CC4727]
X-Spam-Status: No, score=1.8
X-Spam-Score: 18
X-Spam-Bar: +
X-Ham-Report: Spam detection software, running on the system "ets2057.easytosendmail.com", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: =========================================================
You received this message because you have opted-in to receive email from
Shah Companies Easy Unsubscribe: To ensure delivery, add [email protected]
to your address book. This email was sent to: [email protected]
by [email protected] [...]
Content analysis details: (1.8 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
(staff[at]hotmail.com)
-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no
trust
[65.54.190.217 listed in list.dnswl.org]
-0.0 SPF_PASS SPF: sender matches SPF record
0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
0.0 T_TVD_MIME_EPI BODY: T_TVD_MIME_EPI
0.0 HTML_MESSAGE BODY: HTML included in message
2.5 FREEMAIL_REPLY From and body contain different freemails
0.0 T_TO_NO_BRKTS_FREEMAIL To: misformatted and free email service
-0.7 AWL AWL: From: address is in the auto white-list
X-Spam-Flag: NO

--1BF3A9E0-13F5-41C9-8EC0-3FA792E9B1AB
Content-Type: message/rfc822
Content-Disposition: inline

X-HmXmrOriginalRecipient: [email protected]
X-Reporter-IP: 208.7.39.234
Authentication-Results: hotmail.com; sender-id=temperror (sender IP is 69.64.40.240) [email protected]; dkim=none header.d=shahcompanies.com; x-hmca=none
X-Message-Status: n:0:n
X-SID-PRA: Shah Companies <[email protected]>
X-DKIM-Result: None
X-AUTH-Result: NONE
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0wO0Q9MTtTQ0w9Mw==
X-Message-Info: JGTYoYF78jEmJkgrISRO7Pm075TheIlBszqSkaAkxG6SF1kLipZxm9cJfIzv8Rr4GDLlJBMAL9HsELGxkeAUMp3jPwW24N5/qUPF31wVCWbiwg3h85xKC4NoOOl2zxwN
Received: from ets2710.etsmta.com ([69.64.40.240]) by bay0-mc4-f26.Bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675);
Wed, 20 Jul 2011 14:32:12 -0700
Received: from etsmta by ets2710.etsmta.com with local (Exim 4.69)
(envelope-from <[email protected]>)
id 1QjeNI-0005la-Af
for [email protected]; Wed, 20 Jul 2011 17:32:12 -0400
To: [email protected]
Subject: Professional Office Spaces Available for Lease
Date: Wed, 20 Jul 2011 17:32:12 -0400
From: Shah Companies <[email protected]>
Reply-To: Shah Companies <[email protected]>
Message-ID: <[email protected]>
X-Priority: 3
X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.0 rc3]
X-RPCampaign: ETS20110720173212
X-Unsubscribe: http://my.easytosend.com/index.php/subscription/unsubscribe/[email protected]&list_key=4E273D2B2487611&src=mailbox&cmp_id=1627
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_a555076124073667d6bbd979b6421dee"
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - ets2710.etsmta.com
X-AntiAbuse: Original Domain - msn.com
X-AntiAbuse: Originator/Caller UID/GID - [500 500] / [47 12]
X-AntiAbuse: Sender Address Domain - etspo2710.etsmta.com
Return-Path: [email protected]
X-OriginalArrivalTime: 20 Jul 2011 21:32:12.0701 (UTC) FILETIME=[7CEA0CD0:01CC4724]


--b1_a555076124073667d6bbd979b6421dee
Content-Type: text/plain; charset = "utf-8"
Content-Transfer-Encoding: 8bit



=========================================================
You received this message because you have opted-in to receive email from Shah Companies

Easy Unsubscribe:
my.easytosend.com/index.php/subscri ...

To ensure delivery, add [email protected] to your address book.
This email was sent to: [email protected] by [email protected]

Our mailing address is:
Shah Companies | 4660 Sweetwater Blvd. Suite 300, | Sugar Land, TX 77479

Forward to your friend:
my.easytosend.com/index.php/subscri ...

Manage your subscriptions:
my.easytosend.com/index.php/subscri ...

Powered by:
easytosend.com



--b1_a555076124073667d6bbd979b6421dee
Content-Type: text/html; charset = "utf-8"
Content-Transfer-Encoding: 8bit

<table align="center" border="0" cellpadding="2" width="100%">
<tbody>
here is the html email
</tbody>
</table>



--b1_a555076124073667d6bbd979b6421dee--

table>



--b1_a555076124073667d6bbd979b6421dee--


--1BF3A9E0-13F5-41C9-8EC0-3FA792E9B1AB--

~~~~~~~~~~~~~~~~Output~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MIME message decoding successful. 1 message was found. Message 1:
array
0 =>
array
'Headers' =>
array
'return-path:' => string '<[email protected]>' (length=19)
'envelope-to:' => string '[email protected]' (length=20)
'delivery-date:' => string 'Wed, 20 Jul 2011 17:55:53 -0400' (length=31)
'received:' =>
array
...
'date:' => string 'Wed, 20 Jul 2011 14:55:46 -0700' (length=31)
'from:' => string '[email protected]' (length=17)
'subject:' => string 'complaint about message from 69.64.40.240' (length=41)
'to:' => string '[email protected]' (length=20)
'mime-version:' => string '1.0' (length=3)
'content-type:' => string 'multipart/mixed; boundary="1BF3A9E0-13F5-41C9-8EC0-3FA792E9B1AB"' (length=64)
'message-id:' => string '<[email protected]>' (length=50)
'x-originalarrivaltime:' => string '20 Jul 2011 21:55:46.0884 (UTC) FILETIME=[C7D54040:01CC4727]' (length=60)
'x-spam-status:' => string 'No, score=1.8' (length=13)
'x-spam-score:' => string '18' (length=2)
'x-spam-bar:' => string '+' (length=1)
'x-ham-report:' => string 'Spam detection software, running on the system "ets2057.easytosendmail.com", hasidentified this incoming email as possible spam. The original messagehas been attached to this so you can view it (if it isn't spam) or labelsimilar future email. If you have any questions, seethe administrator of that system for details.Content preview: =========================================================You received this message because you have opted-in to receive email fromShah Companies Easy Unsubscribe: To ensure d'... (length=1490)
'x-spam-flag:' => string 'NO' (length=2)
'Parts' =>
array
empty
'Position' => int 0
'Body' => string '--1BF3A9E0-13F5-41C9-8EC0-3FA792E9B1AB
Content-Type: message/rfc822
Content-Disposition: inline

X-HmXmrOriginalRecipient: [email protected]
X-Reporter-IP: 208.7.39.234
Authentication-Results: hotmail.com; sender-id=temperror (sender IP is 69.64.40.240) [email protected]; dkim=none header.d=shahcompanies.com; x-hmca=none
X-Message-Status: n:0:n
X-SID-PRA: Shah Companies <[email protected]>
X-DKIM-Result: None
X-AUTH-Result: NONE
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0wO0Q9'... (length=15063)
'BodyPart' => int 1
'BodyLength' => int 15063
'ExtractedAddresses' =>
array
'return-path:' =>
array
...
'from:' =>
array
...
'to:' =>
array
...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Can you please suggest what am I missing actually ?


  5. Re: Inline text attachments not parsed   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-07-22 04:07:44 - In reply to message 4 from M. Arifur Rahman
Your message is not being pasted correctly. Can you please upload it somewhere so I can try to reproduce the problem with the original message?

  6. Re: Inline text attachments not parsed   Reply   Report abuse  
Picture of M. Arifur Rahman M. Arifur Rahman - 2011-07-22 06:35:55 - In reply to message 5 from Manuel Lemos
Hi Manuel,
Thanks for so quick response :)
following is the link where I have uploaded the email file.

stranger.isgreat.org/mytest.eml

However,
I have noticed something, when I remove a blank line as it is in the bellow snippet it works great :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--1BF3A9E0-13F5-41C9-8EC0-3FA792E9B1AB
Content-Type: message/rfc822
Content-Disposition: inline

X-HmXmrOriginalRecipient: [email protected]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

But I thought it should work as it passed those line break tests, right ?
Am I missing anything ?
Thanks a lot again.

  7. Re: Inline text attachments not parsed   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-07-22 07:20:03 - In reply to message 6 from M. Arifur Rahman
I tried it here and it works as expected. Do not remove that line, or else it will confuse the container message with the included message.

Just make sure you are not using the SkipBody parameter.

  8. Re: Inline text attachments not parsed   Reply   Report abuse  
Picture of M. Arifur Rahman M. Arifur Rahman - 2011-07-22 08:04:49 - In reply to message 7 from Manuel Lemos
Hi Manuel,
Thanks again.
Here is the code snippet I am using to get the From, To and retrun-path from email attachment :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
....... ......
...... ......
foreach($decoded[0]['Parts'] as $part){

//check for attachments
if($part["Headers"]["content-disposition:"] == 'inline'){
var_dump($part["Body"]);//die("Testing");

if($mime->Analyze($part, $results))
var_dump($results);
else
echo 'MIME message analyse error: '.$mime->error."\n";
}
}
......
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I see all those info are within the "Data" cell of the array. I am not sure, but I thought they should be in the "Headers" cell !

Can you please help how I can parse this attachment email using the same parser ?

Appreciate your help a lot.
Thanks.

  9. Re: Inline text attachments not parsed   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-07-22 09:05:17 - In reply to message 8 from M. Arifur Rahman
I am afraid you are a bit confused.

What you are receiving is a spam report message.

That message contains another message inside of the type message/rfc822, meaning regular e-mail message, often saved with .eml extension.

That message data comes as body part of the message/rfc822 part.

So if you want to parse that contained message, you just need to get the Data entry of the parsed message results array and pass it to the MIME message parser again.