Outlook email parse

Posted on 2003-03-31
Medium Priority
Last Modified: 2012-05-04
I am looking to parse the body of a folder of email possibly via outlook or outlook express (but from what I understand outlook must be used in this case).  The email should only be parsed if the subject has a certain title in it.  While parsing the program will save any data that it needs to save in some variables which will later be printed out in a .txt file.  My question is should I try to interact directly with outlook or should I just I bypass outlook altogether and instead create my own mapi session to interact with the program.  If anyone has any sample code on how to do either of these two things or knows of a good tutorial that could help me out in this area (i have already read the MSDN concerning MAPI and am still fuzzy on this topic) I would appreciate it.
Question by:kserra
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 28

Accepted Solution

vinnyd79 earned 296 total points
ID: 8242597
you can use the outlook object Model.Try this example,add a reference to Microsoft Outlook Object Library:

Dim objOutlook As New Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As MAPIFolder
Dim objMail As MailItem

Private Sub Command1_Click()
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
For i = 1 To objFolder.Items.Count
Set objMail = objFolder.Items(i)
     ' add inbox subjects to listbox
    List1.AddItem objMail.Subject
    ' check message subjects for 'Some Title Here'
    If InStr(1, objMail.Subject, "Some Title Here") > 0 Then

        ' subject found  - check body for the word cheese
        If InStr(1, objMail.Body, "cheese") > 0 Then
        ' found
        ' get variables from objMail.Body
        End If
    End If
Next i
End Sub

Expert Comment

ID: 8531236
Hi kserra,
This old question (QID 20569440) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
LVL 76

Expert Comment

ID: 9001841
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept vinnyd79's comment as answer
Please leave any comments here within the next seven days.
EE Cleanup Volunteer

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question