yolop Posted September 3, 2009 Share Posted September 3, 2009 hi i tried to read email from Maildir (in my server) /imap/my_domain/user_email/Maildir/new/ i success to explode from the file : subject date the email that sent this mail all of that i under of beside always words so it easy to get them but i have a problem to understand how can i read the text because sometimes the text is under Content-Type: text/plain; charset=ISO-8859-1 and sometimes the text is under Content-Transfer-Encoding: base64and sometimes the text is under X-OriginalArrivalTime: 03 Sep 2009 10:53:12.0266 (UTC) FILETIME=[bB4532A0:01CA2C84] (i tried to support in other language besides English) please help me to read the text of the email Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted September 3, 2009 Share Posted September 3, 2009 Those lines are known as headers. The headers will always end after the first blank line, so that is where the email body will begin. Quote Link to comment Share on other sites More sharing options...
yolop Posted September 3, 2009 Author Share Posted September 3, 2009 Those lines are known as headers. The headers will always end after the first blank line, so that is where the email body will begin. no i ceck over 20 emails usually the text is after Content-Type but there is email that the text after X-OriginalArrivalTime: 03 Sep 2009 10:53:12.0266 (UTC) FILETIME=[bB4532A0:01CA2C84] that is no something i can to search acording it if always the body of the email was show after Content-Transfer-Encoding: i can search acording this but no thank Quote Link to comment Share on other sites More sharing options...
trq Posted September 3, 2009 Share Posted September 3, 2009 I'm sorry if English isn't your first language, but your last post made no sense at all. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted September 3, 2009 Share Posted September 3, 2009 The text is always after the first blank line. Otherwise it's not an email, but something else. Which particular order the headers are in is irrelevant, but the headers are always at the top (obviously) and then the body follows. Quote Link to comment Share on other sites More sharing options...
yolop Posted September 3, 2009 Author Share Posted September 3, 2009 The text is always after the first blank line. Otherwise it's not an email, but something else. Which particular order the headers are in is irrelevant, but the headers are always at the top (obviously) and then the body follows. but if i open this unknown file with php i dont know how to search blank lines Quote Link to comment Share on other sites More sharing options...
yolop Posted September 3, 2009 Author Share Posted September 3, 2009 and that not always somtimes that the body of the text dont show after the first blank line.... Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted September 3, 2009 Share Posted September 3, 2009 but if i open this unknown file with php i dont know how to search blank lines You could do something like this (not tested): <?php $lines = file('the_email'); for ($pos = 0; !empty(trim($lines[$pos])); ++$pos) {} $body = join('', array_slice($lines, $pos)); Quote Link to comment Share on other sites More sharing options...
yolop Posted September 3, 2009 Author Share Posted September 3, 2009 but if i open this unknown file with php i dont know how to search blank lines You could do something like this (not tested): <?php $lines = file('the_email'); for ($pos = 0; !empty(trim($lines[$pos])); ++$pos) {} $body = join('', array_slice($lines, $pos)); \Return-path: <*****@gmail.com> Envelope-to: ***** Delivery-date: Thu, 20 Aug 2009 19:25:58 +0300 Received: from mail-ew0-f214.google.com ([209.85.219.214]) by server1.****.* with esmtp (Exim 4.67) (envelope-from <*******>) id 1MeASc-0002uU-Jl for ******; Thu, 20 Aug 2009 19:25:58 +0300 Received: by ewy10 with SMTP id 10so54271ewy.13 for <*******>; Thu, 20 Aug 2009 09:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=h1GXXOK/pPliLUwQsgt9RQRiEPWwqYilaavab02d6qY=; b=Fvv6EEYfcAfS/mTk+0G1PNdYE5ovRpuUagMNrcvfN0MWqdwLYzRW0nvfgnLzdeEdYE Bjpm0F7x0Iky4EnM5cZGgFKuF+79IY8Z0c9qbIMF6Di5RmxAhnWx0oxg6bPPDYKzu4eF BnLepyb468wpvDL7uoHzpKkC2KCV/rCr8xhs4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=lTv79qklMsTTXNzUBFHEpVDIoyqDYJRiXKYyWHHo9/yeb6kfZOYA3xyVfYFa4OCmmp Gzg0EGS3dsvZpIi0H7Zt6aN+0MUsEPps3KF8WyOxR7rAy4syN5zvGNMQZuBH3EyiDdWs E1NfaTygASPclfmv/v4kY5RKrSTKRGL3JyVGY= MIME-Version: 1.0 Received: by 10.216.88.14 with SMTP id z14mr1761646wee.25.1250785058887; Thu, 20 Aug 2009 09:17:38 -0700 (PDT) Date: Thu, 20 Aug 2009 19:17:38 +0300 Message-ID: <4973a4280908200917r3a9ec95reaf6f6829d15e956@mail.gmail.com> Subject: 1111 From: =?UTF-8?B?16DXqNeZ15Q=?= <*****@gmail.com> To: ******** Content-Type: multipart/alternative; boundary=0016e6d7e92520183904719517e6 --0016e6d7e92520183904719517e6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 2222 --0016e6d7e92520183904719517e6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <div dir="rtl"><p>2222</p></div> --0016e6d7e92520183904719517e6-- here the body is not atfer the firtst balnk line the body is <div dir="rtl"><p>2222</p></div> Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted September 3, 2009 Share Posted September 3, 2009 Right, okay. That's because it's a MIME multipart message. Look it up. Quote Link to comment Share on other sites More sharing options...
yolop Posted September 3, 2009 Author Share Posted September 3, 2009 Right, okay. That's because it's a MIME multipart message. Look it up. what is MIME multipart message? and how i can i find the text of masaage in MIME multipart message? and how can i know that MIME multipart message (beacsuse i need to know when dont search in the first blank line)??? thank you Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted September 3, 2009 Share Posted September 3, 2009 http://lmgtfy.com/?q=mime+multipart+message Quote Link to comment Share on other sites More sharing options...
yolop Posted September 3, 2009 Author Share Posted September 3, 2009 http://lmgtfy.com/?q=mime+multipart+message and in mime multipart message how can i find the text of the email???? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted September 3, 2009 Share Posted September 3, 2009 In the same way. Each part has its own header section. Identify the boundary, the split the entire message up. You'll then find the body of each part the same way as before. Quote Link to comment Share on other sites More sharing options...
yolop Posted September 3, 2009 Author Share Posted September 3, 2009 In the same way. Each part has its own header section. Identify the boundary, the split the entire message up. You'll then find the body of each part the same way as before. i didn't understand what did you say 'please give me an example and i looking on google but i dont understand what is MIME multipart message thank you so much Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted September 3, 2009 Share Posted September 3, 2009 I can help you write the script, but not write it for you (not for free anyway). Do an attempt first yourself. Quote Link to comment Share on other sites More sharing options...
yolop Posted September 3, 2009 Author Share Posted September 3, 2009 I can help you write the script, but not write it for you (not for free anyway). Do an attempt first yourself. not write, i relay try so you can please explain me what is MIME multipart message please? and if there is another kind of email that the body of the text not show after the first blank line thank you again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.