Problem with the Contacts

  • Thread starter Thread starter G.V.Reddy
  • Start date Start date
G

G.V.Reddy

Hi,

I'm new to VBA and Outlook. My requirement is as follows:

I would like to monitor the each email ID before sending out any email, so
the emails should not be sent to other than our domain say "@xyz.com". I've
written a script in which I could access the To, CC, and BCC fields with the
Item object. I could split the email IDs using ";" as delimiter and checked
each email ID whether it is ending with "@xyz.com" or not. But as some email
IDs are entered from Contacts, the Item object displays the "Email Name"
rather email ID for that contact. Can anybody please help me how to find out
the email ID associated with the Contact displayed in the To, CC or BCC
fields?

Thanks in advance.

Venkat
 
Am Tue, 6 Sep 2005 15:31:31 +0530 schrieb G.V.Reddy:

Venkat, you´re talking about e-mail addresses, not IDs. Please have a look
at the Recipients collection. Each Recipient object has an Address property.
 
Dear Michael,

Thanks a lot for your help. Can you please provide me sample code to parse
through the Recipients collection.

Best regards,
Venkat
 
Am Tue, 6 Sep 2005 16:27:05 +0530 schrieb G.V.Reddy:

Dim sAdr as string
Dim lAdr as Long
Dim oRecip as Outlook.Recipient
sAdr=LCase$("@yourDomain.com")
lAdr=Len(sAdr)
For Each oRecip in YourMailItem.Recipients
If LCase$(Right$(oRecip.Address,lAdr))<>sAdr Then
' do something with the wrong address
Endif
Next
 
Back
Top