Hi, I was wondering if there is a way to grab a part of a message and put it into a variable.

For example, if I have this e-mail message /w all headers and extras included, I want to just grab the actual message out of it.

CODE
From MAILER-DAEMON Sat Dec 17 04:41:28 2005
Date: 17 Dec 2005 04:41:28 +0000
From: Mail System Internal Data
Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA
Message-ID: <1134794488@gamma.xisto.com>
X-IMAP: 1134603532 0000000079
Status: RO

This text is part of the internal format of your mail folder, and is not
a real message.  It is created automatically by the mail system software.
If deleted, important folder data will be lost, and it will be re-created
with the data reset to initial values.

From xjedix@sf.trap17.com Sat Dec 17 04:41:28 2005
Return-path:
Envelope-to: xjedix@gamma.xisto.com
Delivery-date: Sat, 17 Dec 2005 04:41:28 +0000
Received: from xjedix by gamma.xisto.com with local-bsmtp (Exim 4.52)
id 1EnTsu-00049w-Dj
for xjedix@gamma.xisto.com; Sat, 17 Dec 2005 04:41:28 +0000
X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on gamma.xisto.com
X-Spam-Level:
X-Spam-Status: No, score=0.5 required=5.0 tests=NO_REAL_NAME,NO_RELAYS
autolearn=no version=3.1.0
Received: from xjedix by gamma.xisto.com with local (Exim 4.52)
id 1EnTsu-00049p-8U
for xjedix@sf.trap17.com; Sat, 17 Dec 2005 04:41:28 +0000
Received: from 64.212.140.5 ([64.212.140.5])
       (SquirrelMail authenticated user xjedix)
       by www.sf.trap17.com with HTTP;
       Sat, 17 Dec 2005 04:41:28 -0000 (UTC)
Message-ID: <4370.64.212.140.5.1134794488.squirrel@www.sf.trap17.com>
Date: Sat, 17 Dec 2005 04:41:28 -0000 (UTC)
Subject: test
From: xjedix@sf.trap17.com
To: xjedix@sf.trap17.com
User-Agent: SquirrelMail/1.4.4
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal
Status: O
X-Status:
X-Keywords:                  
X-UID: 79

lalalalal test....tetst

Yay!


I want the message:
CODE
alalalal test....tetst

Yay!


to be inserted into a variable so I can insert it into a sql database. How could I go about doing this? I have been looking at some different php functions but I'm not sure exactly I would go about doing this.

Any help would be greatly appreciated,

Thanks, xJedix

 

 

 


Reply