Sign in to follow this  
Followers 0
Clever1mba

Send Email Through Telnet code works

18 posts in this topic

#1 ·  Posted (edited)

hello

This code send email through telnet smtp port 25 it works fine but still need improvement like Tcprecv that receive all command currently receving and display

gui

#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

Edited by Melba23

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I did a small optimization to use an array instead of all of those variables, hope you don't mind. I haven't tested it, so if someone wants to let me know, I'd appreciate it :)

Updated the code a little bit...Just a few changes to the Status window.

Edited by Jon

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hello

Thanks MSLx Fanboy it works fine now i have change few more thing code this will change TO: xxxxx@xxx.com every 5 sec im mean text file contain yahoo email list its about 10 email it must be send email to all addresses randomly problem in this code send button not work

if u have little time then try im improve code

#include <GUIConstants.au3>

#include<file.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)

dim $array

_FileReadToArray(@SystemDir & "myfile.txt", $array)

for $line = 0 to $array[0]$input1 = GUICtrlCreateInput("mx1.mail.yahoo.com",70,10,250,20)

$input2 = GUICtrlCreateInput("snip",70,40,250,20)

$input3 = GUICtrlCreateInput(StringStripWS($array[$line],8),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)

$send   = GUICtrlCreateButton("Send", 160, 310, 60, 20)

GUISetState ()

Sleep(1000*5)

If $line = $array[0] Then $line = 0

Next

While 1

$msg = GUIGetMsg()

Select

  Case $msg = $GUI_EVENT_CLOSE

   ExitLoop

  Case $msg = $send

  

   $g_IP = GUICtrlRead($input1)

   Dim $sData[13]

   $sData[0]  = "HELO " & GUICtrlRead($input4) & @CRLF

   $sData[1]  = "MAIL FROM: <" & GUICtrlRead($input2) &">" & @CRLF

   $sData[2]  = "RCPT TO: <" & GUICtrlRead($input3) &"> "& @CRLF

   $sData[3]  = "DATA" & @CRLF

   $sData[4]  = "From:" & GUICtrlRead($input4) & "< " & GUICtrlRead($input2) &" >" & @CRLF

   $sData[5]  = "To:" & GUICtrlRead($input3) & @CRLF

   $sData[6]  = "Subject:" & GUICtrlRead($input5) & @CRLF

   $sData[7]  = "Sender: Microsoft Outlook Express 6.00.2800.1158" & @CRLF

   $sData[8]  = "Mime-Version: 1.0" & @CRLF

   $sData[9]  = "Content-Type: text/plain; charset=US-ASCII" & @CRLF

   $sData[10] = @CRLF

   $sData[11] = GUICtrlRead($input6) & @CRLF

   $sData[12] = "." & @CRLF

   TCPStartup()

   $socket = TCPConnect(TCPNameToIP($g_IP), 25)

  

   If $socket = -1 Then Exit

   Dim $ret[13]

   For $x = 0 To 12

    $ret[$x] = GUICtrlSetData($myedit,TCPSend($socket, $sData[$x]))

    sleep(100)

   Next

  

  EndSelect

 

Wend

Edited by Melba23

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I don't think that will work. You have what looks like an infinite loop in the for-next loop, which will mean that the While loop (which reads the GUIMsg) will not be read...

Maybe adlib a func every 5 sec to change the dest. email?

Edit: This *should* work...Had to fix a teeny tiny bug

Edited by Jon

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

OKAY THANKS AGAIN MSLx Fanboy just need to change bit more like auto send email after 5 sec with new email

Share this post


Link to post
Share on other sites

In that case, make 2 new funcs.

Func SendEmail()
;Email functions
EndFunc

Func MasterAdLib()
ChangeEmail()
SendEmail()
EndFunc

And change the AdLib to the MasterAdLib() function.


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Hello

Here check tcp email sender for multiple emails only u have to do is make

myfile.txt and save in system32 folder or change path

in myfile.txt sequence goes like this

xxxx@xxx1.com

xxxx@xxx2.com

xxxx@xxx3.com

xxxx@xxx100.com

it automaticall send email to all address i hope u like this email sender

still not working with GMAIL.COM i have only test on yahoo.com email addresses

im still working on code

Thanks MSLx Fanboy for optimizing code

if still have time then try to chk for Gmail and try to put Tcprecv for smtp accept commands etc

Share this post


Link to post
Share on other sites

i get these error...

C:\Documents and Settings\Boenders - Van Belle\Mijn documenten\TcpEmail.au3(76,15) : ERROR: TCPStartup() [built-in] called with wrong number of args.

TCPStartup()

~~~~~~~~~~~~~~^

C:\Documents and Settings\Boenders - Van Belle\Mijn documenten\TcpEmail.au3 - 1 error(s), 0 warning(s)

>AU3Check Ended with Error(s).

>Running: (3.1.1.68):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Documents and Settings\Boenders - Van Belle\Mijn documenten\TcpEmail.au3"

C:\Documents and Settings\Boenders - Van Belle\Mijn documenten\TcpEmail.au3 (25) : ==> Subscript used with non-Array variable.:

$input3 = GUICtrlCreateInput(StringStripWS($array[$line],8),70,70,250,20,$WS_DISABLED)

$input3 = GUICtrlCreateInput(StringStripWS($array^ ERROR

>AutoIT3.exe ended.

>Exit code: 0 Time: 6.521


Sapiente vince, rex, noli vincere ferro!

Share this post


Link to post
Share on other sites

I don't think that will work. You have what looks like an infinite loop in the for-next loop, which will mean that the While loop (which reads the GUIMsg) will not be read...

Maybe adlib a func every 5 sec to change the dest. email?

Edit: This *should* work...Had to fix a teeny tiny bug

I have been looking at your code but I still don't get it....

I always get this message

Line 38 (File "D:\AutoIt\send email\Sendemail2.au3"):

TCPStartUp()

^ ERROR

Error: Unknown function name.

Where is your Tcpstartup() Function definition?


_______________________________________[font="Arial"] Bouzzi[/font]Bouzzi@yahoo.comLive From Quebec

Share this post


Link to post
Share on other sites

@bouzzi, you have to have the latest beta.


Who else would I be?

Share this post


Link to post
Share on other sites

Thanks for your code. Is it possible to attach file and how ?

Best regards

Share this post


Link to post
Share on other sites

I get error using this i have latest beta v3.1.1 but i still get the same error as bouzzi had?

Share this post


Link to post
Share on other sites

3.1.1.80 is the current beta one.

Where can i download? its not on main site iv just redownloaded that 1 and same?

Share this post


Link to post
Share on other sites

Where can i download? its not on main site iv just redownloaded that 1 and same?

http://www.autoitscript.com/autoit3/files/beta/autoit/

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Thx

Share this post


Link to post
Share on other sites

#18 ·  Posted

would there be a way to add attachments to a msg?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0