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

Similar Threads

Search text 1
Pattern Matching 1
Save data from text file into access 0
Insert Data 2
Insert Data 0
Error 0
How Can I read the Binary data from Database 1
Copying files from the server to the PC 10

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,160
Latest member
CollinStri
Top