Reputation: 18029
I am trying to create a JS script to open and view Eml file. But till now I am stuck and with no way to go further. Can someone give me some directions. I was planning to post back my findings here with code so others can benefit too.
Upvotes: 7
Views: 13667
Reputation: 168
The first step is to load the EML file either as a String or as a Stream. A EML file should look like this:
Date: Wed, 29 Jan 2014 11:10:06 +0100
To: "Foo Bar" <[email protected]>
From: Online Shop <[email protected]>
Subject: Winter promotions
Content-Type: text/plain; charset=utf-8
Some Content
If you are looking to parse it yourself you have to look for keys like this:
/[\n\r]+[\-a-zA-Z]+:/ (a newline followed by a word with no spaces and a colon)
Everything after the colon and before the next key will become the value for that key.
If you want to learn more about it you may look into these:
If you want some working code ready to use you may look here:
Upvotes: 1