recipient email address is invalid, but resolved property is true

  • Thread starter TWFyayBWSUk
  • Start date Views 3,840
Status
Not open for further replies.
T

TWFyayBWSUk

Greetings

I'm working on some email automation via VBA. (For a variety of reasons, I

can't use the system address book, and keep the email addresses in an Access

table. Long story.) I want to be able to protect against a fat-fingered

address in the table.

What I have so far creates the MailItem, adds a recipient, then uses the

Resolve method to make sure the email address exists in our system. (We have

Exchange servers.)

What is happening is the resolved property is returning True, even if the

address is invalid.

Here's a code extract:

Dim appOutlook As Outlook.Application

Dim nsNameSpace As Outlook.Namespace

Dim miMailItem As Outlook.MailItem

Dim rcpRecipient As Outlook.Recipient

Set appOutlook = CreateObject("Outlook.application")

Set nsNameSpace = appOutlook.GetNamespace("MAPI")

Set miMailItem = appOutlook.CreateItem(olMailItem)

miMailItem.Subject = "some text"

Set rcpRecipient = miMailItem.Recipients.Add("invalid.email@ourcompany.com")

If rcpRecipient.Resolved = True Then

'* OK, continue

Else

'* issue error message and abort

End If

The Resolved property always returns True, I can't trap for an invalid email

address. Should I be doing something differently to detect an invalid

address?

Thanks,

Mark
 
K

Ken Slovak - [MVP - Outlook]

How could Outlook possibly know if that was an invalid address?

If the format of the email address is correct it will resolve. That doesn't

mean that it's an actual email address that you can send to.

I can resolve foobar@foobar.com but that doesn't mean that address actually

exists anywhere.

"Mark VII" <MarkVII> wrote in message

news:4ECA2AA5-7352-43F9-B781-C5ABE2D0605B@microsoft.com...
> Greetings

> I'm working on some email automation via VBA. (For a variety of reasons,
> I
> can't use the system address book, and keep the email addresses in an
> Access
> table. Long story.) I want to be able to protect against a fat-fingered
> address in the table.

> What I have so far creates the MailItem, adds a recipient, then uses the
> Resolve method to make sure the email address exists in our system. (We
> have
> Exchange servers.)

> What is happening is the resolved property is returning True, even if the
> address is invalid.

> Here's a code extract:

> Dim appOutlook As Outlook.Application
> Dim nsNameSpace As Outlook.Namespace
> Dim miMailItem As Outlook.MailItem
> Dim rcpRecipient As Outlook.Recipient

> Set appOutlook = CreateObject("Outlook.application")
> Set nsNameSpace = appOutlook.GetNamespace("MAPI")
> Set miMailItem = appOutlook.CreateItem(olMailItem)
> miMailItem.Subject = "some text"
> Set rcpRecipient =
> miMailItem.Recipients.Add("invalid.email@ourcompany.com")
> If rcpRecipient.Resolved = True Then
> '* OK, continue
> Else
> '* issue error message and abort
> End If

> The Resolved property always returns True, I can't trap for an invalid
> email
> address. Should I be doing something differently to detect an invalid
> address?

> Thanks,
> Mark
 
S

Sue Mosher [MVP]

An SMTP address in the format name@domain.dom is always a valid email

address to Outlook and will always resolve regardless of whether it exists

in any of the user's address lists.

Sue Mosher

"Mark VII" <MarkVII> wrote in message

news:4ECA2AA5-7352-43F9-B781-C5ABE2D0605B@microsoft.com...
> Greetings

> I'm working on some email automation via VBA. (For a variety of reasons,
> I
> can't use the system address book, and keep the email addresses in an
> Access
> table. Long story.) I want to be able to protect against a fat-fingered
> address in the table.

> What I have so far creates the MailItem, adds a recipient, then uses the
> Resolve method to make sure the email address exists in our system. (We
> have
> Exchange servers.)

> What is happening is the resolved property is returning True, even if the
> address is invalid.

> Here's a code extract:

> Dim appOutlook As Outlook.Application
> Dim nsNameSpace As Outlook.Namespace
> Dim miMailItem As Outlook.MailItem
> Dim rcpRecipient As Outlook.Recipient

> Set appOutlook = CreateObject("Outlook.application")
> Set nsNameSpace = appOutlook.GetNamespace("MAPI")
> Set miMailItem = appOutlook.CreateItem(olMailItem)
> miMailItem.Subject = "some text"
> Set rcpRecipient =
> miMailItem.Recipients.Add("invalid.email@ourcompany.com")
> If rcpRecipient.Resolved = True Then
> '* OK, continue
> Else
> '* issue error message and abort
> End If

> The Resolved property always returns True, I can't trap for an invalid
> email
> address. Should I be doing something differently to detect an invalid
> address?

> Thanks,
> Mark
 
T

TWFyayBWSUk

Re: recipient email address is invalid, but resolved property is t

Sue and Ken

Thanks for clarifying. I wasn't sure if an email address in internet format

was actually validated or not.

Mark
 
Status
Not open for further replies.
Top