B
BillB
I have Outlook 2000 sp3 and Access 2000 sp3 and Windows XP sp1. I am able
to create email messages and send them from Access, however I want to see if
the recipient's email address is valid [on the GAL] before I send the email.
I want to store the bad email addresses in a table for correction later.
I would have expected my "myRecipient.Resolved" to display a MsgBox but
Access continues and sends to the bad email address.
Sub Test2()
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem
Dim myRecipient As Outlook.Recipient
Dim myRecipients As Outlook.Recipients
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipients = myItem.Recipients
myRecipients.Add ("(e-mail address removed)")
myItem.Body = "Hello " & vbCrLf & "World"
myItem.Importance = olImportanceNormal
For Each myRecipient In myRecipients
myRecipient.Resolve
If Not myRecipient.Resolved Then
MsgBox myRecipient.Name
Else
myItem.Send
End If
Next
Set myOlApp = Nothing
End Sub
Thanks in advance.
Bill
to create email messages and send them from Access, however I want to see if
the recipient's email address is valid [on the GAL] before I send the email.
I want to store the bad email addresses in a table for correction later.
I would have expected my "myRecipient.Resolved" to display a MsgBox but
Access continues and sends to the bad email address.
Sub Test2()
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem
Dim myRecipient As Outlook.Recipient
Dim myRecipients As Outlook.Recipients
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipients = myItem.Recipients
myRecipients.Add ("(e-mail address removed)")
myItem.Body = "Hello " & vbCrLf & "World"
myItem.Importance = olImportanceNormal
For Each myRecipient In myRecipients
myRecipient.Resolve
If Not myRecipient.Resolved Then
MsgBox myRecipient.Name
Else
myItem.Send
End If
Next
Set myOlApp = Nothing
End Sub
Thanks in advance.
Bill