473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Read data from the email body

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

Aug 6 '06 #1
1 1636
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

"Eric" wrote:
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

Aug 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: chuck amadi | last post by:
Hi , Im trying to parse a specific users mailbox (testwwws) and output the body of the messages to a file ,that file will then be loaded into a PostGresql DB at some point . I have read the...
16
by: Chuck Amadi | last post by:
Sorry to bovver you again (again) here's script. I still can't see why the get_payload() doesn't produce the plain text message body of an emails in the testwwws users mailbox. As you can see I...
0
by: Majordomo | last post by:
-- >>>> --36742377 **** Command '--36742377' not recognized. >>>> Content-Type: text/plain; charset=us-ascii **** Command 'content-type:' not recognized. >>>> Content-Transfer-Encoding: 7bit...
2
by: Gunnar | last post by:
Hello, I've just written a CPP program that reads integers from a binary file, and used this code while (my_ifstram.read( (char* ) &number, sizeof(int)) { // do something with number } My...
2
by: Reply Via Newsgroup | last post by:
Folks, I'm pretty sure it can be done, and I'm doing pretty good with my javascript so I'm pretty sure I just need a quick point in the right direction... If my web page is referenced in the...
7
by: Mike | last post by:
Hi, I have an iteration to retrieve a number of messages from a server. Within this iteration, I am using the following code: do { readBytes = base.GetStream().Read(received, 0,...
3
by: Programmer | last post by:
Hi all I wan't to know if i'm able to read mail from a mail server. My mail server is a pop3 server (UNIX) and i want to be able to get the mails from an aspx or an asmx. with out using external...
9
by: MR | last post by:
I get the following Exception "The data at the root level is invalid. Line 1, position 642" whenever I try to deserialize an incoming SOAP message. The incoming message is formed well and its...
0
by: Paul H | last post by:
I have the following code running against the compact framework: using System; using System.Data; using System.Net; using System.IO; using System.Text; namespace WebSample {
1
by: ColebyA | last post by:
Hi I am using ASP and HTML to process a form. The first form calls another page to process the data. When the page processes it redirects to a page confirming submission. I want to display the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.