How do I manage the error produced by CDO (in classic ASP/VBScript) when a receiver email address is incorrect?
Right now if the email address is incorrect and 8004020e is produced. I understand why the problem occurs but I don't know how to handle it. This function is used to send out quite a lot of emails so I want to avoid
The best thing (I think) would be to if CDO could return some kind of indication that the address is incorrect without causing the entire script to fail. However, suggestions are more than welcome.
dim Mailer, cdoConfig
Set Mailer = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtp
set Mailer.Configuration = cdoConfig
Mailer.To = toEmail
Mailer.From = fromEmail
Mailer.Subject = emailHeader
Mailer.TextBody = emailBody
if err.number>0 then
Set Mailer = Nothing
Set cdoConfig = Nothing