Borje Posted February 6, 2009 Posted February 6, 2009 (edited) Hello everybody I would ask if somebody can help me with this little script, what I want is if I send a mail and the mail is not send out what to do to have some error checking on the mail is sent out or not send out. I can not find any info about that. I need some error check to leave a message is sent or message is not sent.. What is the errorcode to do this? Code: / $objMessage = ObjCreate("CDO.Message") $objMessage.From = "Aktivate@info.com" $objMessage.To = "Your mail@.com" $objMessage.Subject = "Test message" $objMessage.TextBody ="Hello world" $objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail1.telia.com" $objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 $objMessage.Configuration.Fields.Update $objMessage.Send msgbox(4096,"", "The message is sent") / Edited February 6, 2009 by Borje
Zedna Posted February 6, 2009 Posted February 6, 2009 1) CDO.Message doesn't work on Win9x systems 2) use Error Handler Global $oMyError = ObjEvent ("AutoIt.Error", "ErrorHandler") Func ErrorHandler() $HexNumber = Hex($oMyError.number, 8) MsgBox(16, "CHYBA", "Při odesílání emailu došlo k chybě!" & @CRLF & @CRLF & _ "Popis chyby: " & @TAB & $oMyError.description & @CRLF & _ "Win. popis:" & @TAB & $oMyError.windescription & @CRLF & _ "Číslo řádku: " & @TAB & $oMyError.scriptline & @CRLF & _ "Číslo chyby: " & @TAB & $HexNumber & @CRLF & _ "Objekt: " & @TAB & $oMyError.source) SetError(1) EndFunc 3) check @error after ObjCreate() $objMessage = ObjCreate ("CDO.Message") If @error Then ... Resources UDF ResourcesEx UDF AutoIt Forum Search
Borje Posted February 6, 2009 Author Posted February 6, 2009 Thank you Zedna I have test this but must ask the errorhandler is that in the beginning of the script? I want with error that display the message is not sent, and with no error that display message is sent.
trancexx Posted February 6, 2009 Posted February 6, 2009 Lovely language Zedna. @Borje, just use your brains. ♡♡♡ . eMyvnE
Zedna Posted February 6, 2009 Posted February 6, 2009 Thank you ZednaI have test this but must ask the errorhandler is that in the beginning of the script?I want with error that display the message is not sent, and with no error that display message is sent.You may set-up some helper globar variable $com_error = True and test it in your main script. Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted February 6, 2009 Posted February 6, 2009 Lovely language Zedna.I just copied it (without translation) from one of my projetcs (in Czech language). Resources UDF ResourcesEx UDF AutoIt Forum Search
Borje Posted February 6, 2009 Author Posted February 6, 2009 Thank you Zedna I have that to work now after some tests thanks again.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now