recipient email address is invalid, but resolved property is true

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.
Similar threads
Thread starter Title Forum Replies Date
B Looking to get the Recipient email address (or even the "friendly name") from an email I am replying to using VBA Outlook VBA and Custom Forms 4
J Signatures that contain recipient's email address Outlook VBA and Custom Forms 7
H How to show recipient email address? Using Outlook 0
J Searh For Recipient Email address Outlook VBA and Custom Forms 1
Diane Poremsky Display the Recipient Email Address in the Sent Items Folder Using Outlook 0
D Outlook VBA to open Excel attachment and send recipient's email address to a workbook cell? Using Outlook 4
J Recipient email address doesn't get underlined Using Outlook 4
M Get recipient's email address Outlook VBA and Custom Forms 10
M Outlook, send to > mail recipient - results in plain text email Using Outlook 1
K Use VBA to find Sender and Recipient from Microsfot 365 Journaled Email Items Outlook VBA and Custom Forms 3
B VBScript doesn't run on Recipient Email Outlook VBA and Custom Forms 2
M ERROR: None of your email accounts could send to this recipient Using Outlook 2
E Send a Reminder/Task to certain Email Recipient Using Outlook 5
E Automatically pick up Recipient's Name on the Body of the Email Message Using Outlook 1
Aussie Looking for Outlook macro to Copy Recipient Names into Email Body Outlook VBA and Custom Forms 3
G Published Email Form Doesn't Display Text Boxes to the Recipient Using Outlook 0
R OL10 - Send To "Mail Recipient" doesn't go to default email account Using Outlook 23
M form or template associated to a specific email recipient Outlook VBA and Custom Forms 3
C Automatically Insert Recipient Name from To Field Outlook VBA and Custom Forms 4
T "Words In Recipient's Address" Rule Causes Outlook To Stop Processing Rules Using Outlook 3
N Custom Form Controls Not Visible To Recipient Outlook VBA and Custom Forms 3
Daniel Schunk User-defined form arrives empty at the recipient Using Outlook 3
D Moving Emails Based on Recipient/Sender Outlook VBA and Custom Forms 4
broadbander Needing help with reply/reply all while keeping attachments and adding a new CC recipient. Outlook VBA and Custom Forms 5
L Automatically Insert Recipient Name from To Field Outlook VBA and Custom Forms 33
M recipient cache? Using Outlook 2
N Importing Google contacts from CSV file removes recipient names in autocomplete list Using Outlook 0
R OL2010 - Send to Mail Recipient going to wrong account Using Outlook 1
A Extracting only one recipient from Msgitem.To Outlook VBA and Custom Forms 7
E Meeting reminders are set for the recipient Exchange Server Administration 9
B Recipient of a forwared message getting multiple emails Using Outlook 2
L Outlook underlining all text after being sent to recipient Using Outlook 3
W Change Template Recipient Automatically - Outlook 2007 Using Outlook 5
L Contact Form - Recipient Control Field Using Outlook 2
F Seeing the recipient in sent emails Using Outlook 1
J 2010 appointment for recipient shows as mail Using Outlook 3
K TextBox on Custom Form Page :: Passing value from sender to the recipient Outlook VBA and Custom Forms 1
K Recipient's name replaced by open and closed brackets! Using Outlook 2
R POP3 Mail repeating while sending to group of recipient Using Outlook 1
J Outlook messagebox with name recipient Using Outlook 1
M Including a Public Calendar as a Meeting Recipient Using Outlook 3
N Reply from recipient Using Outlook 5
A 5.7.1 Recipient not authorized, your IP has been found on a block list Using Outlook 1
S Meeting Requests - ex-employee being invite, but not in recipient list Exchange Server Administration 3
M Changing Outlook Account Based on Recipient Using Outlook 15
S use the custom form to show meeting request in recipient's calendar Outlook VBA and Custom Forms 1
S Adding a mail address/recipient type field to a form Outlook VBA and Custom Forms 1
E recipient control or suggest name Outlook VBA and Custom Forms 1
J Problems with Outlook.Recipient.Resolve Outlook VBA and Custom Forms 3
G Confirm Each Recipient in a New Outlook Mail Before it is Sent Outlook VBA and Custom Forms 4

Similar threads

Top