Reading SMTP address from Exchange Sender mail address
i-ve used tthe following code in outlook 2007 and i worked great!
MsgBox fnGetSMTPAddress("/O=CNPJCO/OU=CLAC/CN=RECIPIENTS/CN=1057003")
Public Function fnGetSMTPAddress(ExchangeMailAddress As String) As String
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(0)
objMailItem.To = ExchangeMailAddress
objMailItem.Recipients.ResolveAll
On Error Resume Next
If objMailItem.Recipients.Item(1).Resolved Then
fnGetSMTPAddress =
objMailItem.Recipients.Item(1).AddressEntry.GetExc hangeUser.PrimarySmtpAddress
If Err.Number 0 Then fnGetSMTPAddress = ExchangeMailAddress
Else
fnGetSMTPAddress = ExchangeMailAddress
End If
Set objMailItem = Nothing
Set objOutlook = Nothing
End Function
I hope it is useful 4 u...
"VebKol" wrote:
Hi
I'm facing problems getting SMTP address from Exchange sender mail address.
- Using Redemption :-)
I have used this line to loop recipients
PrSMTPAddress = &H39FE001E
SMTPAddress =
utils.HrGetOneProp(MailItem.Recipients(t).AddressE ntry.MAPIOBJECT,
PrSMTPAddress)
And everything is working fine.
But when I try to do the following :
PrSMTPAddress = &HC1F001E
SMTPAddress = utils.HrGetOneProp(MailItem.MAPIOBJECT, PrSMTPAddress)
for the Exchange sender, I only get address like this :
/O=server/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=name
for external senders the mail address is ok :-)
Do any one have a clue ?
--
Regards
OD
|