Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 15th May 2010, 16:21
dpicella dpicella is offline
Senior Member
 
Join Date: Apr 2009
Posts: 116
Thanks: 9
Thanked 8 Times in 7 Posts
Default Parse Values from Email Templates

I've got some emails in the form of .eml files where I want to parse out some values and insert them in a MySQL DB.

For example.
Code:
TYPE: TEST
FIRST_NAME: JOHN
LAST_NAME: DOE
VISIT_CODE: 999-99-9999
AUTH: 9999999-99999
BEGIN:VTIMEZONE
TZID:(GMT-08.00) Pacific Time (US & Canada)/Tijuana
X-MICROSOFT-CDO-TZID:13
BEGIN:STANDARD
DTSTART:16010101T020000
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
END:VTIMEZONE
What is the best way to approach this? Any suggestions. I don't need to read the email boxes, I've already got that part handled, I just need to take something like the above text (which I already have in a string) and parse the values and insert.

Perhaps Regex in PHP would be easiest.
Reply With Quote
Sponsored Links
  #2  
Old 16th May 2010, 11:40
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,743 Times in 2,577 Posts
 
Default

You can do this with the explode() function. Take a look at http://de3.php.net/manual/en/function.explode.php
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Email delivery problem - Ubuntu Karmic Koala (Ubuntu 9.10) [ISPConfig 2] qiubosu General 58 16th April 2010 12:24
Email delivery problem - Ubuntu Karmic Koala (Ubuntu 9.10) [ISPConfig 2] qiubosu Installation/Configuration 1 18th January 2010 09:21
hotmail rejects outgoing email nzimas Server Operation 3 1st May 2009 03:39
Anyone figured out to integrate FuzzyOCR into ISPConfig on Ubuntu? friday Installation/Configuration 16 10th May 2007 16:25
email forwarding locally consumes all resources rdells General 20 1st May 2006 19:43


All times are GMT +2. The time now is 08:36.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.