|
Function R_GetSenderAddress(objMsg)
Dim strType
Dim objSenderAE ' Redemption.AddressEntry
Dim objSMail ' Redemption.SafeMailItem
Dim rrecip As Redemption.SafeRecipient
Const PR_SENDER_ADDRTYPE = &HC1E001E
Const PR_EMAIL = &H39FE001E
Const PR_SENT_REPRESENTING_EMAIL_ADDRESS = &H65001E
Const PR_SENDER_EMAIL_ADDRESS = &HC1E001E
Const PR_SENT_REPRESENTING_NAME = &H42001E
Const PR_ACCOUNT = &H3A00001E ' alias
Const PR_GIVEN_NAME = &H3A06001E ' given name
Const PR_SURNAME = &H3A11001E ' surname
Const PR_TITLE = &H3A17001E ' title
Const PR_DISPLAY_NAME = &H3001001E ' display name
Const PR_EMAIL_ADDRESS = &H3003001E
Set objSMail = CreateObject("Redemption.SafeMailItem")
objSMail.Item = objMsg
strType = objSMail.Fields(PR_SENDER_ADDRTYPE)
Set objSenderAE = objSMail.Sender
If Not objSenderAE Is Nothing Then
If strType = "SMTP" Then
R_GetSenderAddress = objSenderAE.Address
ElseIf strType = "EX" Then
R_GetSenderAddress = objSenderAE.Fields(PR_EMAIL)
End If
End If
Set rrecip = objSMail.Recipients(2)
Dim rae As Redemption.AddressEntry
Dim count As Integer
Dim first As String
Dim last As String
Dim alias As String
Dim title As String
Dim display As String
Dim emailadd As String
If rrecip.DisplayType = olUser Then
' is it an Exchange user?
Set rae = rrecip.AddressEntry
If rae.Type = "EX" Then
alias = rae.Fields(PR_ACCOUNT)
display = rae.Fields(PR_DISPLAY_NAME)
first = rae.Fields(PR_GIVEN_NAME)
last = rae.Fields(PR_SURNAME)
title = rae.Fields(PR_TITLE)
emailadd = rae.Fields(PR_EMAIL)
'Debug.Print alias, display, first, last, title
Debug.Print emailadd
End If
End If
Set objSenderAE = Nothing
Set objSMail = Nothing
End Function |
|