Jump to content

Server Communicator


themax90
 Share

Recommended Posts

This script will allow you to connect to any mail server, smtp server, http server, ETC. I made this to show how you may be able to retreive email information and thanks to LxP it now works. For example you can connect and goto a mail server, type user <username>, pass <password>, and list, and use various string functions to determine how many messages are there. I will soon be making an email client based on this theory.

#include <GuiConstants.au3>
#include <GuiEdit.au3>
#include <Misc.au3>
Local $Server = InputBox("Server", "Please input the server you would like to connect to:")
Local $Port = InputBox("Server Port", "Please input the port or the server you would like to connect to:")
TCPStartup()
$MainSocket = TCPConnect(TCPNameToIP($Server), $Port)
If $MainSocket = -1 Then Exit MsgBox(0, "Error", "Could Not Connect or Bad Connection")
GUICreate("Server Client", 390, 210)
$Send = GUICtrlCreateEdit("", 10, 10, 175, 150, $WS_VSCROLL)
Local $History = GUICtrlCreateEdit("Mail Server Messages:", 200, 10, 175, 150, BitOR($WS_VSCROLL, $ES_READONLY))
$SButton = GUICtrlCreateButton("Send", 145, 165, 100, 35)
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    ElseIf $msg = $SButton Or _IsPressed ("0D") = 1 Then
        $Text = GUICtrlRead($Send)
        $TCPSent = TCPSend($MainSocket, $Text & @LF)
        GUICtrlSetData($Send, "")
    EndIf
    $Recv = TCPRecv($MainSocket, 512)
    If $Recv <> "" Then
        GUICtrlSetData($History, GUICtrlRead($History) & @CRLF & $Recv)
        _GUICtrlEditLineScroll ($History, 0, _GUICtrlEditGetLineCount ($History))
    EndIf
WEnd
Func OnAutoItExit()
    TCPCloseSocket($MainSocket)
    TCPShutdown()
EndFunc;==>OnAutoItExit

Hope you like,

AutoIt Smith

Edited by AutoIt Smith
Link to comment
Share on other sites

Works very nicely -- a perfect interface to use for learning POP-speak. One quick suggestion:

Local $History = ... $WS_VSCROLL + $ES_READONLY ...

should instead be:

Local $History = ... BitOR($WS_VSCROLL, $ES_READONLY) ...

since this is the way to do it as per the help file:

To combine styles... use BitOr(Style, Style, Style).

Link to comment
Share on other sites

Umm sorry error on my part, I copied and pasted must not have selected all.

Not only can you use APOP, but any of the well known server lists and ANY Server that users TCP if configured correctly.

Edited by AutoIt Smith
Link to comment
Share on other sites

DameWare Mini Remote Control probably has a registered certificate and is registered in the registry, how ever, there should be no problem. Please post what antispyware tool you use and I will alert Jon so he can contact them and have there lists updated.

Link to comment
Share on other sites

  • 2 years later...

Hi, I'm new to TCP functionality and I'm getting a lot of help from all your assorted scripts. I know this post is old but it is linked to in a number of other of your topics regarding TCP and it is used as an example of a client that connects to the example of a server you have. I'm just messing around with it at this point trying to get it to connect.

I know this is my first post and all, but I'm actually posting to point out a possible error. When I run this I connect to the server and just as a test I send /hello to see if I get a response. Instead I get an error on line 26, Unknown function name.

_GUICtrlEditLineScroll ($History, 0, _GUICtrlEditGetLineCount ($History))

I looked up both of those functions and it looks like you have a small typo on both. The code should be:

_GUICtrlEdit_LineScroll ($History, 0, _GUICtrlEdit_GetLineCount ($History))

When I modify the code to match that, it works. Now, I don't want to presume that you've made a mistake or anything, so if this is just something on my end (possibly an autoit version issue considering this post is a few years old and I'm using the latest version) then disregard this message. Although, if anyone else is getting this same error (which would be surprising since it seems like no one has mentioned it yet) then try modifying the code as I did.

Thanks.

Link to comment
Share on other sites

Nice script,

miss when i search info about Autoit mail client and IMAP

Any step in this way ?

is so difficult to read 'mail' if you are inside ? maybe only few information ? (sender, object)

TomZ suggest some way to do this but is too advanced

for my Autoit knowledge

My dream is to give order to a 'server' by mail, an Autoit script can monitor incoming mail and run different task

Any idea ?

Thank you

m.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...