Using Redemption to extract SMTP Addresses

  • Thread starter Thread starter Benjie Legaspi
  • Start date Start date
B

Benjie Legaspi

Can you use Redemption to extract the SMTP addresses of all items in a
recipient list if some are distribution lists? If this is possible,
can you process the recipients (possibly recursively) to handle the
case of distribution lists containing distribution lists?

Thanks for any help,

Benjie Legaspi
Florida Public Service Commission
 
Try something like the following (assuming MailItem points to an existing
Outlook.MailItem object):

PR_SMTP_ADDRESS = &H39FE001E

sub ProcessAddressEntry(AddressEntry)
set Members =AddressEntry.Members
if Members Is Nothing Then
'regular recipient
if AddressEntry.Type = "EX" Then
Debug.Print(AddressEntry.Fields(PR_SMTP_ADDRESS))
Else
Debug.Print(AddressEntry.Address)
End If
Else
'Distribution list
for j = 1 to Members.Count
ProcessAddressEntry(Members.Item(j))
next
End If
end sub

set sItem = CreateObject("Redemption.SafeMailItem")
sItem.Item = MailItem
for i = 1 to sItem.Recipients.Count
set Recip = sItem.Recipients(i)
set AE = Recip.AddressEntry
if not (AE Is Nothing) Then
ProcessAddressEntry(AE)
End If
next



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

Thanks for taking the time to reply. I will try to incorporate your code
into my Outlook project. I honestly did not think it was possible to
process distribution lists recursively. Thanks also for the Redemption
class.

Benjie
 
Back
Top