DW1 Posted July 11, 2007 Share Posted July 11, 2007 (edited) I get this error in the msgbox: Error code:2 Rc:The message could not be sent to the SMTP server. The transport error code was 0x800ccc6f. The server response was 554 5.7.1ussp-sefw-2.COMPANYNAME.com Connection not authorized and this in SciTe ### COM Error ! Number: 80020009 ScriptLine: 79 Description:The message could not be sent to the SMTP server. The transport error code was 0x800ccc6f. The server response was 554 5.7.1 ussp-sefw-2.COMPANYNAME.com Connection not authorized With this code beta or prod expandcollapse popup#Include<file.au3> Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ;################################## ; Include ;################################## #Include<file.au3> ;################################## ; Variables ;################################## $s_SmtpServer = "smtp.mail.yahoo.com" ; address for the smtp-server to use - REQUIRED $s_FromName = "myaddress@yahoo.com" ; name from who the email was sent $s_FromAddress = "myaddress@yahoo.com" ; address from where the mail should come $s_ToAddress = "testsendtoaddy@gmail.com" ; destination address of the email - REQUIRED $s_Subject = "Userinfo" ; subject from the email - can be anything you want it to be $as_Body = "Testing" ; the messagebody from the mail - can be left blank but then you get a blank mail $s_AttachFiles = "" ; the file you want to attach- leave blank if not needed $s_CcAddress = "" ; address for cc - leave blank if not needed $s_BccAddress = "" ; address for bcc - leave blank if not needed $s_Username = "myaddress@yahoo.com" ; username for the account used from where the mail gets sent - Optional (Needed for eg GMail) $s_Password = "password" ; password for the account used from where the mail gets sent - Optional (Needed for eg GMail) $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 ;################################## ; Script ;################################## Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Rc:" & $rc) 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 Edited July 11, 2007 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
VeeDub Posted August 18, 2007 Share Posted August 18, 2007 (edited) Hi,I can send unauthenticated e-mail fine with this script, however if I try and authenticate to the SMTP server I get the following error in the console>Running:(3.2.4.9):C:\Program Files\AutoIt3\autoit3.exe "D:\Temp\Shadow\INetSmtpMailCom.au3" D:\Temp\Shadow\INetSmtpMailCom.au3 (88) : ==> The requested action with this object has failed.: $objEmail.Send $objEmail.Send^ ERROR ->14:50:56 AutoIT3.exe ended.rc:1 +>14:50:57 AutoIt3Wrapper FinishedHere's the reporting from the error handler## COM Error ! Number: 80020009 ScriptLine: 89 Description:The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not availableAnswerOK, it turns out that I goofed by using the wrong password. However having acknowledged that, ideally the script should not crash because of garbage input ... although I guess that is debatable ... crap input leads to crap output.CheersVW Edited August 18, 2007 by VeeDub Link to comment Share on other sites More sharing options...
apfel Posted September 11, 2007 Share Posted September 11, 2007 (edited) i have created a small script, which should search in a main folder for subfolders and search the subfolders for files which should be attached to the mail. the mail address could be found in a file name. when i run the script it works but i get an access denied error, i have also created a loop but i can't find where it is. ### COM Error ! Number: 80020009 ScriptLine: 85 Description:Access denied Error code:2 Rc:Access denied ScriptLine 85: $objEmail.AddAttachment ($S_Files2Attach[$x]) i run the script with the following code: $search1 = FileFindFirstFile("*.*") While 1 $s_AttachFiles ="" $s_ToAddress="" $Dir_Cost = FileFindNextFile($search1) If $Dir_Cost ="" Then Exit EndIf $search2 = FileFindFirstFile($Dir_Cost & "\*.*") $i=1 While $i=1 $File_Cost = FileFindNextFile($search2) If $File_Cost = "" Then $i=0 EndIf If $File_Cost <> "" Then If StringInStr ($File_Cost, "@") = 0 Then $s_AttachFiles = $s_AttachFiles & "C:\tmp\temp2\" & $Dir_Cost & "\" & $File_Cost & ";" EndIf If StringInStr ($File_Cost, "@") > 0 Then $s_ToAddress = $File_Cost EndIf EndIf WEnd Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Rc:" & $rc) EndIf WEnd Edited September 11, 2007 by apfel Link to comment Share on other sites More sharing options...
Developers Jos Posted September 11, 2007 Author Developers Share Posted September 11, 2007 What does the $s_AttachFiles variable contain when the mail is sent ? Maybe you need to enclose all filenames with "" ? 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...
apfel Posted September 12, 2007 Share Posted September 12, 2007 the variable contains the following: c:\dir1\dir2\test.bmp;c:\dir1\dir2\test.wav;c:\dir1\dir2\test.txt; Link to comment Share on other sites More sharing options...
Developers Jos Posted September 12, 2007 Author Developers Share Posted September 12, 2007 the variable contains the following: c:\dir1\dir2\test.bmp;c:\dir1\dir2\test.wav;c:\dir1\dir2\test.txt;Are the Dirs containing spaces and did you try to put the whole filenames in "" ?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...
apfel Posted September 12, 2007 Share Posted September 12, 2007 when i put the whole filenames in quotation marks, nothing works, the mail isn't send. if i try to send mails without your script and put in files and dirs with spaces everything goes fine even without the quotation marks. Link to comment Share on other sites More sharing options...
chazzmani Posted September 22, 2007 Share Posted September 22, 2007 If I do all of my email sending and receiving via Hotmail, would I need a valid SMTP server address for Hotmail? Email and networking are not my strengths so I didn't know what was required in those fields to make this work. If so, how would I get that? Link to comment Share on other sites More sharing options...
wangbu Posted September 22, 2007 Share Posted September 22, 2007 Nice! works fine Link to comment Share on other sites More sharing options...
thomaatje Posted November 9, 2007 Share Posted November 9, 2007 Great work! i LOVE this! Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted November 10, 2007 Share Posted November 10, 2007 Would be nice.. if this can be used to send errors generated in the program to the author with acknowledge of the user who's using the programs Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
Jester009 Posted November 23, 2007 Share Posted November 23, 2007 Did anybody got it working with a yahoo account? I tried but always get the error code:2 which is can not contact SMTP server... I used SMTP server as smtp.mail.yahoo.com port: 465 ssl:1 Any idea why it's not sending?? Thanks Link to comment Share on other sites More sharing options...
Developers Jos Posted November 23, 2007 Author Developers Share Posted November 23, 2007 Think it will only work with an Yahoo Mail Plus account. 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...
Jester009 Posted November 23, 2007 Share Posted November 23, 2007 Oh ic, That's too bad. But according to here user@yahoo.co.uk accounts can use pop and smtp features right?http://popfwd.mail.yahoo.com/pf/PopConfig?....addr=&.bm= Link to comment Share on other sites More sharing options...
hiweed Posted December 20, 2007 Share Posted December 20, 2007 Hi, how do I improve the script to run successfully on computers under proxy? I know there is a HttpSetProxy(0) fuction, but this seems not work... Anybody help? Thanks in advance! Link to comment Share on other sites More sharing options...
TalivanIBM Posted December 21, 2007 Share Posted December 21, 2007 Hey, this works very very very very good, but i have a question, is possible to send a mail by SPA password authentication SMTP server mail? You are working on this? Now, there are many accounts calling authentication SPA........ Thanks for your work is so useful. Link to comment Share on other sites More sharing options...
corey822 Posted December 26, 2007 Share Posted December 26, 2007 anyhelp it keeps rejecting sender adress ive tried my hotmail ,isp and my gmail in sender but still same error cheers C.W C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake Link to comment Share on other sites More sharing options...
qsek Posted June 5, 2008 Share Posted June 5, 2008 I have the same problems like longtex and Leoj.Many people use a Program from me which sends an Email both to themselves and to my private email adress using the 111.com smtp server (mail.111.com)It works fine on most of the users but on some there have been problems with sending.They get this error: ### COM Error !Number: 80020009ScriptLine: -1Description:The transport failed to connect to the server.Guess what.. the ones with the Problem are having SBC as ISP.So does anyone have updates on this problem or maybe an idea how to get that Mail sent?The people can send normal Emails with their Emailprogramm but not with the CDO.Message Object.There have to be a difference. Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite Link to comment Share on other sites More sharing options...
FastHelper Posted June 5, 2008 Share Posted June 5, 2008 giving a error for connecting. sorry for my spelling mistakes. its due to be fast !!! Link to comment Share on other sites More sharing options...
boyemillar Posted June 17, 2008 Share Posted June 17, 2008 Is there any way to add multipe CC's or BCC's to this script. 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