Tjalve Posted April 16, 2013 Share Posted April 16, 2013 Are you reffering to:Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")if so, then I run thes line just befor i call the sendmail function. Or is there somthing else that i need to "enable"? Link to comment Share on other sites More sharing options...
water Posted April 16, 2013 Share Posted April 16, 2013 That's exactly what I refer to. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Tjalve Posted April 16, 2013 Share Posted April 16, 2013 Well. Since i have the linem and I still get the error, i would guess that im doing something wrong Link to comment Share on other sites More sharing options...
Ilounah Posted April 16, 2013 Share Posted April 16, 2013 I gots a small problem... I made a simple GUI for the SMTP script. When I run it, it goes into a loop and sends the email over and over again. Other than that it works beautifully. Can anyone see the problem ? expandcollapse popup#include <GUIConstants.au3> #Include<file.au3> Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $MyEmail = GUICreate("My eMail Program", 290, 450) GUICtrlCreateLabel("From", 16, 16, 31, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("Address", 16, 40, 49, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("To", 16, 64, 19, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("Subject", 16, 136, 47, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("Body", 16, 184, 32, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("Attachments", 16, 160, 74, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("CC", 16, 88, 20, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("BCC", 16, 112, 28, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $FromName = GUICtrlCreateInput("", 96, 16, 185, 21) $FromAddress = GUICtrlCreateInput("", 96, 40, 185, 21) $ToAddress = GUICtrlCreateInput("", 96, 64, 185, 21) $CcAddress = GUICtrlCreateInput("", 96, 88, 185, 21) $BccAddress = GUICtrlCreateInput("", 96, 112, 185, 21) $Subject = GUICtrlCreateInput("", 96, 136, 185, 21) $Body = GUICtrlCreateEdit("", 96, 184, 185, 113) $AttachFiles = GUICtrlCreateInput("", 96, 160, 185, 21) $Send = GUICtrlCreateButton("Send", 8, 416, 75, 25, 0) $Reset = GUICtrlCreateButton("Reset", 112, 416, 75, 25, 0) $Exit = GUICtrlCreateButton("Exit", 208, 416, 75, 25, 0) GUICtrlCreateGroup("", 8, 304, 273, 105) GUICtrlCreateLabel("SMTP Server", 19, 328, 68, 17) GUICtrlCreateLabel("User ID", 19, 352, 40, 17) GUICtrlCreateLabel("Password", 19, 376, 50, 17) $SmtpServer = GUICtrlCreateInput("", 90, 325, 180, 21) $Username = GUICtrlCreateInput("", 90, 349, 180, 21) $Password = GUICtrlCreateInput("", 90, 373, 180, 21) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Send $Send = _INetSmtpMailCom(GUICtrlRead($SmtpServer), GUICtrlRead($FromName), GUICtrlRead($FromAddress), GUICtrlRead($ToAddress), GUICtrlRead($Subject), GUICtrlRead($Body), GUICtrlRead($AttachFiles), GUICtrlRead($CcAddress), GUICtrlRead($BccAddress), GUICtrlRead($Username), GUICtrlRead($Password)) Case $Reset ;;; Case $Exit Exit EndSwitch WEnd If @error then msgbox(0,"Error sending message","Error code: " & @error & " Description: " & $Send) EndIf Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "",$IPPort=25, $ssl=0) $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x]) If FileExists($S_Files2Attach[$x]) Then $objEmail.AddAttachment ($S_Files2Attach[$x]) Else $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x] SetError(1) return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf If $Ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Sent the Message $objEmail.Send if @error then SetError(2) return $oMyRet[1] EndIf EndFunc ;==>_INetSmtpMailCom ; Com Error Handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description,3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc Good day sir I like your script, but like what you said it keeps on loop im still newbie and I dont know how do fix the Case $Send $Send = _INetSmtpMailCom( if you can help me or update your code it is very helpful thanks Link to comment Share on other sites More sharing options...
BrewManNH Posted April 16, 2013 Share Posted April 16, 2013 Dont use the same variable name for the control and the variable that holds the return value of the function, that's why it's looping. Change "$Send = _INetSmtpMailCom(" to something like this "$SendReturn = _INetSmtpMailCom(" If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
water Posted April 16, 2013 Share Posted April 16, 2013 Add the lineGlobal $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")at the top of your script to make sure the COM error triggers the COM error handler. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Tjalve Posted April 16, 2013 Share Posted April 16, 2013 Hmm. Ok it seems that i got the com handler to run, but i get this message $oMyRet[0] = $HexNumber $oMyRet^ ERROR ; Com Error Handler for MAIL Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted April 16, 2013 Author Developers Share Posted April 16, 2013 Hmm. Ok it seems that i got the com handler to run, but i get this message $oMyRet[0] = $HexNumber $oMyRet^ ERROR Please study the original example in the first post. You need to define that array at the start, like the Com Errorhandler. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Tjalve Posted April 16, 2013 Share Posted April 16, 2013 My bad... Of cource. Thank you. It works fine now! Link to comment Share on other sites More sharing options...
Phonix001 Posted May 11, 2013 Share Posted May 11, 2013 The code doesn´t work for me. There is an error at line 66: Missing separator character after keyword. Link to comment Share on other sites More sharing options...
water Posted May 11, 2013 Share Posted May 11, 2013 Can you please post the relevant line? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Phonix001 Posted May 11, 2013 Share Posted May 11, 2013 $objEmail.Configuration.Fields.Item ("<a href='http://schemas.microsoft.com/cdo/configuration/sendusing' class='bbc_url' title='External link' rel='nofollow external'>http://schemas.microsoft.com/cdo/configuration/sendusing"</a>) = 2 If I compile it to a exe with the beta, it says: Line 474. Error: Error parsing function call. Link to comment Share on other sites More sharing options...
water Posted May 11, 2013 Share Posted May 11, 2013 The line should read: $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 I assume that this code change is caused by the forum upgrade a few days ago. So remove all "<a href ....>" and "</a>" and you should be fine again. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Developers Jos Posted May 11, 2013 Author Developers Share Posted May 11, 2013 Just did an Edit & Save which seems to fix the code back to what it should be. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Phonix001 Posted May 11, 2013 Share Posted May 11, 2013 So ther is no compile error anymore, just the normally error-codes. Pretty useless scipt, I have tried with yahoo, gmx and gmail. No chance to send an email Link to comment Share on other sites More sharing options...
Developers Jos Posted May 11, 2013 Author Developers Share Posted May 11, 2013 So ther is no compile error anymore, just the normally error-codes. Pretty useless scipt, I have tried with yahoo, gmx and gmail. No chance to send an email Yea right ... I am generally know to post shit in these forums. Anyway, when you want help you have to share information, but the UDF works so that means to me you are doing something wrong. Jos BrewManNH 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
a200 Posted May 15, 2013 Share Posted May 15, 2013 I just wanted to thank whoever created this script. I have been trying to find a simple way to email the backup log results from a remote office. I just start the executable I compiled at the end of the backup batch file and the logs are in my Inbox within minutes. The script worked right out of the box...error free. Life is good. Thanks again. Link to comment Share on other sites More sharing options...
water Posted May 15, 2013 Share Posted May 15, 2013 That's easy: Thank Jos My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mesale0077 Posted May 16, 2013 Share Posted May 16, 2013 ı find stmp setting Server address: smtp.live.comPort: 25 (or 25 prevented 587) Authentication: YesTLS or SSL Secure Encrypted Connection: Yes look http://windows.microsoft.com/en-in/windows/outlook/send-receive-from-app Link to comment Share on other sites More sharing options...
DeltaRocked Posted May 17, 2013 Share Posted May 17, 2013 Hi Jos, I hope you find this useful. $objEmail.BodyPart.Charset = "utf-8" $objEmail.HTMLBodyPart.Charset = "utf-8" When we want to process emails with specific character encodings or let us say - you have already converted the charset to UTF-8 and want to send an email then this is the solution. I had some chinese GB2312 mails and was facing problems with setting the charset for these emails. If you can add encoding support to the present UDF then it would be great. Regards Deltarocked. Link to comment Share on other sites More sharing options...
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