I have a routine set up that allows the email addresses contained in a query to be used as the source for an “E-mail Blast”. The routine works perfectly as long as all the email addresses are valid. I’m parsing the email addresses to look for obvious problems, but sometimes they get rejected by Outlook. When this happens, none of the remaining addresses get taken by Outlook, and out of 50 potential recipients, maybe 12 receive the intended email. How can I trap this error from Outlook and have it continue to process the remaining email addresses? I’d also like to generate a list of these invalid email addresses so the user can go back and correct them after.
To create the list of email addresses, I’m concatenating them (separated by semi-colons) from the query and using the resulting string as the msg.bcc (see below). I’m doing this to ensure we only send mail to 50 recipients at a time which is a restriction placed by the ISP.
Here’s the code I’m using to send the mail. The email addresses are contained in the variable strMailto which is generated earlier.
Set Msg = appOutlook.CreateItem(olMailItem)
With Msg
.BCC = strMailto
If Not IsNull(Me.txtcc) Then .BCC = strMailto & “;” & Me.txtcc
.Subject = strSubject
.Body = Me.txtBody
.Attachments.Add (Me.txtFileName)
.Send
End With