How to get header information of recieved letter in outlook express 
Author Message
 How to get header information of recieved letter in outlook express

Here is a function that I've used to report spam.  The part that you
may be able to use is the retrieving of the headers.  As far as I've
been able to tell, these are not exposed by the Outlook Object model,
so you have to use CDO to get at them with the message ID.

Hope this helps,
Troy

Const CdoPR_TRANSPORT_MESSAGE_HEADERS = &H7D001E

Sub ReportSpam

    Dim oApp As Outlook.Application
    Dim oExplorer As Explorer
    Dim oExplorers As Explorer
    Dim oInspector As Inspector
    Dim oMailItem As MailItem
    Dim oBodyFormat As Outlook.OlBodyFormat
    Dim sEntryID As String

    Set oApp = Application
    Set oExplorer = oApp.ActiveExplorer

    If TypeName(oExplorer) <> "nothing" Then

        Set oMailItem = oExplorer.Selection.Item(1)

        oBodyFormat = oMailItem.BodyFormat
        sBody = oMailItem.Body
        sEntryID = oMailItem.EntryID

        'Need to use CDO session to get the internet headers
        Set oSession = CreateObject("Mapi.Session")
        oSession.Logon "", "", False, False

        'Get the open email message
        Set oMessage = oSession.GetMessage(sEntryID)

        sHeaders = oMessage.Fields(CdoPR_TRANSPORT_MESSAGE_HEADERS)

        oMailItem.Forward

        oMailItem.Body = sHeaders & vbCrLf & sBody

        oMailItem.Send

    End If

    End Sub

End Sub

On Sat, 26 Oct 2002 00:44:39 -0700, "Jo-hsien Teng"

Quote:

>My friend want tracking mail forwarded by her ( the mail
>is forwarded to the company sales ) .

>How could I make a button on the outlook express toolsbar,
>the button help her get mail header info , analyzing
>header and message body , then store all the info. to
>access db or excel file ??

>What doc. or knowledge shoud i know about above case !!



Tue, 24 May 2005 03:37:21 GMT  
 How to get header information of recieved letter in outlook express
Troy,

