fuzzie Posted December 6, 2014 Share Posted December 6, 2014 Yes, a comma worked for me. Link to comment Share on other sites More sharing options...
jazzyjeff Posted December 12, 2014 Share Posted December 12, 2014 (edited) I am trying to have my app send me an email, but I keep receiving this error message: ### COM Error ! Number: 80020009 ScriptLine: 293 Description:At least one recipient is required, but none were found. error: 2 Extended: 0 As you can see from my code below, I do have a To Address set, so I am unsure of what it wants me to do. Any help is appreciated. expandcollapse popup_SendEmail1() Func _SendEmail1() $SmtpServer = "exchange.domain.com" ; address for the smtp-server to use - REQUIRED $FromName = "" ; name from who the email was sent $FromAddress = "user@domain.com" ; address from where the mail should come $ToAddress = "user@domain.com" $Subject = "Subject" ; subject from the email - can be anything you want it to be $Body = "Message"; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $username = "user@domain.com" ; username for the account used from where the mail gets sent - REQUIRED $Password = "password" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 25 ; port used for sending the mail $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS ;$IPPort=465 ; GMAIL port used for sending the mail ;$ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $username, $Password, $IPPort, $ssl) ;_INetSmtpMail($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body) If @error Then ConsoleWrite(@CR & "error: " & @error & @CR & "Extended: " & @extended) #cs If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) EndIf #ce EndFunc ;==>_SendEmail1 ;#cs Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.ReplyTo = $s_ToAddress ; was $objEmail.To 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]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) 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 If Number($IPPort) = 0 Then $IPPort = 25 $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 ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail = "" 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 Edited December 12, 2014 by jazzyjeff Link to comment Share on other sites More sharing options...
Developers Jos Posted December 12, 2014 Author Developers Share Posted December 12, 2014 Why did you change the UDF from $objEmail.To to $objEmail.ReplyTo ? Change it back and it will work. 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...
jazzyjeff Posted December 12, 2014 Share Posted December 12, 2014 Thanks for getting back to me Jos. I changed it because I kept getting this error message when it was set to ".To". error: missing separator character before keyword. $objEmail.To ~~~~~~~~~~^ .ReplyTo got rid of that, but has given me another problem :-) Link to comment Share on other sites More sharing options...
jazzyjeff Posted December 12, 2014 Share Posted December 12, 2014 Ok, so once I searched some more on that error I tried a suggestion of yours to use the beta au3check, and this works. Thanks! Link to comment Share on other sites More sharing options...
Thingy2nl Posted December 17, 2014 Share Posted December 17, 2014 Gents, Sorry for being (or feeling like) a total noob, but I can't get this to work..... Copied the source from post 623. Downloaded and installed AutoIt v3.3.12.0 and BETA v3.3.13.9 Running the source completes normally (but does not work and I suspect some access issue) But while debugging, Alt+F5 from SciTE Version 3.4.4 Jul 13 2014 20:07:38 still gives me: >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "D:v3.4mail3.au3" /UserParams +>14:25:46 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0 Keyboard:00000809 OS:WIN_81/ CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:Program Files (x86)AutoIt3SciTE UserDir => C:UsersadminAppDataLocalAutoIt v3SciTEAutoIt3Wrapper SCITE_USERHOME => C:UsersadminAppDataLocalAutoIt v3SciTE >Running AU3Check (3.3.13.19) from:C:Program Files (x86)AutoIt3Beta input:D:v3.4mail3.au3 +>14:25:46 AU3Check ended.rc:0 >Running:(3.3.13.19):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "D:v3.4mail3.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop ### COM Error ! Number: 80020009 ScriptLine: 88 Description:At least one recipient is required, but none were found. It tell's me AutoIt3Wrapper.exe" /run /beta so I thought i was running the beta as advised in post 613... Am i still running the wrong Beta? If so, what should I replace by what other version (and were to get it...)... For context: I'm trying to get a script generate email's with attachments while the system has no network. Mails need to be collected and stored locally (hMailserver) and delivered to smtp relay for delivery once the system is at it's home station) Thanx Link to comment Share on other sites More sharing options...
water Posted December 17, 2014 Share Posted December 17, 2014 I think this message from your output describes it pretty well: "Description:At least one recipient is required, but none were found." 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...
Thingy2nl Posted December 17, 2014 Share Posted December 17, 2014 (edited) My bad..... I should have included that I did change the lines like: $SmtpServer = "192.168.2.122" ; address for the smtp-server to use - REQUIRED $FromName = "me" ; name from who the email was sent $FromAddress = "bert@mylocaldomain.nl" ; address from where the mail should come $ToAddress = "henk@someexternaldomain.com" $Subject = "Subject" ; subject from the email - can be anything you want it to be $Body = "Message"; the messagebody from the mail - can be left blank but then you get a blank mail KAK...... $objEmail.ReplyTo = $s_ToAddress ; was $objEmail.To Might actually make a difference....... Never mind for now...... Edited December 17, 2014 by Thingy2nl Link to comment Share on other sites More sharing options...
jazzyjeff Posted December 17, 2014 Share Posted December 17, 2014 I installed this as mentioned on a post from Jos. It resolved my issue. http://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/Au3Check.exe I guess there is something that needs to be fixed/changed in the Au3Check file. I also initially did the ReplyTo change as well, but something broke it (can't remember what I changed on my system for it to not work). Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 17, 2014 Moderators Share Posted December 17, 2014 FYI, for those that run into the parse issue with $obj.To, I ran into it checking out a script the other day as well. I don't/can't have the beta installed, so to fix it, I simply changed: $objEmail.To To Execute("$objEmail.To") Which fixed my parse issue. If you can install the beta, do that, if you can't there's a short term fix until the next release. mLipok 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 17, 2014 Author Developers Share Posted December 17, 2014 Just replace the production version of au3check.exe with this version is the easy solution! 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...
bdr529 Posted December 19, 2014 Share Posted December 19, 2014 Just replace the production version of au3check.exe with this version is the easy solution! Jos Thank !!!! To community goes all my regards and thanks Link to comment Share on other sites More sharing options...
AutID Posted December 19, 2014 Share Posted December 19, 2014 (edited) I was having this problem for years and I am still having it. Actually I never made this function work for me. Contacted my ISP to check if the ports were blocked, did some workarounds, nothing. The error was this: ### COM Error ! Number: 80020009 ScriptLine: 88 Description:The transport failed to connect to the server. error: 2 Extended: 0 The line is obj.Send... To be honest I was never able to connect to smtp via cmd and send an email manually neither. Edited December 19, 2014 by AutID https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
Developers Jos Posted December 19, 2014 Author Developers Share Posted December 19, 2014 (edited) not sure what you did on the cmd prompt, but when an program like outlook works with smtp or gmail secure smtp, then this udf should work too. Jos Edited December 19, 2014 by 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...
AutID Posted December 20, 2014 Share Posted December 20, 2014 (edited) I have outlook installed but haven't ever try it. I will try it and see if it will change any settings that would allow this udf work for me. Edit: Ok I synchronized outlook with my email account, Hotmail account. Everything works fine. It read all my emails and It was able to send an email. However this piece of code doesn't work for meexpandcollapse popup #include <File.au3> _SendEmail1() Func _SendEmail1() $SmtpServer = "smtp.live.com" ; address for the smtp-server to use - REQUIRED $FromName = "From Name" ; name from who the email was sent $FromAddress = "fromaddress@hotmail.com" ; address from where the mail should come $ToAddress = "toaddress@hotmail.com" $Subject = "Subject" ; subject from the email - can be anything you want it to be $Body = "Message"; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $username = "myEmail@hotmail.com" ; username for the account used from where the mail gets sent - REQUIRED $Password = "*******" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 25 ; port used for sending the mail $ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS ;~ $IPPort=465 ; GMAIL port used for sending the mail ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $username, $Password, $IPPort, $ssl) ;_INetSmtpMail($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body) If @error Then ConsoleWrite(@CR & "error: " & @error & @CR & "Extended: " & @extended) #cs If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) EndIf #ce EndFunc ;==>_SendEmail1 ;#cs Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress ; was $objEmail.To 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]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) 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 If Number($IPPort) = 0 Then $IPPort = 25 $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 ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail = "" 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 P.S. in the $username I am using the same as $Fromaddress since that is my username. Don't know if it has something to do... Edited December 20, 2014 by AutID https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
Developers Jos Posted December 20, 2014 Author Developers Share Posted December 20, 2014 Shouldn't that be?: $IPPort = 587 Check the exact settings in outlook. 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...
AutID Posted December 21, 2014 Share Posted December 21, 2014 I tried to find the port outlook is using but I am not familiar with that. I have a trial version and I don't know if I have access to those settings. According to Microsoft the port for Hotmail is 25. However I tried 587. Same error. I have tried all the possible port with/without ssl and the error is always the same. https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
AutID Posted January 16, 2015 Share Posted January 16, 2015 Changed my router today and tried this function. The problem is still the same. I don't know if you have ever used System.Net.Mail in C# but I did and it works like a charm. I don't think it is my computer's problem neither my connection's. It must be an autoit problem. Just posting this as a feedback in case you are still working on this. https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
Developers Jos Posted January 16, 2015 Author Developers Share Posted January 16, 2015 Just posting this as a feedback in case you are still working on this. There is nothing to work on as this a standard CDO functionality with a AutoIt3 wrapper UDF. Did you try the suggested port and did that fail? 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...
AutID Posted January 17, 2015 Share Posted January 17, 2015 There is nothing to work on as this a standard CDO functionality with a AutoIt3 wrapper UDF. Did you try the suggested port and did that fail? Jos Well I believed there must be an workaround on this problem. My bad. Yes I tried all the suggested ports with ssl enabled and disabled and it failed. https://iblockify.wordpress.com/ 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