scythetleppo Posted May 4, 2006 Share Posted May 4, 2006 I read a thread about a smtp emailer, but when I run it I get error 0 1. I think that is because I didn'thave a good smtp server, mainly because I have no idea what that is. I have a php file that sends an anonymous email quite easily so that seems pretty easy. I'm not a spammer, I don't even want it to be anonymous, I just want to know if Autoit can send emails. I want to email once a week to a specific email. I couldn't find any functions that did this. Maybe it's becauseI don't really know how email works. Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 4, 2006 Share Posted May 4, 2006 I read a thread about a smtp emailer, but when I run it I get error 0 1. I think that is because I didn'thave a good smtp server, mainly because I have no idea what that is. I have a php file that sends an anonymous email quite easily so that seems pretty easy.I'm not a spammer, I don't even want it to be anonymous, I just want to know if Autoit can send emails.I want to email once a week to a specific email.I couldn't find any functions that did this. Maybe it's becauseI don't really know how email works.HI,search for smtp in Scripts & ... . There is a func which can send mails.I think, you'll need autoit beta!So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
scythetleppo Posted May 4, 2006 Author Share Posted May 4, 2006 (edited) HI, search for smtp in Scripts & ... . There is a func which can send mails. I think, you'll need autoit beta! So long, Mega I've been working on this script ever since then and I just don't know what to do any more. This is the page I found that was closest to what I want: GUI emailer expandcollapse popup#include <GUIConstants.au3> GUICreate("SMTP 25 1.1 by AsimZameer") GUICtrlCreateLabel ("Smtp :", 20, 10, 50) GUICtrlCreateLabel ("From :", 20, 40, 50) GUICtrlCreateLabel ("To :", 20, 70, 50) GUICtrlCreateLabel ("Name :", 20, 100, 50) GUICtrlCreateLabel ("Subject :", 20, 130, 50) GUICtrlCreateLabel ("Body :", 20, 160, 50) GUICtrlCreateLabel ("Status :", 5, 215, 50) $input1 = GUICtrlCreateInput("mx1.mail.yahoo.com",70,10,250,20) $input2 = GUICtrlCreateInput("snip",70,40,250,20) $input3 = GUICtrlCreateInput("snip",70,70,250,20) $input4 = GUICtrlCreateInput("asimzameer",70,100,250,20) $input5 = GUICtrlCreateInput("test message",70,130,250,20) $input6 = GUICtrlCreateInput("Hello WOW ASIM SMTP really Works",70,160,250,20) $myedit=GUICtrlCreateEdit ("Readme: After click on Send Button Wait Until status = 3 When Status = 3 it Means Email Successfully sent & Please Fill all Boxs Correctly If SMTP Address Not Works Automatically Exit and Close "& @CRLF, 1,230,400,70,$WS_DISABLED) $btn = GUICtrlCreateButton ("Send", 160, 310, 60, 20) GUISetState () While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $btn Then $g_IP = GUICtrlRead($input1) $sData1 = "HELO " & GUICtrlRead($input4) & @CRLF $sData2 = "MAIL FROM: <" & GUICtrlRead($input2) &">" & @CRLF $sData3 = "RCPT TO: <" & GUICtrlRead($input3) &"> "& @CRLF $sData4 = "DATA" & @CRLF $sData5 = "From:" & GUICtrlRead($input4) & "< " & GUICtrlRead($input2) &" >" & @CRLF $sData6 = "To:" & GUICtrlRead($input3) & @CRLF $sData7 = "Subject:" & GUICtrlRead($input5) & @CRLF $sData8 = "Sender: Microsoft Outlook Express 6.00.2800.1158" & @CRLF $sData9 = "Mime-Version: 1.0" & @CRLF $sData10 = "Content-Type: text/plain; charset=US-ASCII" & @CRLF $sData11 = @CRLF $sData12 = GUICtrlRead($input6) & @CRLF $sData13 = "." & @CRLF TCPStartUp() $socket = TCPConnect(TCPNameToIP($g_IP), 25) If $socket = -1 Then Exit $ret1 = GUICtrlSetData ($myedit,TCPSend($socket, $sData1) ) sleep(100) $ret2 = GUICtrlSetData ($myedit,TCPSend($socket, $sData2) ) sleep(100) $ret3 = GUICtrlSetData ($myedit,TCPSend($socket, $sData3) ) sleep(100) $ret4 = GUICtrlSetData ($myedit,TCPSend($socket, $sData4) ) sleep(100) $ret5 = GUICtrlSetData ($myedit,TCPSend($socket, $sData5) ) sleep(100) $ret6 = GUICtrlSetData ($myedit,TCPSend($socket, $sData6) ) sleep(100) $ret7 = GUICtrlSetData ($myedit,TCPSend($socket, $sData7) ) sleep(100) $ret8 = GUICtrlSetData ($myedit,TCPSend($socket, $sData8) ) sleep(100) $ret9 = GUICtrlSetData ($myedit,TCPSend($socket, $sData9) ) sleep(100) $ret10 = GUICtrlSetData ($myedit,TCPSend($socket, $sData10) ) sleep(100) $ret11 = GUICtrlSetData ($myedit,TCPSend($socket, $sData11) ) sleep(100) $ret12 = GUICtrlSetData ($myedit,TCPSend($socket, $sData12) ) sleep(100) $ret13 = GUICtrlSetData ($myedit,TCPSend($socket, $sData13) ) sleep(100) EndIf Wend but I don't want all the GUI, I just want to send 1 email to an adderss I know, from an address I know, the content I know, I know everything I want to send. I have tried editing it down and have come up with: expandcollapse popup$body = "MESSAGE HERE" $sData1 = "HELO " & "asimzameer" & @CRLF $sData2 = "MAIL FROM: <" & "snip" & ">" & @CRLF $sData3 = "RCPT TO: <" & "scythetleppo@yahoo.com" &"> "& @CRLF $sData4 = "DATA" & @CRLF $sData5 = "From:" & "asimzameer" & "< " & "emailaddressremoved" & " >" & @CRLF $sData6 = "To:" & "scythetleppo@yahoo.com" & @CRLF $sData7 = "Subject:" & "test message" & @CRLF $sData8 = "Sender: Microsoft Outlook Express 6.00.2800.1158" & @CRLF $sData9 = "Mime-Version: 1.0" & @CRLF $sData10 = "Content-Type: text/plain; charset=US-ASCII" & @CRLF $sData11 = @CRLF $sData12 = $body & @CRLF $sData13 = "." & @CRLF TCPStartUp() $socket = TCPConnect(TCPNameToIP('mx1.mail.yahoo.com'), 25) If $socket = -1 Then Exit $ret1 = TCPSend($socket, $sData1) sleep(100) $ret2 = TCPSend($socket, $sData2) sleep(100) $ret3 = TCPSend($socket, $sData3) sleep(100) $ret4 = TCPSend($socket, $sData4) sleep(100) $ret5 = TCPSend($socket, $sData5) sleep(100) $ret6 = TCPSend($socket, $sData6) sleep(100) $ret7 = TCPSend($socket, $sData7) sleep(100) $ret8 = TCPSend($socket, $sData8) sleep(100) $ret9 = TCPSend($socket, $sData9) sleep(100) $ret10 = TCPSend($socket, $sData10) sleep(100) $ret11 = TCPSend($socket, $sData11) sleep(100) $ret12 = TCPSend($socket, $sData12) sleep(100) $ret13 = TCPSend($socket, $sData13) but now I don't receive the email. Why is this so difficult to just send 1 email! Edited November 26, 2012 by Jon Email address removed Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 4, 2006 Share Posted May 4, 2006 (edited) Hi,try this:Change this: $rc = _INetSmtpMailCom('mail.gmx.net', "DisplayName", "FROM YourAdress@xxx.xx", "TO YourAdress@xxx.xx", "Test Subject", "Test <b>Body</b>", "", "","", "Usernmae", "password")expandcollapse popup#include<file.au3> Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom('mail.gmx.net', "DisplayName", "FROM YourAdress@xxx.xx", "TO YourAdress@xxx.xx", "Test Subject", "Test <b>Body</b>", "", "","", "Usernmae", "password") 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 = "") $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.Cc = $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") = 25 ;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 ;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;==>MyErrFuncSo long,Mega Edited May 4, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
scythetleppo Posted May 4, 2006 Author Share Posted May 4, 2006 I get error code 2, error 501 bad syntax for the server. Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 4, 2006 Share Posted May 4, 2006 I get error code 2, error 501 bad syntax for the server.HI,show me the code you changed. (the red one) But don't forget to **** your password Besides, the func works great for me. So, there is a way we can fix it. So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
scythetleppo Posted May 4, 2006 Author Share Posted May 4, 2006 $rc = _INetSmtpMailCom('smtp.yahoo.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "myrealaccount", "myrealpassword") also $rc = _INetSmtpMailCom('smtp.google.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "", "") also $rc = _INetSmtpMailCom('x1.yahoo.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "myrealaccount", "myrealpassword") I guess I don't understand what to put for the values. Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 4, 2006 Share Posted May 4, 2006 $rc = _INetSmtpMailCom('smtp.yahoo.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "myrealaccount", "myrealpassword") also $rc = _INetSmtpMailCom('smtp.google.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "", "") also $rc = _INetSmtpMailCom('x1.yahoo.com', "DisplayName", "FROM myrealaccount@yahoo.com", "TO myrealaccount@yahoo.com", "Test Subject", "Test <b>Body</b>", "", "","", "myrealaccount", "myrealpassword") I guess I don't understand what to put for the values. HI, you can see it here, what paras you do need. _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "") And don't put the FROM and TO there. I think, then it should work! So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
scythetleppo Posted May 4, 2006 Author Share Posted May 4, 2006 HI,you can see it here, what paras you do need. And don't put the FROM and TO there. I think, then it should work! So long,MegaYesss it works beautiful thanks! Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 4, 2006 Share Posted May 4, 2006 Yesss it works beautiful thanks! One good deed a day. Glad, that I could help.So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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