VB6 Read Email Headers

Posted on 2007-10-11
Last Modified: 2013-12-26
Is it possible using VB 6 to read a Email Header ??

I'm using Mapi to read through E-mails but I need to read in the Reply To address but  I can't find this property within Mapi so I was wondering if I can read in the Email headers then extract the reply-to section ??
Question by:itimes
    LVL 59

    Expert Comment

    by:Chris Bottomley
    I presume you need the senderemailaddress property?


    Author Comment


    Some Emails are being recived where the "Friom" address differs from the reply-to address.
    LVL 59

    Expert Comment

    by:Chris Bottomley
    If it is the replyto in this context then I don't think MAPI has this property.  I think you can use CDO or redemption to access the replyto address though I haven't used either from VB6.


    Author Comment

    Chris if you can provide me with an example of either CDO or redemption  on VB 6 the poinst are yours .... will google myslef ofcorse too !
    LVL 59

    Expert Comment

    by:Chris Bottomley
    CDO, (see

        NewCDOMessage "Personal Data - Manual Config - Attempt " & i & ".", strHeader & strbody & strFooter, Cells(i, 1).Value, "", "", False

    Public Sub NewCDOMessage(strSubject As String, strbody As String, Optional strTo As String, _
                                Optional strCC As String, Optional strBCC As String, Optional SendYN As Boolean, _
                                Optional AttachYN As Boolean = False, Optional Attach1 As String)

        Dim iMsg As Object
        Dim iConf As Object
        Dim str_body As String
    '    Dim Flds As Variant

        Set iMsg = CreateObject("CDO.Message")
        Set iConf = CreateObject("CDO.Configuration")

        iConf.Load -1    ' CDO Source Defaults
    '    Set Flds = iConf.Fields
    '    With Flds
    '        .Item("") = 2
    '        .Item("") _
    '                       = "YOUR SMTP"
    '        .Item("") = 7461        ' 25
    '        .Item("") = 1
    '        .Item("") = "YOUR ACCT"
    '        .Item("") = "YOURACCTPASS"
    '        .Update
    '    End With

        With iMsg
            Set .Configuration = iConf

            .To = strTo
            If strCC <> "" Then .CC = strCC
            If strBCC <> "" Then .BCC = strBCC
            .From = ""
            .Subject = strSubject
            .TextBody = strbody
            If AttachYN And Attach1 <> "" Then .AddAttachment Attach1
        End With
    End Sub

    Redemption see

    LVL 59

    Accepted Solution

    The CDO is a send reference of course but easy to put my hands on!

    the references for both redemption and CDO are therein, if you think about your preference, (redemption has a cost for commercial use but integrates with outlook whereas CDO is free but does not integrate very well) then I, (or anyone else) will try to help with specifics


    Author Comment

    Thanks for all your help, I hav now managed to Contact the source of the problem E-mails and change it their end.

    Thanks for your time .... the points are yours !

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    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…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now