MetalSpongebob Posted December 15, 2007 Share Posted December 15, 2007 (edited) Hi all,I have a problem I wrote an simple email sender client,but I got error when send mail,the code is "right" for scite but error is to send email maybe the cause is a bad syntax of the variables($s_FromAddress and $s_ToAddress)because I need that in the inputbox where write name of sender/receiver don't need to write the "long email address" Example: Sender: paul90 ;(instead of longname "paul90@myemail.com") Receiver: pamela77 ;(instead of longname "pamela77@youmail.com") Here is the code: #include <INet.au3> #include <GUIConstants.au3> #NoTrayIcon #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("myemail''", 301, 248, 215, 140) $Input1 = GUICtrlCreateInput("me", 16, 32, 121, 21) $Group1 = GUICtrlCreateGroup("Sender", 8, 16, 145, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) $Input2 = GUICtrlCreateInput("you", 16, 88, 121, 21) $Group2 = GUICtrlCreateGroup("Receiver", 8, 72, 145, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("message", 8, 128, 281, 73) $Input3 = GUICtrlCreateInput("Hi I am "&@UserName&"!!!!", 16, 152, 257, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Send", 40, 208, 75, 25, 0) $Button2 = GUICtrlCreateButton("Exit", 160, 208, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;$s_SmtpServer = "mysmtpserver";ok ;$s_FromName = "myemail mailer";ok ;$s_FromAddress = ""&$Input1&"@email.com";HERE IS MY ERROR ;$s_ToAddress = ""&$Input2&"@yourmail.com";HERE IS MY ERROR ;$s_Subject = " " While 1=1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $Response = _INetSmtpMail ($S_Smtpserver,$s_Fromname,""$s_FromAddress",""$S_ToAddress"," ",$as_Body) $err = @error If $Response = 1 Then MsgBox(0, "myemail", "email sent") Else MsgBox(0, "myemail", "Error sending email"&@CRLF& $err) EndIf Case $Button2 ExitLoop EndSwitch WEnd #cs ---------------------------------------------------------------------------- I tryed to rewrote like this but got error: #ce ---------------------------------------------------------------------------- #include <INet.au3> #include <GUIConstants.au3> #NoTrayIcon #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("myemail", 301, 248, 215, 140) $Input1 = GUICtrlCreateInput("me", 16, 32, 121, 21) $Group1 = GUICtrlCreateGroup("Sender", 8, 16, 145, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) $Input2 = GUICtrlCreateInput("you", 16, 88, 121, 21) $Group2 = GUICtrlCreateGroup("Receiver", 8, 72, 145, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("message", 8, 128, 281, 73) $as_Body = GUICtrlCreateInput("Hi I am "&@UserName&"!!!!", 16, 152, 257, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Send", 40, 208, 75, 25, 0) $Button2 = GUICtrlCreateButton("Exit", 160, 208, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;$s_SmtpServer = "mysmtpserver.com";ok ;$s_FromName = "myemail mailer.com";ok ;$s_Subject = " " While 1=1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $Response = _INetSmtpMail ($S_Smtpserver,$s_Fromname,""&$Input1&"@myemail.com",""&$Input2&"@youmail.com"," ",$as_Body) $err = @error If $Response = 1 Then MsgBox(0, "myemail", "email sent") Else MsgBox(0, "myemail", "Error sending email"&@CRLF& $err) EndIf Case $Button2 ExitLoop EndSwitch WEnd Edited December 15, 2007 by MetalSpongebob Noob but ethical Link to comment Share on other sites More sharing options...
MetalSpongebob Posted December 15, 2007 Author Share Posted December 15, 2007 Up Nobody know ho help me? Noob but ethical Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2007 Developers Share Posted December 15, 2007 Download the Full SciTE4AutoIt3 installler and hit F5 to run your script from SciTE. This will first run AU3Check and tell you the things that are wrong with your script .. 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...
MetalSpongebob Posted December 15, 2007 Author Share Posted December 15, 2007 Code has no error!The error is when send the data of the email to smtp server,and the error is in the variables: $s_fromAddress $s_toAddress Because I have tryed with this code compiling it directly,and without use a GUI,and works good #include <INet.au3> $s_SmtpServer = "mysmtpserver.com" $s_FromName = "myemail mailer" $s_FromAddress = "paul90@myemail.com" $s_ToAddress = "pamela77@youmail.com" $s_Subject = " " $as_Body = "Hi I am "&@UserName&"!!!!" $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) $err = @error If $Response = 1 Then MsgBox(0, myemail", "email sent") Else MsgBox(0, "myemail", "Error sending email"&@CRLF& $err) EndIf It works but if someone want use the program needs inputbox(and gui) to enter his data... Noob but ethical Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2007 Developers Share Posted December 15, 2007 (edited) Code has no error!The error is when send the data of the email to smtp server,and the error is in the variables:$s_fromAddress$s_toAddressBecause I have tryed with this code compiling it directly,and without use a GUI,and works good#include <INet.au3>$s_SmtpServer = "mysmtpserver.com"$s_FromName = "myemail mailer"$s_FromAddress = "paul90@myemail.com"$s_ToAddress = "pamela77@youmail.com"$s_Subject = " "$as_Body = "Hi I am "&@UserName&"!!!!"$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)$err = @errorIf $Response = 1 Then MsgBox(0, myemail", "email sent")Else MsgBox(0, "myemail", "Error sending email"&@CRLF& $err)EndIfIt works but if someone want use the program needs inputbox(and gui) to enter his data...You are missing the part were you read the Guicontrols and fill the variables... e.g.:$s_ToAddress = GUICtrlRead($input2)etc.. Edited December 15, 2007 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...
MetalSpongebob Posted December 15, 2007 Author Share Posted December 15, 2007 (edited) Thanks for help But I tryed this and dont work I get always the same "error 52" I need to hide the "@email.com" insert only name to be faster Example:paul90(instead of paul90@myemail.com) Here the code : $s_SmtpServer = "mysmtpserver.com" $s_FromName = "myemail mailer" $s_FromAddress = GUICtrlRead($Input1,0)"@myemail.com";Here the error $s_ToAddress = GUICtrlRead($Input2,0)"@youmail.com";Here the error $s_Subject = " " $as_Body = GUICtrlRead($input3,0) $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Mail sent") Else MsgBox(0, "Error!", "Mail failed with error code " & $err) EndIf I got error... So I try this $s_SmtpServer = "mysmtpserver.com" $s_FromName = "myemail mailer" $s_Subject = " " $as_Body = GUICtrlRead($input3,0) $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress&"@myemail.com", $s_ToAddress&"@youmail.com", $s_Subject, $as_Body) $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Mail sent") Else MsgBox(0, "Error!", "Mail failed with error code " & $err) EndIf Edited December 15, 2007 by MetalSpongebob Noob but ethical 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