|
|
| |
1. Parsing txt attachments |
|
Reply |
|
|
 Fabrizio | 2008-11-19 16:25:04 |
Hi,
i must parse details.txt (text message on Returned mail: Domain not found" error and others..).
how i can do this?
i need to catch "Original-Recipient: "....
can u help me?
thanks a lot! |
| |
2. Re: Parsing txt attachments |
|
Reply |
|
|
 Manuel Lemos | 2008-11-19 18:23:44 |
| Can you provide a sample message complete with headers and body so I can understand what kind message you are talking about? |
| |
3. Re: Parsing txt attachments |
|
Reply |
|
|
 Fabrizio | 2008-11-20 08:13:09 |
This is the output of browse_mailbox.php:
1C RETR 1
S +OK 2908 octets
S Received: from mx.sample.it
S by mx.sample.it (ServerPro1 V1) with SMTP id ZUA21804
S for <prova@sample.it>; Wed, 19 Nov 2008 10:33:04 +0100
S Date: Wed, 19 Nov 2008 10:33:04 +0100
S From: Merak Mail Server V1 <postmaster@sample.it>
S To: <prova@sample.it>
S Message-Id: <963859490@mx.sample.it>
S Content-Type: text/plain; charset="utf-8"
S Content-Transfer-Encoding: 8bit
S Subject: Returned mail: Domain not found
S Content-Type: multipart/report; report-type=delivery-status; boundary="963859490200811191033040745@mx.sample.it"
S
S --963859490200811191033040745@mx.sample.it
S Content-Type: text/plain; charset="utf-8"
S Content-Transfer-Encoding: 8bit
S
S The original message was received at Wed, 19 Nov 2008 10:33:04 +0100
S
S ----- The following addresses had permanent fatal errors -----
S <asasas@asasasa.it>
S
S ----- Transcript of session follows -----
S ... while issuing MX query to xxx.xxx.x.xx
S 554 Domain not found
S
S --963859490200811191033040745@mx.sample.it
S Content-Type: message/delivery-status
S
S Reporting-MTA: DNS; mx.sample.it
S Arrival-Date: Wed, 19 Nov 2008 10:33:06 +0100
S
S Original-Recipient: RFC822; <asasas@asasasa.it>
S Final-Recipient: RFC822; <asasas@asasasa.it>
S Action: failed
S Last-Attempt-Date: Wed, 19 Nov 2008 10:33:04 +0100
S
S --963859490200811191033040745@mx.sample.it
S Content-Type: message/rfc822
S
S Return-Path: <prova@sample.it>
S Received: from localhost ([192.168.0.172])
S by mx.sample.it (ServerPro1 V1) with ASMTP id ZUA84303
S for <asasas@asasasa.it>; Wed, 19 Nov 2008 10:33:03 +0100
S Date: Wed, 19 Nov 2008 10:31:40 +0100
S Return-Path: prova@sample.it
S To: Josh Adams <asasas@asasasa.it>
S From: Mailer <prova@sample.it>
S Reply-to: Information <prova@sample.it>
S Subject: prova
S Message-ID: <477fdd7a6daad597adfa16508f67f72a@localhost>
S X-Priority: 3
S X-Mailer: PHPMailer (phpmailer.codeworxtech.com) [version 2.3]
S MIME-Version: 1.0
S Content-Type: multipart/mixed;
S boundary="b1_477fdd7a6daad597adfa16508f67f72a"
S X-Spam-IndexStatus: 0
S
S
S --b1_477fdd7a6daad597adfa16508f67f72a
S Content-Type: multipart/alternative;
S boundary="b2_477fdd7a6daad597adfa16508f67f72a"
S
S --b2_477fdd7a6daad597adfa16508f67f72a
S Content-Type: text/plain; charset = "iso-8859-1"
S Content-Transfer-Encoding: 8bit
S
S
S aaaaa
S
S
S --b2_477fdd7a6daad597adfa16508f67f72a
S Content-Type: text/html; charset = "iso-8859-1"
S Content-Transfer-Encoding: 8bit
S
S
S aaaaa
S
S
S
S --b2_477fdd7a6daad597adfa16508f67f72a--
S --b1_477fdd7a6daad597adfa16508f67f72a
S Content-Type: application/octet-stream; name="prova.txt"
S Content-Transfer-Encoding: base64
S Content-Disposition: attachment; filename="prova.txt"
S
S YWFhYWFhYWFhYWFhYWFhYQ0KYWFhYWFhYWFhYWFhYWFhDQphYWFhYWFhYWFhYWFhYWFhYWFhDQoN
S Cg0KDQoNCi0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KDQoNCg0KDQoNCg0KDQoNCg0KDQphYWFhYWFh
S YWFhYWFhYWFhYWFhYWFhYWFhYWE=
S
S
S --b1_477fdd7a6daad597adfa16508f67f72a--
S
S
S
S --963859490200811191033040745@mx.sample.it--
S .
--------------------
Mittente 1 = postmaster@sample.it
MIME message 1 decoding successful
Message 1structure
array(3) {
["Headers"]=>
array(8) {
["received:"]=>
string(135) "from mx.sample.it by mx.sample.it (ServerPro1 V1) with SMTP id ZUA21804 for ; Wed, 19 Nov 2008 10:33:04 +0100"
["date:"]=>
string(31) "Wed, 19 Nov 2008 10:33:04 +0100"
["from:"]=>
string(42) "Merak Mail Server V1 "
["to:"]=>
string(16) ""
["message-id:"]=>
string(23) "<963859490@mx.sample.it>"
["content-type:"]=>
array(2) {
[0]=>
string(27) "text/plain; charset="utf-8""
[1]=>
string(97) "multipart/report; report-type=delivery-status; boundary="963859490200811191033040745@mx.sample.it""
}
["content-transfer-encoding:"]=>
string(4) "8bit"
["subject:"]=>
string(31) "Returned mail: Domain not found"
}
["Parts"]=>
array(3) {
[0]=>
array(4) {
["Headers"]=>
array(2) {
["content-type:"]=>
string(27) "text/plain; charset="utf-8""
["content-transfer-encoding:"]=>
string(4) "8bit"
}
["Parts"]=>
array(0) {
}
["BodyPart"]=>
int(1)
["BodyLength"]=>
int(273)
}
[1]=>
array(4) {
["Headers"]=>
array(1) {
["content-type:"]=>
string(23) "message/delivery-status"
}
["Parts"]=>
array(0) {
}
["BodyPart"]=>
int(2)
["BodyLength"]=>
int(247)
}
[2]=>
array(4) {
["Headers"]=>
array(1) {
["content-type:"]=>
string(14) "message/rfc822"
}
["Parts"]=>
array(0) {
}
["BodyPart"]=>
int(3)
["BodyLength"]=>
int(1529)
}
}
["ExtractedAddresses"]=>
array(2) {
["from:"]=>
array(1) {
[0]=>
array(2) {
["address"]=>
string(19) "postmaster@sample.it"
["name"]=>
string(20) "Merak Mail Server V1"
}
}
["to:"]=>
array(1) {
[0]=>
array(1) {
["address"]=>
string(14) "prova@sample.it"
}
}
}
}
Message 1 analysis
array(7) {
["Type"]=>
string(4) "text"
["Description"]=>
string(12) "Text message"
["Encoding"]=>
string(5) "utf-8"
["Subject"]=>
string(31) "Returned mail: Domain not found"
["Date"]=>
string(31) "Wed, 19 Nov 2008 10:33:04 +0100"
["From"]=>
array(1) {
[0]=>
array(2) {
["address"]=>
string(19) "postmaster@sample.it"
["name"]=>
string(20) "Merak Mail Server V1"
}
}
["To"]=>
array(1) {
[0]=>
array(1) {
["address"]=>
string(14) "prova@sample.it"
}
}
}
this is the output of a returned mail....and the attachements are 2:
prova.txt (file I attached) and details.txt...
I need to estract text inside details.txt (need to know errors from email andresses for write them into db):
Reporting-MTA: DNS; mx.sample.it
Arrival-Date: Wed, 19 Nov 2008 10:02:22 +0100
Original-Recipient: RFC822; <asasas@asasasa.it>
Final-Recipient: RFC822; <asasas@asasasa.it>
Action: failed
Last-Attempt-Date: Wed, 19 Nov 2008 10:02:21 +0100
Thanks for your help and sorry for my bad english :D
|
| |
4. Re: Parsing txt attachments |
|
Reply |
|
|
 Manuel Lemos | 2008-11-20 08:47:46 |
The class would parse the bounce report information, but it is malformed because it has two content-type headers. Therefore it is treated as a regular text message.
You also must not use the SkipBody parameter in the Decode function call. |
|