Retrieving only a specific part of the email body using imap_body

I have a mail where I need to get the body through PHP imap functions, and then save it to the database. These letters are sent from the response system. I use this code to get the email body

$bodyText = imap_fetchbody($mbox,$v,1.2);
if(!strlen($bodyText)>0){
     $bodyText = imap_fetchbody($mbox,$v,1);
}

This works fine, but also includes the original body of the message, is there any way to get a response.

All email looks like this:

**This is a test
-- 
Kind Regards,



-----Original Message-----
From: -------------
To:--------------------------
Subject: You have received a reply to your enquiry
New System
Date: Tue, 5 Jul 2011 16:24:28 +0200
Good day,
You have received the following reply to an enquiry you made 
-------------------------------------------------------------------------------------------------
test3     

--------------------------------------------------------------------------------------------------
To reply to this comment please click on the Reply To button and add the message you wish to send.**

Is there a way to get only the message body without the ORIGINAL MESSAGE USING IMAP FUNCTIONS or other PHP functions?

+5
source share
2 answers

: http://www.damnsemicolon.com/php/php-parse-email-body-email-piping, . , , . , , , .

, / . :

$headerInfo = imap_headerinfo($mbox,$v);

$fromEmail = $headerInfo->from->personal;
$fromName = $headerInfo->from->mailbox . "@" . $headerInfo->from->host;
$toEmail = $headerInfo->to->personal;
$toName = $headerInfo->to->mailbox . "@" . $headerInfo->to->host;

: , Google: http://webcache.googleusercontent.com/search?q=cache:5MxzHXFU5TkJ:www.damnsemicolon.com/php/php-parse-email-body-email-piping+&cd=1&hl=en&ct=clnk&gl=ca

+1

substr($wholeMessage, 0, strpos($wholeMessage, 0, "-----Original Message-----"));

---- ---. ,

EDIT: , mime.. , , .

0

All Articles