Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO with one bad email

Status
Not open for further replies.

tc3596

Technical User
Mar 16, 2001
283
0
0
I am using CDO via ASP to send out to multiple "To" receipients. This is working fine. However, if one of those emails is invalid, nothing gets sent out. ASPMAIL could be trapped for this or it send out all by that one bad one. Can cdo.nessage do this?

Thanks.
 
of course it would help if your program only accepts valid email adresses!
i put all the "to" addresses in an array, and send them one by one. an "on error resume next" makes sure the program continues.
 
I've used the code here to validate email addresses:
Source:
Code:
'-----------------------------------------------
'CHECK IS VALID EMAIL ADDRESS FORMAT
'-----------------------------------------------

Function CheckIsEmail(strEmailAddress)

Dim regEx, retVal
Set regEx = New RegExp
'# note the regex below must be on one single line
'# it is shown wrapped on this web page
regEx.Pattern ="^(([^<>()[\]\\.,;:\s@""]+(\.[^<>()[\]\\.,;:\s@""]+)*)|("".+""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$"
regEx.IgnoreCase = true
blnReturnValue = regEx.Test(strEmailAddress)
CheckIsEmail = blnReturnValue
End Function
 
Thanks for the responses. In the case of the bad email, the user was removed from the email server. Anyway, to validate that email is on server?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top