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?
scottie_24Asked:
Who is Participating?
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.

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

<%
...mail code
...mail code
...mail code
objMail.send

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.

Regards,
peh803
0
lengreenCommented:
Hi

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"
    ELSE
       response.write "fail"
    END IF

    Set myMail = nothing

cheers

Len
0

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
peh803Commented:
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..."  :-)
0
lengreenCommented:
Hi Phil

yep number is the default

but in fact  Err = 0 would be a success.... its a bit late it the day :)
0
peh803Commented:
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).

peh803
0
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
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.