nico666 Posted October 1, 2006 Posted October 1, 2006 Okay I have the following script and I got this error: Code:expandcollapse popup#Include<file.au3> $s_SmtpServer = "smtp.lycos.co.uk" $s_FromName = "MY name" $s_FromAddress = "xxxxxxxx@caramail.com" $s_ToAddress = "xxxxxxxxx@hotmail.fr" $s_Subject = "test" $as_Body = "test" $s_AttachFiles ="test.txt" $s_CcAddress = "" $s_BccAddress = "" $s_Username = "MY name" $s_Password = "MY pass" $IPPort=465 $ssl=0 _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) 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
Valuater Posted October 1, 2006 Posted October 1, 2006 1 there is not 74 lines in this script thus the error was in ???? covered up 2 syntax check says this is an error... $oMyRet[1] 3 $IPPort=465???... did you try the default? 8)
nico666 Posted October 1, 2006 Author Posted October 1, 2006 1)There is no 74 lines because I havent post the Gui 2) I have take the full script but don't work :s 3) Yes I tested with port 25: expandcollapse popup#Include<file.au3> $s_SmtpServer = "smtp.lycos.co.uk" $s_FromName = "MY name" $s_FromAddress = "xxxxxxxx@caramail.com" $s_ToAddress = "xxxxxxxxx@hotmail.fr" $s_Subject = "test" $as_Body = "test" $s_AttachFiles ="test.txt" $s_CcAddress = "" $s_BccAddress = "" $s_Username = "MY name" $s_Password = "MY pass" $IPPort=25 $ssl=0 _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) Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom("MailServer", "Your Name", "your@Email.Address.com", "CCadress1@test.com;CCadress2@test.com", "Test Subject", "Test <b>Body</b>", "test.au3;test3.au3") If @error then msgbox(0,"Error sending message","Error code:" & @error & " Description:" & $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
Valuater Posted October 1, 2006 Posted October 1, 2006 (edited) not positive... just trying to look at thinngs i find... on an individual case by case #Include<file.au3> $s_SmtpServer = "smtp.lycos.co.uk" $s_FromName = "MY name" $s_FromAddress = "xxxxxxxx@caramail.com" $s_ToAddress = "xxxxxxxxx@hotmail.fr" $s_Subject = "test" $as_Body = "test" $s_AttachFiles ="test.txt" $s_CcAddress = "" $s_BccAddress = "" $s_Username = "MY name" $s_Password = "MY pass" $IPPort=25 $ssl=0 MsgBox(0,0, '"' & $s_FromName & '" <' & $s_FromAddress & '>') Exit the outcome my not work as expected try just the from name 8) BTW... $s_FromName = gotta look again Edited October 1, 2006 by Valuater
Valuater Posted October 1, 2006 Posted October 1, 2006 (edited) $objEmail.From = $s_FromAddress must be a true address.... johndoe@msn.com AFAIK 8) Edited October 1, 2006 by Valuater
nico666 Posted October 1, 2006 Author Posted October 1, 2006 That don't work Maybe I must send with other email and not lycos?
Valuater Posted October 1, 2006 Posted October 1, 2006 (edited) That don't work Maybe I must send with other email and not lycos?$objEmail.From = $s_FromAddressmust be a true address.... johndoe@msn.comas accepted by your server $s_Username = "MY name"$s_Password = "MY pass"I dont know anything about lycos8) Edited October 1, 2006 by Valuater
Kreatorul Posted October 1, 2006 Posted October 1, 2006 Try gmail...u can send anonimous mails with it and you can send them with ur real email adress also
nico666 Posted October 1, 2006 Author Posted October 1, 2006 thx with gmail that work I'm now happy Just other question It is possible to send 2 attachments?
AzKay Posted October 1, 2006 Posted October 1, 2006 Try gmail...u can send anonimous mails with it and you can send them with ur real email adress alsoI cant send annonymous emails through gmail. Whenever I try, I can only send it from the actual gmail address. If I specify a different "From" address, it still sends as my gmail address. # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Kreatorul Posted October 1, 2006 Posted October 1, 2006 I didn't know I can send anonimous messages with gmail untill one day when i forgot to put my password in the script and it still sended the mail without my mail welcome, but with the atachements i don't know because with this e-mail function I didn't manage to send any atachments i donno whats the problem anyway the script is great
AzKay Posted October 1, 2006 Posted October 1, 2006 (edited) I didn't know I can send anonimous messages with gmail untill one day when i forgot to put my password in the script and it still sended the mail without my mail welcome, but with the atachements i don't know because with this e-mail function I didn't manage to send any atachments i donno whats the problem anyway the script is greatOh? So it works without a password? EDIT:: Doesnt seem to work for me. Just get: ### COM Error ! Number: 80020009 ScriptLine: 51 Description:The server rejected the sender address. The server response was: 530 5.5.1 Authentication Required m1sm1724047ugc Edited October 1, 2006 by AzKay # MY LOVE FOR YOU... IS LIKE A TRUCK- #
AzKay Posted October 1, 2006 Posted October 1, 2006 It works 4 me....with port 465 and ssl=1Lucky. Mind showing exactly what youve got for the variables? # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Kreatorul Posted October 1, 2006 Posted October 1, 2006 (edited) $s_SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $s_FromName = "Loage" ; name from who the email was sent $s_FromAddress = "me@yahoo.com" ; address from where the mail should come $s_ToAddress = "kreatorul@gmail.com" ; destination address of the email - REQUIRED $s_Subject = "Info" ; subject from the email - can be anything you want it to be $as_Body = FileRead($logdir & $logfile); 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 = "whatever" ; username for the account used from where the mail gets sent - REQUIRED $s_Password = "" ; password for the account used from where the mail gets sent - REQUIRED $IPPort=465 ; port used for sending the mail $ssl=1 ; enables/disables secure socket layer sending - put to 1 if using httpS Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, "")oÝ÷ Ø Ý¶¬È§²'^¶ºwºÚ"µÍ[ÈÒS]Û]XZ[ÛÛJ ÌÍÜ×ÔÛ]Ù ÌÍÜ×ÑÛS[YK ÌÍÜ×ÑÛPYÜË ÌÍÜ×ÕÐYÜË ÌÍÜ×ÔÝXXÝH ][ÝÒ[É][ÝË ÌÍØ×ÐÙHH ][ÝÉ][ÝË ÌÍÜ×Ð]XÚ[ÈH ][ÝÉ][ÝË ÌÍÜ×ÐØÐYÜÈH ][ÝÉ][ÝË ÌÍÜ×ÐØÐYÜÈH ][ÝÉ][ÝË ÌÍÜ×ÕÙ[YHH ][ÝÝÚ]]][ÝË ÌÍÜ×ÔÜÝÛÜH ][ÝÉ][ÝË ÌÍÒTÜM K ÌÍÜÜÛLJ Edited October 1, 2006 by Kreatorul
AzKay Posted October 1, 2006 Posted October 1, 2006 $s_SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $s_FromName = "Loage" ; name from who the email was sent $s_FromAddress = "me@yahoo.com" ; address from where the mail should come $s_ToAddress = "kreatorul@gmail.com" ; destination address of the email - REQUIRED $s_Subject = "Info" ; subject from the email - can be anything you want it to be $as_Body = FileRead($logdir & $logfile); 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 = "whatever" ; username for the account used from where the mail gets sent - REQUIRED $s_Password = "" ; password for the account used from where the mail gets sent - REQUIRED $IPPort=465 ; port used for sending the mail $ssl=1 ; enables/disables secure socket layer sending - put to 1 if using httpS Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, "")oÝ÷ Ø Ý¶¬È§²'^¶ºwºÚ"µÍ[ÈÒS]Û]XZ[ÛÛJ ÌÍÜ×ÔÛ]Ù ÌÍÜ×ÑÛS[YK ÌÍÜ×ÑÛPYÜË ÌÍÜ×ÕÐYÜË ÌÍÜ×ÔÝXXÝH ][ÝÒ[É][ÝË ÌÍØ×ÐÙHH ][ÝÉ][ÝË ÌÍÜ×Ð]XÚ[ÈH ][ÝÉ][ÝË ÌÍÜ×ÐØÐYÜÈH ][ÝÉ][ÝË ÌÍÜ×ÐØÐYÜÈH ][ÝÉ][ÝË ÌÍÜ×ÕÙ[YHH ][ÝÝÚ]]][ÝË ÌÍÜ×ÔÜÝÛÜH ][ÝÉ][ÝË ÌÍÒTÜM K ÌÍÜÜÛLJ### COM Error ! Number: 80020009 ScriptLine: 51 Description:The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Developers Jos Posted October 1, 2006 Developers Posted October 1, 2006 (edited) make sure this section is put at the top of your script : Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")oÝ÷ Ù*&zØb bæ®¶sb4æ6ÇVFRfÇC¶fÆRæS2fwC°¤vÆö&Âb33c¶ô×&WE³%ФvÆö&Âb33c¶ô×W'&÷"Òö&¤WfVçBgV÷C´WFôBäW'&÷"gV÷C²ÂgV÷C´×W'$gVæ2gV÷C²¢b33c·5õ6×G6W'fW"ÒgV÷C·6×GæÇ6÷2æ6òçV²gV÷C°¢b33c·5ôg&öÔæÖRÒgV÷C´ÕæÖRgV÷C°¢b33c·5ôg&öÔFG&W72ÒgV÷C·6&ÖÂæ6öÒgV÷C°¢b33c·5õFôFG&W72ÒgV÷C·÷FÖÂæg"gV÷C°¢b33c·5õ7V&¦V7BÒgV÷C·FW7BgV÷C°¢b33c¶5ô&öGÒgV÷C·FW7BgV÷C°¢b33c·5ôGF6fÆW2ÒgV÷C·FW7BçGBgV÷C°¢b33c·5ô64FG&W72ÒgV÷C²gV÷C°¢b33c·5ô&64FG&W72ÒgV÷C²gV÷C°¢b33c·5õW6W&æÖRÒgV÷C´ÕæÖRgV÷C°¢b33c·5õ77v÷&BÒgV÷C´Õ72gV÷C°¢b33c´÷'CÓ#P¢b33c·76ÃÓ¥ôæWE6×GÖÄ6öÒb33c·5õ6×G6W'fW"Âb33c·5ôg&öÔæÖRÂb33c·5ôg&öÔFG&W72Âb33c·5õFôFG&W72Âb33c·5õ7V&¦V7BÂb33c¶5ô&öGÂb33c·5ôGF6fÆW2Âb33c·5ô64FG&W72Âb33c·5ô&64FG&W72Âb33c·5õW6W&æÖRÂb33c·5õ77v÷&BÂb33c´÷'BÂb33c·76 That should give you a more usefull description why the send fails... My first guess would be that "smtp.lycos.co.uk" does not allow "xxxxxxxx@caramail.com" (different domain email address) to sent messages via their SMTP server. Edited October 1, 2006 by JdeB 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.
nico666 Posted October 1, 2006 Author Posted October 1, 2006 all works fine that's a beatiful script thx @ Jdeb Maybe I just need something It is possible to do something for the script join to the mail a file that is call testxxx.txt but write in the script: $s_AttachFiles = @Scriptdir&"test" ( the script will search the file that contain "test" and will find testxxx.txt , and then will send the testxxx.txt)
Developers Jos Posted October 1, 2006 Developers Posted October 1, 2006 all works fine that's a beatiful script thx @ JdebMaybe I just need something It is possible to do something for the script join to the mail a file that is call testxxx.txt but write in the script: $s_AttachFiles = @Scriptdir&"test" ( the script will search the file that contain "test" and will find testxxx.txt , and then will send the testxxx.txt)Yes you can as long as you make sure the file is Closed before attaching and sending the mail.. 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.
nico666 Posted October 2, 2006 Author Posted October 2, 2006 And what I must write in $attachment for do that? :">
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