0

I have to write a custom transport agent in C# for Exchange 2007 that check if sender sending mail belong to a specific distribution list.

My agent works well but all i need to do now is how retrieve members of a distribution list ??

How can i do that ?

Thanks all in advance

1 Answers1

0

Here what i've done in order to check if a user is member of a DL :

RoutingAddress rGroupe = new RoutingAddress("mail of the DL");

foreach (EnvelopeRecipient entry in e.MailItem.Recipients)
{
   RoutingAddress rRecipient = new RoutingAddress(entry.Address.ToString());

   if (addressBook.IsMemberOf(rRecipient, rGroupe))
   {
      // ok
   }
}