Read data from the email body

E

Eric

I wrote a program which read emails from a textfile. I save these
emails from inbox. I need hlep how to i read the body of an email from
a text file.

Dim fso, fil, ts, sContents
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fil = fso.getfile(server.mappath("myemails.txt"))
Set ts = fil.openastextstream(1)
sContents = ts.readall
response.write("From")
sPattern = "From\:\s*([\s\S]+?)[\r\n]+"
Dim rx
Set rx = New RegExp
rx.Global = True
rx.IgnoreCase = True
rx.MultiLine = True
rx.Pattern = sPattern
Set mc = rx.Execute(sContents)
For Each rm In mc
sFrom = rm.SubMatches(0)
response.write("<br>")
response.write(sFrom)
Next
 
G

Guest

Eric,

just curious to know. if you wrote the program to save the emails from inbox
to text files, why not try using xml instead of text files?

Regards,
Augustin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top