MilanSpinka Posted February 7, 2014 Share Posted February 7, 2014 (edited) Hi everybody, I need a help from you! If I have a script, for example registration questionnare: I need to know: ¤ How to make more than 1 InputBox in one window, I wrote InputBox("Registration", "Enter your username:") and I need password and some more things too. ¤ How to send the data from the boxes to my email or something EASILY. Thanks for help, MilanSpinka Edited February 7, 2014 by MilanSpinka Link to comment Share on other sites More sharing options...
Unc3nZureD Posted February 7, 2014 Share Posted February 7, 2014 To send an email I suggest you the following command: http://www.autoitscript.com/autoit3/docs/libfunctions/_INetSmtpMail.htm Anyways I think you'd better use a GUI Have a look at it in the help file. Link to comment Share on other sites More sharing options...
l3ill Posted February 7, 2014 Share Posted February 7, 2014 Welcome to the Forums ! Along with Unc3nZureD suggestion and a quick stop at Koda for the GUI here is the easiest way I know to do what you have asked. The email server info and addresses must be updated for this to work... Have Fun ! expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Inet.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 362, 269, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 48, 24, 161, 21) $Input2 = GUICtrlCreateInput("Input2", 48, 56, 161, 21) $UserName = GUICtrlCreateLabel("UserName", 224, 24, 70, 17) $Password = GUICtrlCreateLabel("PassWord", 224, 56, 53, 17) $Send = GUICtrlCreateButton("Send", 128, 104, 97, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Send _sendEmail() EndSwitch WEnd Func _sendEmail() Local $s_SmtpServer = "smtp.something.com" Local $s_FromName = "You" Local $s_FromAddress = "email@address.com" Local $s_ToAddress = "mail@address.com" Local $s_Subject = "Your Subject" Local $as_Body[2] $as_Body[0] = GUICtrlRead($Input1) $as_Body[1] = GUICtrlRead($Input2) Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) Local $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Mail sent to: " & $s_ToAddress, 2) Else MsgBox(0, "Error!", "Mail failed with error code " & $err) EndIf EndFunc ;==>_sendEmail Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
MilanSpinka Posted February 8, 2014 Author Share Posted February 8, 2014 Welcome to the Forums ! Along with Unc3nZureD suggestion and a quick stop at Koda for the GUI here is the easiest way I know to do what you have asked. The email server info and addresses must be updated for this to work... Have Fun ! expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Inet.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 362, 269, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 48, 24, 161, 21) $Input2 = GUICtrlCreateInput("Input2", 48, 56, 161, 21) $UserName = GUICtrlCreateLabel("UserName", 224, 24, 70, 17) $Password = GUICtrlCreateLabel("PassWord", 224, 56, 53, 17) $Send = GUICtrlCreateButton("Send", 128, 104, 97, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Send _sendEmail() EndSwitch WEnd Func _sendEmail() Local $s_SmtpServer = "smtp.something.com" Local $s_FromName = "You" Local $s_FromAddress = "email@address.com" Local $s_ToAddress = "mail@address.com" Local $s_Subject = "Your Subject" Local $as_Body[2] $as_Body[0] = GUICtrlRead($Input1) $as_Body[1] = GUICtrlRead($Input2) Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) Local $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Mail sent to: " & $s_ToAddress, 2) Else MsgBox(0, "Error!", "Mail failed with error code " & $err) EndIf EndFunc ;==>_sendEmail Bill Thanks, I added some Inputs, $Input5 "Email Adress", then I wrote "Local $s_FromAddress = GUICtrlRead($Input5)" but I don't know what should I put in "Local $s_SmtpServer = "" "..... Link to comment Share on other sites More sharing options...
MilanSpinka Posted February 8, 2014 Author Share Posted February 8, 2014 expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Inet.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 362, 269, 192, 124) $Input1 = GUICtrlCreateInput("Enter your username", 48, 24, 161, 21) $Input2 = GUICtrlCreateInput("Enter your password", 48, 56, 161, 21) $Input3 = GUICtrlCreateInput("Enter value of crystals now", 48, 88, 161, 21) $Input4 = GUICtrlCreateInput("Enter value of crystals then", 48, 120, 161, 21) $Input5 = GUICtrlCreateInput("Enter your GOOGLE email adress", 48, 152, 161, 21) $UserName = GUICtrlCreateLabel("UserName", 224, 24, 53, 17) $Password = GUICtrlCreateLabel("PassWord", 224, 56, 53, 17) $CurrentValue = GUICtrlCreateLabel("Current value", 224, 88, 53, 17) $NewValue = GUICtrlCreateLabel("New value", 224, 120, 53, 17) $GmailAdress = GUICtrlCreateLabel("Email adress", 224, 152, 53, 17) $Send = GUICtrlCreateButton("Send", 128, 185, 97, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Send _sendEmail() EndSwitch WEnd Func _sendEmail() Local $s_SmtpServer = "smtp.gmail.com" Local $s_FromName = "Change Value" Local $s_FromAddress = GUICtrlRead($Input5) Local $s_ToAddress = "imilan@spinka.cz" Local $s_Subject = "Change Value" Local $as_Body[4] $as_Body[0] = GUICtrlRead($Input1) $as_Body[1] = GUICtrlRead($Input2) $as_Body[2] = GUICtrlRead($Input3) $as_Body[3] = GUICtrlRead($Input4) Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) Local $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Succesfully changed value. May take several hours, don't play now!") Else MsgBox(0, "Error!", "Error :(") EndIf EndFunc ;==>_sendEmail Help me, I tried to enter google smtp server and wrote into $Input5 "Enter GOOGLE mail adress"... Still says error when I'm testing... Link to comment Share on other sites More sharing options...
Unc3nZureD Posted February 8, 2014 Share Posted February 8, 2014 Most of the email providers has their own SMTP address. For example GMAIL has the following SMTP server: smtp.gmail.com Link to comment Share on other sites More sharing options...
MilanSpinka Posted February 8, 2014 Author Share Posted February 8, 2014 Please help me I need to send a mail from input fields like this, but I don't know what to put in "Local $s_SmtpServer = "" "... I put in smtp.google.com and wrote "$Input5 = GUICtrlCreateInput("Enter your GOOGLE email adress", 48, 152, 161, 21)" but when I'm testing, it still says error... expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Inet.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 362, 269, 192, 124) $Input1 = GUICtrlCreateInput("Enter your username", 48, 24, 161, 21) $Input2 = GUICtrlCreateInput("Enter your password", 48, 56, 161, 21) $Input3 = GUICtrlCreateInput("Enter value of crystals now", 48, 88, 161, 21) $Input4 = GUICtrlCreateInput("Enter value of crystals then", 48, 120, 161, 21) $Input5 = GUICtrlCreateInput("Enter your GOOGLE email adress", 48, 152, 161, 21) $UserName = GUICtrlCreateLabel("UserName", 224, 24, 53, 17) $Password = GUICtrlCreateLabel("PassWord", 224, 56, 53, 17) $CurrentValue = GUICtrlCreateLabel("Current value", 224, 88, 53, 17) $NewValue = GUICtrlCreateLabel("New value", 224, 120, 53, 17) $GmailAdress = GUICtrlCreateLabel("Email adress", 224, 152, 53, 17) $Send = GUICtrlCreateButton("Send", 128, 185, 97, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Send _sendEmail() EndSwitch WEnd Func _sendEmail() Local $s_SmtpServer = "smtp.google.com" Local $s_FromName = "Change Value" Local $s_FromAddress = GUICtrlRead($Input5) Local $s_ToAddress = "imilan@spinka.cz" Local $s_Subject = "Change Value" Local $as_Body[4] $as_Body[0] = GUICtrlRead($Input1) $as_Body[1] = GUICtrlRead($Input2) $as_Body[2] = GUICtrlRead($Input3) $as_Body[3] = GUICtrlRead($Input4) Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) Local $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Succesfully changed value. May take several hours, don't play now!") Else MsgBox(0, "Error!", "Error :(") EndIf EndFunc ;==>_sendEmail Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2014 Moderators Share Posted February 8, 2014 MilanSpinka,Please stick to just the one thread in future. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
l3ill Posted February 8, 2014 Share Posted February 8, 2014 This is just a suggestion; why dont you update this part of the script with working email credentials and get the script working as is before taking that next step Func _sendEmail() Local $s_SmtpServer = "smtp.something.com" Local $s_FromName = "You" Local $s_FromAddress = "email@address.com" Local $s_ToAddress = "mail@address.com" My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
MilanSpinka Posted February 8, 2014 Author Share Posted February 8, 2014 $Input5 = GUICtrlCreateInput("Enter your GOOGLE email adress", 48, 152, 161, 21) ... ... ... Func _sendEmail() Local $s_SmtpServer = "smtp.gmail.com" Local $s_FromName = "SomeName" Local $s_FromAddress = GUICtrlRead($Input5) Local $s_ToAddress = "imilan@spinka.cz" Local $s_Subject = "SomeSubject" This is a part of the code, still does not work! Link to comment Share on other sites More sharing options...
Developers Jos Posted February 8, 2014 Developers Share Posted February 8, 2014 _INetSmtpMail() doesn't support Gmail, just strait forward SMTP. Look for the _InetSmtpMailCom() in Examples for Gmail support. Jos Melba23 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...
MilanSpinka Posted February 8, 2014 Author Share Posted February 8, 2014 Hi Everybody, please help, I was testing to send email, with the following args: Func _sendEmail() Local $s_SmtpServer = "smtp.email.cz" Local $s_FromName = "SomeName" Local $s_FromAddress = "boetqistalari@email.cz" Local $s_ToAddress = "boetqistalari@email.cz" Local $s_Subject = "SomeSubject" Local $as_Body[4] $as_Body[0] = GUICtrlRead($Input1) $as_Body[1] = GUICtrlRead($Input2) $as_Body[2] = GUICtrlRead($Input3) $as_Body[3] = GUICtrlRead($Input4) Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) Local $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Succesfully changed value. May take several hours, don't play now!") Else MsgBox(0, "Error!", "Error :(") EndIf EndFunc ;==>_sendEmail Cause Gmail was not working, I tried email.cz. But it always says error! Maybe somewhere should be written login to the smtp server - login and password... I don't know! Help me please! Link to comment Share on other sites More sharing options...
Developers Jos Posted February 8, 2014 Developers Share Posted February 8, 2014 Hi Everybody, Cause Gmail was not working, I tried email.cz. But it always says error! Maybe somewhere should be written login to the smtp server - login and password... I don't know! Help me please! Which part of the reply I gave wasn't clear? 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...
MilanSpinka Posted February 8, 2014 Author Share Posted February 8, 2014 Which part of the reply I gave wasn't clear? Jos Oh sorry I didn't read it Where can I get _InetSmtpMailCom() ? And sorry if you get angry with me, I am beginner :D Link to comment Share on other sites More sharing options...
Developers Jos Posted February 8, 2014 Developers Share Posted February 8, 2014 Oh sorry I didn't read it Where can I get _InetSmtpMailCom() ? And sorry if you get angry with me, I am beginner :D I am not angry, just very surprised! I am now even more surprised you started a new thread without even reading the other thread. What about you stick to a single thread and make it easier for all. Merged. As a next step: Used the search for the command I have supplied. 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...
MilanSpinka Posted February 8, 2014 Author Share Posted February 8, 2014 (edited) I am not angry, just very surprised! I am now even more surprised you started a new thread without even reading the other thread. What about you stick to a single thread and make it easier for all. Merged. As a next step: Used the search for the command I have supplied. Jos Thanks, I have found it. But now, I also need to know how to use the command correctly. (please post a code or something) anyway thanks Edited February 8, 2014 by MilanSpinka Link to comment Share on other sites More sharing options...
Developers Jos Posted February 8, 2014 Developers Share Posted February 8, 2014 Thanks, I have found it. But now, I also need to know how to use the command correctly. (please post a code or something) anyway thanks Are you saying that the example in the first post of the thread and the many other examples aren't enough for you? 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...
BlackDawn187 Posted February 8, 2014 Share Posted February 8, 2014 I too had the desire to add emailing capabilities to my script, Though I approached it from a PHP coding perspective and, Designed my own email.php page to handle those requests. It's a lot more complicated and, abusable. But, I can email anyone from anyone, anywhere from anywhere. If you catch my drift. On topic though, I think when you use the smtp.google.com mail server you have to be using a @gmail.com email.. Though I could be wrong. 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