Jump to content

help with Maildir


yolop

Recommended Posts

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: base64
and 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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.