fromaster123 Posted October 30, 2006 Posted October 30, 2006 (edited) i cant use _InetSMTPMail... i always get error code 50 or 51 (help file) which means it cant open SMTP Session. but when i use the verizon smtp (smtp.verizon.net) it says error 3 which means unable to resolve ip. i try to use outgoing.verizon.net but error code 50 or 51 every time. please help heres code and im using latest beta version can someone please help me so it sends the email? #include <Inet.au3> $s_SmtpServer = "smtp.verizon.net" $s_FromName = "raplsh" $s_FromAddress = "ada" $s_ToAddress = "fromaster123@gmail.com" $s_Subject = "The test" Dim $as_Body[2] $as_Body[0] = "Testing the new email udf" $as_Body[1] = "Second Line" $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 Edited October 30, 2006 by fromaster123
Moderators SmOke_N Posted October 30, 2006 Moderators Posted October 30, 2006 And the question for support is? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
fromaster123 Posted October 30, 2006 Author Posted October 30, 2006 the question is why doesnt it send the email? sorry for not including ques
AceLoc Posted October 30, 2006 Posted October 30, 2006 (edited) Here's a working SMTP emailer, You can just copy & Paste.. or check why yours doesnt work. $a = "Your SMTP Server" $b = "Email Address (Random)" $c = "Password of the (Random) Email" Emailx("From@Example.com", "To@Example.com", "Subject", "Text Body") Func Emailx($d, $e, $f, $g) $h = ObjCreate ("CDO.Message") With $h .Subject = $f .Sender = $d .From = $d .To = $e .TextBody = $g ;.AddAttachment ("");req full dictonairy EndWith With $h.Configuration.Fields .Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $a .Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $b .Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $c .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 .Update EndWith $h.Send Return EndFunc ;==>Emailx Edited October 30, 2006 by AceLoc [quote name='AceLoc']I gots new sunglasses there cool.[/quote]
Schatten Posted October 30, 2006 Posted October 30, 2006 Im using the same shit script as fromaster123 and have the same problems... Why doesnt this script work???
Leykis101 Posted December 6, 2006 Posted December 6, 2006 The problem is you have to login (authenticate) before you can send.
AzKay Posted December 6, 2006 Posted December 6, 2006 This was from a month ago, Anyways, it would be that verizon isnt your isp server? # MY LOVE FOR YOU... IS LIKE A TRUCK- #
mikeytown2 Posted December 13, 2006 Posted December 13, 2006 I got fed up with this UDF so i wrote my own MX mailer (you are the SMTP server!). In other words it sends the mail directly from your computer. Also this is a SMTP client as well.You need 3 files_Base64.au3_INetSmtpMail.au3_INetSmtpMail_Example.au3Make sure to change the example file so the email goes somewhere! Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack
AzKay Posted December 13, 2006 Posted December 13, 2006 If it sends it right from the computer, why does it need an smtp server? # MY LOVE FOR YOU... IS LIKE A TRUCK- #
mikeytown2 Posted December 13, 2006 Posted December 13, 2006 (edited) Here are 2 wikipedia articles about emailhttp://en.wikipedia.org/wiki/Simple_Mail_T...ty_and_Spamminghttp://en.wikipedia.org/wiki/MX_recordThere are several reasonA reason for a SMTP server is for the reply field. If you don't need to get replies from the email you sent out then you do not need to connect to a SMTP server.Spam control. AOL blocks all incoming email from dynamic IP's. Without a SMTP server to act as a middle man you would not be able to send email to an email Hosts that has aggressive anti spam practices (like AOL).So when you send email directly to the MX server you cut out the middle man (the SMTP server)This program doesn't need a SMTP server, but it does have that option. I combined the 2 things into one program because it uses a lot of the same code. Edited December 13, 2006 by mikeytown2 Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack
AzKay Posted December 14, 2006 Posted December 14, 2006 Isnt send smtp and recv pop3? # MY LOVE FOR YOU... IS LIKE A TRUCK- #
Developers Jos Posted December 14, 2006 Developers Posted December 14, 2006 (edited) I believe your providers SMTP server is normally referred to as the "Smart-Host" and is used as a simple entry point for a client where you deliver your mail without needing to worry about the mail delivery. When you decide to deliver the mail yourself on the Target domain's SMTP server ( yes still a SMTP server) you will have to do the following: - retrieve the MX record for the Target domain from your DNS server for each of the recipients of each message. - Set up a session with the found MX SMTP server and deliver the message directly for each of the recipients of each message. - In case of unavailability of one of the target MX Servers, you will have to provide some sort of retry mechanism for only those servers. I wish you luck with these efforts, but if I were you I would install a local "Light" MailServer like Mercury/32 which can take of all these tasks or use you providers Smart-host. Edited December 15, 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.Â
mikeytown2 Posted December 14, 2006 Posted December 14, 2006 When you decide to deliver the mail yourself on the Target domain's SMTP server ( yes still a SMTP server) you will have to do the following:- retrieve the MX record for the Target domain from your DNS server for each of the recipients of each message.- Set up as session with the found MX SMTP server and deliver the message directly for each of the recipients of each message.- In case of unavailability of one of the target MX Servers, you will have to provide some sort of retry mechanism for only those servers.I got 1.5/3 done with the program i made. I didn't bother making a retry mechanism and i think it only sends the message to one recipient. I'm not sure if it would be a good idea to code the missing parts because of the possibility of abuse.Overall very informative, thanks for the info/help explaining this. Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack
Niclas Posted December 18, 2006 Posted December 18, 2006 Hi AceLoc, your script doesn't seem to work for me. I'm only getting the following error: "Line 0 (File "C:\Mailscript.exe"): $m_nachricht.Send $m_nachricht.Send^ ERROR Error: The requested action with this object has failed." "$m_nachricht" stands for your "$h". Does somebody know what the problem is ?
CjW Posted December 19, 2006 Posted December 19, 2006 This works great - until I try to expand the body to more than 2 lines. If I simply change the example-file array declaration to: Dim $as_Body[3] $as_Body[0] = "Testing the new email udf" $as_Body[1] = "Second Line" $as_Body[2] = "Third Line" Then it results in the following error: >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "M:\My Documents\_INetSmtpMail_Example.au3" C:\Program Files\AutoIt3\Include\_INetSmtpMail.Au3 (195) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: _SmtpSend($v_Socket, $as_End[$i_Count], $f_trace) _SmtpSend($v_Socket, ^ ERROR Any clues? Thanks.
AzKay Posted December 19, 2006 Posted December 19, 2006 Look at _INetSmtpMailCom(). # MY LOVE FOR YOU... IS LIKE A TRUCK- #
mikeytown2 Posted December 31, 2006 Posted December 31, 2006 This works great - until I try to expand the body to more than 2 lines. If I simply change the example-file array declaration to: Dim $as_Body[3] $as_Body[0] = "Testing the new email udf" $as_Body[1] = "Second Line" $as_Body[2] = "Third Line" Then it results in the following error: dimension range exceeded.:you need to change the Array declaration from [3] to how ever many lines you have. so if you have 20 lines then... Dim $as_Body[21] $as_Body[0] = "Testing the new email udf" $as_Body[1] = "Second Line" $as_Body[2] = "Third Line" ..... $as_Body[20] = "Line 20" Who's email script are you using just to make support easier for us? Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack
Kkweit Posted April 15, 2010 Posted April 15, 2010 @mickeytown2: I'm using your script and i did add somethings to do what i need to and... it's working ! but i got the following error message: Line 195 (file "...\_INetSmtpMail.Au3"): _Smtpsend($v_Socket, $as_End[$i_Count], $f_trace) _SmtpSend($v_Socket, ^ ERROR Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded. here is the _INetSmtpMail-example.Au3 where did the modification expandcollapse popup#include "_INetSmtpMail.Au3" #include <Constants.au3> #include "_Base64.Au3" Opt("TrayIconDebug", 1) ;EXAMPLE CODE $yyyymd = @MDAY & "/" & @MON & "/" & @YEAR $PingPasserelle = Ping(GetLanGW(), 1200) $PingGoogle = Ping("www.google.fr", 1200) If ($PingPasserelle > 0) Then $pingmsg = "OK" Else $pingmsg = "Echec" EndIf If ($PingGoogle > 0) Then $pingmsg2 = "OK" Else $pingmsg2 = "Echec" EndIf ;FILL THIS IN START $s_FromName = "Netoptima Diagnostic" $s_FromAddress = "diag@netoptima.fr" $s_ToAddress = "support@netoptima.fr" $s_Subject = "My Diag Test" Dim $as_Body[6] $as_Body[0] = "Date : " & $yyyymd & @CRLF $as_Body[1] = "Adresse IP de la machine : " & @IPAddress1 & @CRLF $as_Body[2] = "Adresse IP de la passerelle : " & GetLanGW() & @CRLF $as_Body[3] = "Adresse IP du serveur DNS : " & GetLanDNS() & @CRLF $as_Body[4] = "Resultat du ping de la passerelle (si different de 0 = OK) : " & $pingmsg & @CRLF $as_Body[5] = "Resultat du ping de googgle.fr (si different de 0 = OK) : " & $pingmsg2 & @CRLF $s_Subject = "Rapport diagnotic de la machine de " & @UserName & " a " & @ComputerName ;FILL THIS IN END $b_trace = True ;false no trace window, true trace window displayed $s_helo = @ComputerName ;sometimes WAN IP, localhost or 127.0.0.1 $s_first = "" ;@CRLF ;this is pointless with my UDF, since it will automaticly do it, if need be $s_UserName = "diag@netoptima.fr" ;just declearing it, no need to fill in $s_Password = "75diag95" ;just declearing it, no need to fill in $temp = StringSplit($s_FromAddress, "@") MsgBox(64,"Resultat du test permettant d'etablir un diagnostic de votre machine", _ "Date : " & $yyyymd & @CRLF & _ "Adresse IP de la machine : " & @IPAddress1 & @CRLF & _ "Adresse IP de la passerelle : " & GetLanGW() & @CRLF & _ "Adresse IP du serveur DNS : " & GetLanDNS() & @CRLF & _ "Resultat du ping de la passerelle : " & $pingmsg & @CRLF & _ "Resultat du ping de google.fr : " & $pingmsg2 & @CRLF & _ "Cliquez sur Ok pour valider ce rapport" & @CRLF) If MsgBox(4, "SMTP", "Souaitez envoyez ce rapport, par mail, a votre administrateur reseau ?" & @CRLF & "Click no to send from your computer directly to the mx server (may not work!)") = 6 Then $s_Server = "smtp.netoptima.fr" $s_UserName = _Base64Encode ("diag@netoptima.fr") If $s_UserName Then $s_Password = _Base64Encode ("75diag95") EndIf Else $s_Server = "" ;domain lookup $IP = _INetGetSource ("http://dynupdate.no-ip.com/ip.php") If @error Or $IP = "" Then $IP = "127.0.0.1" EndIf $RunPID = Run(@ComSpec & " /c nslookup " & $IP, "", @SW_HIDE, $STDOUT_CHILD) $name = StringSplit(StdoutRead($RunPID), "Name:", 1) If $name[0] > 1 Then $name = StringSplit($name[2], "Address:", 1) $name = StringStripWS($name[1], 8) Else $name = "No Internet Connection" EndIf $domain = StringSplit($name, ".") If $domain[0] > 1 Then $domain = $domain[$domain[0] - 1] & "." & $domain[$domain[0]] Else $domain = $domain[$domain[0]] EndIf If $domain <> $temp[$temp[0]] Then If MsgBox(4, "MX Servers", "Some MX servers will not accept emails if they don't come from your domain" & @CRLF _ & "Would you like to change this " & @CRLF & $s_FromAddress & " to this " & @CRLF & $temp[1] & "@" & $domain) = 6 Then $s_FromAddress = $temp[1] & "@" & $domain EndIf EndIf EndIf ;call udf If _INetSmtpMail ($s_FromName, $s_FromAddress, $s_ToAddress, $s_Server, $s_Subject, $as_Body, $s_helo, $s_UserName, $s_Password, $b_trace) <> 1 Then MsgBox(0, "Error!", "Mail failed with error code " & @error) Else MsgBox(0, "Success!", "Rapport envoye ! Cliquez sur OK pour lancer l'outil de prise en main a distance") EndIf $csn = Run("C:\Program Files\TeamViewer\Version4\TeamViewer.exe") Func GetLanGW() Local $colItems = "" Local $strComputer = "localhost" Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems If (StringLen($objItem.IPAddress(0)) > 3) And (StringLen($objItem.DefaultIPGateway(0)) > 3) Then If @IPAddress1 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) If @IPAddress2 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) If @IPAddress3 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) If @IPAddress4 = $objItem.IPAddress(0) Then Return $objItem.DefaultIPGateway(0) EndIf Next Else Return @IPAddress1 ; if you dont have Gateway EndIf EndFunc ;==>GetLanGW Func GetLanDNS() Local $colItems = "" Local $strComputer = "localhost" Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems If (StringLen($objItem.IPAddress(0)) > 3) And (StringLen($objItem.DNSServerSearchOrder(0)) > 3) Then If @IPAddress1 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) If @IPAddress2 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) If @IPAddress3 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) If @IPAddress4 = $objItem.IPAddress(0) Then Return $objItem.DNSServerSearchOrder(0) EndIf Next Else Return @IPAddress1 ; if you dont have DNS EndIf EndFunc ;==>GetLanDNS ;=============================================================================== ; ; Function Name: _INetGetSource() ; Description: Gets the source from an URL without writing a temp file. ; Parameter(s): $s_URL = The URL of the site. ; Requirement(s): DllCall/Struct & WinInet.dll ; Return Value(s): On Success - Returns the source code. ; On Failure - 0 and sets @ERROR = 1 ; Author(s): Wouter van Kesteren. ; ;=============================================================================== Func _INetGetSource($s_URL, $s_Header = '') If StringLeft($s_URL, 7) <> 'http://' And StringLeft($s_URL, 8) <> 'https://' Then $s_URL = 'http://' & $s_URL Local $h_DLL = DllOpen("wininet.dll") Local $ai_IRF, $s_Buf = '' Local $ai_IO = DllCall($h_DLL, 'int', 'InternetOpen', 'str', "AutoIt v3", 'int', 0, 'int', 0, 'int', 0, 'int', 0) If @error Or $ai_IO[0] = 0 Then DllClose($h_DLL) SetError(1) Return "" EndIf Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0) If @error Or $ai_IOU[0] = 0 Then DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0]) DllClose($h_DLL) SetError(1) Return "" EndIf Local $v_Struct = DllStructCreate('udword') DllStructSetData($v_Struct, 1, 1) While DllStructGetData($v_Struct, 1) <> 0 $ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct)) $s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1)) WEnd DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0]) DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0]) DllClose($h_DLL) Return $s_Buf EndFunc ;==>_INetGetSource I guess there is no need to say that i'm a newbie with AutoIT Any help or guidance would be appreciate. Thanks
Kkweit Posted April 15, 2010 Posted April 15, 2010 (edited) Updated version of Smtp ? Could you be more specific because i don't know what you mean ! Edited April 15, 2010 by Kkweit
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