Confirming that a message has been sent via CreateObject("CDO.Message")...

I know I can set up a CC or BCC value (CC/BCC the person who needs to know) to truly confirm that an email has been sent, but besides that, is there code I could add after the Send function that would display a confirmation message stating that Send worked?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You mean, other than just showing a confirmation page like this?

...mail code
...mail code
...mail code

response.redirect "confirmSent.asp"


This, obviously, redirects the user to a confirmation page directly after the object's send method is called.  Of course, you should do object cleanup, etc. for the mail object, etc., before you redirect...but I think you get the point.


This should work

' Create your mail object myMail
' set up values

    err.clear                           ' clear any errors
    On Error Resume Next       ' skip errors
    myMail.Send                     ' try the send

    IF Err <> 0 THEN            
       response.write "success"
       response.write "fail"
    END IF

    Set myMail = nothing



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Len, just curious:

Will this work?
IF Err <> 0 THEN

or do you need to specify Err.num, like this (i.e., maybe both work; just not sure if "num" is the default property of the error object)?
IF Err.num <> 0 THEN

Just curious.  Definitely better than my solution: "Redirect whether it worked or not..."  :-)
Hi Phil

yep number is the default

but in fact  Err = 0 would be a success.... its a bit late it the day :)
lol, it is indeed!

Len, thx for the good info re: the default property for the error object...obviously, I never knew it (I've always just used err.number).

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.