PcExpert Posted January 6, 2008 Share Posted January 6, 2008 (edited) Hi all, I get the folowing error code when i'm trying to send mail using the mentioned function: Unable to create socket Why? All fields are filled in correctly. I used the autoit example from the helpfile. Thanks! Edited January 6, 2008 by PcExpert Link to comment Share on other sites More sharing options...
PcExpert Posted January 6, 2008 Author Share Posted January 6, 2008 Anybody? Link to comment Share on other sites More sharing options...
picaxe Posted January 7, 2008 Share Posted January 7, 2008 Try setting $b_trace to see the smtp session dialog, that may give you a better idea of where the problem is. Also check that your firewall is not preventing outgoing smtp connection. $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ComputerName, -1, $ts) Link to comment Share on other sites More sharing options...
PcExpert Posted January 7, 2008 Author Share Posted January 7, 2008 How to activate $b_trace? I tried setting it to 1, but then I get a scripterror. Thanks! Link to comment Share on other sites More sharing options...
picaxe Posted January 7, 2008 Share Posted January 7, 2008 Sorry, last param should be "1" to turn on trace $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ComputerName, -1, 1) Link to comment Share on other sites More sharing options...
PcExpert Posted January 8, 2008 Author Share Posted January 8, 2008 This function has been working for three or four times now, but now it suddenly doesnt send it any more. I get the same arror again (socket error) so I thought to turn on trace. But it seems that my scite is a little bit messed up, because the syntax tooltip isnt accurate. I'm sure the syntax is fine, but it doesnt show the debug window, why? The option is set to 1. Link to comment Share on other sites More sharing options...
PcExpert Posted January 9, 2008 Author Share Posted January 9, 2008 *bump* Link to comment Share on other sites More sharing options...
picaxe Posted January 9, 2008 Share Posted January 9, 2008 This modified version of the Autoit example with "trace send" option works for me. expandcollapse popup#include <INet.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> $s_SmtpServer = "mysmtpserver.com.au" $s_FromName = "My Name" $s_FromAddress = "From eMail Address" $s_ToAddress = "To eMail Address" $s_Subject = "Test AutoIt InetSmtpMail" GUICreate("", 500, 150) $edit = GUICtrlCreateEdit ("", 10, 10, 480, 100) $btn_send = GUICtrlCreateButton ("Send", 10,118,50) $btn_trace = GUICtrlCreateButton ("Trace Send", 70,118,70) GUISetState () while 1 $msg = GUIGetMsg() Select Case $msg = $btn_send $trace = 0 Email() Case $msg = $btn_trace $trace = 1 Email() Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func Email() $txt = GUICtrlRead($edit) Dim $as_Body[1] $as_Body[0] = $txt $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, "EHLO" & @ComputerName, -1, $trace) $err = @error If $Response = 1 Then MsgBox(262144, "Success!", "Mail sent") Else MsgBox(262144, "Error!", "Mail failed with error code " & $err) EndIf EndFunc Link to comment Share on other sites More sharing options...
PcExpert Posted January 9, 2008 Author Share Posted January 9, 2008 (edited) Doesnt work. I'll post my Send mail code: $s_SmtpServer = "mail.server" $s_FromName = GUICtrlRead($naam) $s_FromAddress = GUICtrlRead($email) $s_ToAddress = "toaddr" $s_Subject = "Subject" Dim $as_Body[11] $as_Body[0] = "TEXT Line 1" $as_Body[1] = "" $as_Body[2] = "Text Line 2" $as_Body[3] = "" $as_Body[4] = "TEXT LINE 3" $as_Body[5] = "" $as_Body[6] = "" $as_Body[7] = "TEXT LINE 4" $as_Body[8] = "" $as_Body[9] = "TEXT LINE 5" $as_Body[10] = "TEXT LINE 6" $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, "EHLO" & @ComputerName, -1, 1) $err = @error If $Response = 1 Then MsgBox(0, $appname, $ERR_License_Aanvraag_done) Exit Else MsgBox(0, $appname, $ERR_License_Aanvraag_error & $err) Exit EndIf EndFunc Thanks! Edited January 9, 2008 by PcExpert Link to comment Share on other sites More sharing options...
Developers Jos Posted January 9, 2008 Developers Share Posted January 9, 2008 (edited) Doubt we can test it for you unless you run an Open/relay SMTP server (which in not advisable), but this doesn't look right to me: "EHLO" & @ComputerName should be: "EHLO " & @ComputerName Jos Edited January 9, 2008 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...
PcExpert Posted January 9, 2008 Author Share Posted January 9, 2008 THanks, but it doesnt solve my problem, the weird thing is, that when I turn on $b_trace, it doesnt show the debug window. Why? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 9, 2008 Developers Share Posted January 9, 2008 Dunno...it does for me. what have you done to try and debug that ? Its a lot more effective when you try to do some debugging yourself in stead of posting here since we cannot test your code really and have no idea of your setup .... Just copy the include file and add some consolewrite statements (Alt+D in SciTE) to see what is happening.... 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...
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