Not sure if this is the right section for a CDONTS question but...
I had a webmail CDONTS script working... quite well too I think
I had an error saying mail.to had a type mismatch. I went through the database (it's a web form mailing list for a client) and found what I thought to be bad email addresses. Tried it again and it works fine.
My question, is there anyway to validate the email address? I am assuming that CDONTS wants the text string to be in a certain format. How can I test the data for a valid format, and then throw out that email address if it is not in the expected format?
Here is a function you could use to validate any email address. Then you'd have to check each email address to make sure it passes (returns True) before calling SEND in CDONTS.
Function IsValidMail(sEmail)
Dim objRegExp
Set objRegExp = New RegExp
objRegExp.Pattern = "^[a-z._-]+\@[a-z._-]+\.[a-z]{2,4}$"
objRegExp.IgnoreCase = True
IsMail = objRegExp.Test(sEmail)
End Function
Bookmarks