How to get Exchange Senders SMTP address when in OFFLINE mode

S

Sanjay Singh

I have included some code at the end of this message that I use to get an
Email Sender'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

Code Sample
Public Function SenderEmail(objMsg As MailItem) As String
Dim sItem, PrSenderEmail

Dim strType As String
Dim objSenderAE As Redemption.AddressEntry
Dim objSMail As Redemption.SafeMailItem

Const PR_SENDER_ADDRTYPE = &HC1E001E
Const PR_EMAIL = &H39FE001E

On Error GoTo HandleErr
RedemptionCleanup

Set objSMail = CreateObject("qfRedemption.qfSafeMailItem")
objSMail.Item = objMsg
strType = objSMail.Fields(PR_SENDER_ADDRTYPE)

Set objSenderAE = objSMail.Sender
If Not objSenderAE Is Nothing Then
If strType = "SMTP" Then
SenderEmail = objSenderAE.Address
ElseIf strType = "EX" Then
SenderEmail = objSenderAE.Fields(PR_EMAIL)
End If
End If

ExitHere:
Set objSenderAE = Nothing
Set objSMail = Nothing
RedemptionCleanup
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:04
'ErrorHandler:$$D=10-17-2002 'ErrorHandler:$$T=11:16:04
HandleErr:
Select Case Err.Number
Case Else
'MsgBox "Error " & Err.Number & ": " & Err.Description,
vbCritical, "basGlobals.SenderEmail"
'ErrorHandler:$$N=basGlobals.SenderEmail
MsgBox "E-mail address cannot be resolved. Please check e-mail
address.", vbExclamation, "Invalid E-mail Address"
End Select
GoTo ExitHere
' End Error handling block.
End Function
 

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