How would I do that?
I tried code from outlookcode, but it didn't help.
Maybe you can give me a code sample or a site that has a code sample?
here is what I tried:
Dim folderName As String
folderName = Application.ActiveExplorer.CurrentFolder
Set ol = GetObject(, "OUTLOOK.APPLICATION")
Set MAPI = ol.GetNamespace("MAPI")
Set rmafolder = MAPI.folders("Mailbox - Ayelet")
If folderName = "Inbox" Then
Set Folder = rmafolder.folders("Inbox")
act = "In"
Else
If folderName = "Sent Items" Then
Set Folder = rmafolder.folders("Sent Items")
act = "Out"
Else
GoTo Err
End If
End If
For Each mail In Folder.Items
If mail.Body = strEmail Then
Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", False, False
' pass message to CDO
strEntryID = mail.EntryID
strStoreID = mail.Parent.StoreID
Set objCDOMsg = objSession.GetMessage(strEntryID,
strStoreID)
If act = "In" Then
Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", False, False
' pass message to CDO
strEntryID = mail.EntryID
strStoreID = mail.Parent.StoreID
Set objCDOMsg = objSession.GetMessage(strEntryID,
strStoreID)
' get sender address
On Error Resume Next
strAddress = objCDOMsg.Sender.Address
If Err = &H80070005 Then
'handle possible security patch error
MsgBox "The Outlook E-mail and CDO Security Patches
are " & _
"apparently installed on this machine. " & _
"You must response Yes to the prompt about " & _
"accessing e-mail addresses if you want to " & _
"get the From address.", vbExclamation, _
"GetFromAddress"
End If
GetFromAddress = strAddress
Set objCDOMsg = Nothing
objSession.Logoff
Set objSession = Nothing
MsgBox (mail.SenderEmailAddress)
adrs = mail.SenderEmailAddress
GoTo aaa
Else
If act = "Out" Then
Set objReply = objCDOMsg.Reply
On Error Resume Next
Set objRecip = objReply.Recipients.Item(1)
strAddress = objRecip.Address
If strAddress = "" Then
strAddress = objRecip.Name
End If
ElseIf Err = 287 Then
'handle possible security patch error
strAddress = ""
MsgBox "The Outlook E-mail Security Patch is " & _
"apparently installed on this machine. " & _
"You must response Yes to the prompt about " & _
"accessing e-mail addresses if you want to " & _
"get the Reply To address.", vbExclamation, _
"GetReplyToAddress"
End If
GetReplyToAddress = strAddress
MsgBox strAddress
Set objRecip = Nothing
Set objReply = Nothing
GoTo aaa
End If
End If
'how to get actual email address
End If
Next