How do email someone whose name appears twice

aziz rasul

Active member
Local time
Today, 23:01
Joined
Jun 26, 2000
Messages
1,935
I have some code that uses the Outlook object to send an email to multiple people. However I have an individual (call him Joe Public) whose name appears twice in the contact list.

How do I select the correct Joe Public in the code?

When I manually send the email, I have no problem as when I enter Joe Public's name a tag description also appears e.g.

Public, Joe <public61>

This is the code I use for the names

strTo = "Public,Joe;Cooper,Peter;Jones,Avril"
 
I have some code that uses the Outlook object to send an email to multiple people. However I have an individual (call him Joe Public) whose name appears twice in the contact list.
What contact list - A Global Address book with Exchange and LDAP? I assume yes so does Joe Pulic in this list also have a SMTP / X400 and X500 address?


strTo = "Public,Joe;Cooper,Peter;Jones,Avril"
This looks to me like you are relying on the "list" that outlook uses to resolve names for you with exchange. This list can be deleted or changed. Further whilst you have him twice in your "list" others might not have him at all.
 
Yes it's the Global address book and when looking at the properties of Joe Public there is data on X400 and X500.

Every employee uses the same address book so I would have thought they all have the same contacts.
 
Yes it's the Global address book and when looking at the properties of Joe Public there is data on X400 and X500.

Every employee uses the same address book so I would have thought they all have the same contacts.
So the only way to make sure that you only write to the right Joe you have to use his SMTP (for example) address.

The other way is to use a name and get a recipient and then resolve it, but this will bring you an error if there are more than one.
 
So how do I obtain the SMTP address using VBA code?
 
So how do I obtain the SMTP address using VBA code?
That depends on from which direction your are coming. I always have email addresses in my database to avoid this problem.

http://support.microsoft.com/kb/324530

Here is one example above.

Otherwise you are going to need to work with the address book and recipients of Outlook VBA - which I am not that familiar with.
 
I managed to get the SMTP email address by looking at the properties of the recipient. I have changed the code to suit and it is scheduled to run next Monday so I will see if it runs OK.
 
how about sharing your code. Especially how you resolve a name which could have 2 possible results to one person. I would be interested in this.
 
Why not? The SMTP addresses are unique to people who have the same name.
 

Users who are viewing this thread

Back
Top Bottom