Get RECIPIENTS SMTP Address when OFFLINE from Exchange Server

S

Sanjay Singh

This is different from my previous post. This time I need the recipients
SMTP address.

I have included some code at the end of this message that I use to get an
Email Recipient's Email address. I convert Exchange addresses to SMTP
addresses
and it works perfectly EXCEPT if the user is using Outlook offline form the
Exchange Server.

My question: What do I need to do to get the correct SMTP address for
Exchange users even when I am offline?

Thanks in advance
Sanjay


Public Function RecipientEmail(oItem As MailItem, Optional boolMsg = True)
As String

Dim strType As String
Dim oSafeRec As Redemption.AddressEntry
Dim oSafeMail As Redemption.SafeMailItem

On Error GoTo HandleErr
'On Error Resume Next
RedemptionCleanup

Set oSafeMail = CreateObject("qfRedemption.qfSafeMailItem")
oSafeMail.Item = oItem
Set oSafeRec = oSafeMail.Recipients(1).AddressEntry
strType = oSafeRec.Type
If strType = "EX" Then
RecipientEmail = oSafeRec.Fields(&H39FE001E)
ElseIf strType = "SMTP" Then
RecipientEmail = oSafeRec.Address
End If

Set oSafeMail = Nothing
Set oSafeRec = Nothing

RedemptionCleanup
ExitHere:
Exit Function

' Error handling block added by Error Handler Add-In. DO NOT EDIT this block
of code.
' Automatic error handler last updated at 10-17-2002 11:16:21
'ErrorHandler:$$D=10-17-2002 'ErrorHandler:$$T=11:16:21
HandleErr:
Select Case Err.Number
Case Else
'MsgBox "Error " & Err.Number & ": " & Err.Description,
vbCritical, "basGlobals.RecipientEmail"
'ErrorHandler:$$N=basGlobals.RecipientEmail
If boolMsg Then
MsgBox "E-mail address cannot be resolved. Please check
e-mail address.", vbExclamation, "Invalid E-mail Address"
End If
End Select
RedemptionCleanup
' End Error handling block.
End Function
 
D

Dmitry Streblechenko

0x39FE001E is not available offline. Read PR_EMS_AB_PROXY_ADDRESSES
(0x800F101E) instead from AddressEntry. This property is a multivalued
string property (PT_MV_STRING8), Redemption will return a variant array of
strings. Look for an entry with the "SMTP:" prefix (note the caps), it will
be the default SMTP address.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
D

Dmitry Streblechenko

Set oSafeMail = CreateObject("qfRedemption.qfSafeMailItem")
oSafeMail.Item = oItem
Set oSafeRec = oSafeMail.Recipients(1).AddressEntry
strType = oSafeRec.Type
If strType = "EX" Then
Addresses = oSafeRec.Fields(&H800F101E)
for i = LBound(Addresses) to UBound(Addresses)
if Left(Addresses(i), 5) = "SMTP:" Then
RecipientEmail = Right(Addresses(i), Len(Addresses(i))-5)
End If
next
ElseIf strType = "SMTP" Then
RecipientEmail = oSafeRec.Address
End If


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top