Do you have any thoughts on how to make this work for .NET under Win2K (pick
a language, I'll adapt ;-) )? The CreateObject("Mapi.Session") doesn't
appear to be supported anymore.

Thanks,

Randy


| Here is a function that I've used to report spam.  The part that you
| may be able to use is the retrieving of the headers.  As far as I've
| been able to tell, these are not exposed by the Outlook Object model,
| so you have to use CDO to get at them with the message ID.
|
| Hope this helps,
| Troy
|
| Const CdoPR_TRANSPORT_MESSAGE_HEADERS = &H7D001E
|
| Sub ReportSpam
|
|     Dim oApp As Outlook.Application
|     Dim oExplorer As Explorer
|     Dim oExplorers As Explorer
|     Dim oInspector As Inspector
|     Dim oMailItem As MailItem
|     Dim oBodyFormat As Outlook.OlBodyFormat
|     Dim sEntryID As String
|
|     Set oApp = Application
|     Set oExplorer = oApp.ActiveExplorer
|
|     If TypeName(oExplorer) <> "nothing" Then
|
|         Set oMailItem = oExplorer.Selection.Item(1)
|
|         oBodyFormat = oMailItem.BodyFormat
|         sBody = oMailItem.Body
|         sEntryID = oMailItem.EntryID
|
|         'Need to use CDO session to get the internet headers
|         Set oSession = CreateObject("Mapi.Session")
|         oSession.Logon "", "", False, False
|
|         'Get the open email message
|         Set oMessage = oSession.GetMessage(sEntryID)
|
|         sHeaders = oMessage.Fields(CdoPR_TRANSPORT_MESSAGE_HEADERS)
|
|         oMailItem.Forward
|
|         oMailItem.Body = sHeaders & vbCrLf & sBody

|         oMailItem.Send
|
|
|
|     End If
|
|     End Sub
|
|
|
| End Sub
|
| On Sat, 26 Oct 2002 00:44:39 -0700, "Jo-hsien Teng"
|
| >My friend want tracking mail forwarded by her ( the mail
| >is forwarded to the company sales ) .
| >
| >How could I make a button on the outlook express toolsbar,
| >the button help her get mail header info , analyzing
| >header and message body , then store all the info. to
| >access db or excel file ??
| >
| >What doc. or knowledge shoud i know about above case !!
| >
| >
| >
|



Fri, 17 Jun 2005 08:53:42 GMT  
 How to get header information of recieved letter in outlook express

I've banged my head against this too long now.  I've seen countless messages
saying to simply use CDO.  When I tried it,. I always get errors on
"MAPI.Session".  I think I've recently learned that CDO is only available in
"Corporate/Workgroup" mode, not "Internet-Mail Only" mode.

Can someone confirm this? And if this is the case, how is someone supposed
to access the headers in IMO mode?

Regards,
Brian.


Quote:
> Here is a function that I've used to report spam.  The part that you
> may be able to use is the retrieving of the headers.  As far as I've
> been able to tell, these are not exposed by the Outlook Object model,
> so you have to use CDO to get at them with the message ID.

> Hope this helps,
> Troy

> Const CdoPR_TRANSPORT_MESSAGE_HEADERS = &H7D001E

> Sub ReportSpam

>     Dim oApp As Outlook.Application
>     Dim oExplorer As Explorer
>     Dim oExplorers As Explorer
>     Dim oInspector As Inspector
>     Dim oMailItem As MailItem
>     Dim oBodyFormat As Outlook.OlBodyFormat
>     Dim sEntryID As String

>     Set oApp = Application
>     Set oExplorer = oApp.ActiveExplorer

>     If TypeName(oExplorer) <> "nothing" Then

>         Set oMailItem = oExplorer.Selection.Item(1)

>         oBodyFormat = oMailItem.BodyFormat
>         sBody = oMailItem.Body
>         sEntryID = oMailItem.EntryID

>         'Need to use CDO session to get the internet headers
>         Set oSession = CreateObject("Mapi.Session")
>         oSession.Logon "", "", False, False

>         'Get the open email message
>         Set oMessage = oSession.GetMessage(sEntryID)

>         sHeaders = oMessage.Fields(CdoPR_TRANSPORT_MESSAGE_HEADERS)

>         oMailItem.Forward

>         oMailItem.Body = sHeaders & vbCrLf & sBody

>         oMailItem.Send

>     End If

>     End Sub

> End Sub

> On Sat, 26 Oct 2002 00:44:39 -0700, "Jo-hsien Teng"

> >My friend want tracking mail forwarded by her ( the mail
> >is forwarded to the company sales ) .

> >How could I make a button on the outlook express toolsbar,
> >the button help her get mail header info , analyzing
> >header and message body , then store all the info. to
> >access db or excel file ??

> >What doc. or knowledge shoud i know about above case !!



Mon, 11 Jul 2005 18:45:38 GMT  
 How to get header information of recieved letter in outlook express

CDO is officially unsupported in IMO mode, but should work just fine for the purpose of getting headers.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm


Quote:
> I've banged my head against this too long now.  I've seen countless messages
> saying to simply use CDO.  When I tried it,. I always get errors on
> "MAPI.Session".  I think I've recently learned that CDO is only available in
> "Corporate/Workgroup" mode, not "Internet-Mail Only" mode.

> Can someone confirm this? And if this is the case, how is someone supposed
> to access the headers in IMO mode?



Mon, 11 Jul 2005 20:59:34 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Need Information - Explorer Bar like in Windows Explorer/Outlook Express

2. Getting Internet headers from Outlook via VBA

3. Outlook Security prohibits me from getting SMTP headers cleanly

4. datagrid updatecommand event args does not recieve updated information

5. Recieve information from scanner

6. cannot connect outlook to email server, but can connect outlook express

7. Inserting icons onto Outlook and Outlook Express

8. Outlook - or outlook Express

9. Programming outlook/outlook express from code

10. Outlook - Outlook Express

11. Outlook and Outlook Express...

 

 
Powered by phpBB® Forum Software