By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

Regexp and parsing .eml file in details problem

P: n/a

Is anyone have an example of RegExp expression to parse .EML files (Email
Message)? I need to extract headers, HTML body, Textual body and attachments
if any exists.

I did some example, but not sure that its a good start:

^Message-ID: (?<messageid>.*)\nFrom: (?<from>.*)\nTo: (?<to>.*)\nSubject:
(?<subject>.*)\nDate: (?<date>.*)\nMIME-Version: (?<mime>.*)\nContent-Type:

And the test message file was:
Received: from ([]) with arachnoMail.NET Server; Sat, 06 Mar 2004
05:19:49 -0800
Message-ID: <00****************************@test.vpn>
From: Test <te**@test.vpn>
To: Test <te**@test.vpn>
Subject: bg_stripe.gif
Date: Sat, 6 Mar 2004 12:24:06 +0200
MIME-Version: 1.0
Content-Type: multipart/mixed;
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165

This is a multi-part message in MIME format.

Content-Type: multipart/alternative;
Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable

Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=3DContent-Type content=3D"text/html; =
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<BODY bgColor=3D#ffffff>


Content-Type: image/gif;
Content-Transfer-Encoding: base64
Content-Disposition: attachment;


Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.