[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

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?
0
scottie_24
Asked:
scottie_24
  • 3
  • 2
1 Solution
 
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
 
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now