Sign in to follow this  
Followers 0
myspacee

Run remote script with mail

7 posts in this topic

Hello to all,

mad idea but can work:

Want to run remote script on my 'server'; but my server must listening with email client.

Is possible to build a simple email client with Autoit ?

Need only to receive object list, with keywords can be simple run other things.

Can anyone help me?

Thank you

M.

Share this post


Link to post
Share on other sites



Hi.

Hello to all,

mad idea but can work:

Want to run remote script on my 'server'; but my server must listening with email client.

Is possible to build a simple email client with Autoit ?

Look at RFC 821: http://www.ietf.org/rfc/rfc0821.txt

Look at autoit's help file for TCPListen.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Dear Rudi, you're refferring to the wrong RFC and the wrong function. Sorry. The right RFC is http://www.ietf.org/rfc/rfc1939.txt (SMTP = send email, POP3 = receive) I've done alot of POP3 work, so I decided to write an example for you (not tested by the way, but should work)

Example of POP3 usage in AutoIt:

TCPStartUp()

$user = "your username on the pop3 server goes here"
$pass = "your password goes here"

;connect
$sock = TCPConnect(TCPNameToIP("mail.yourdomain.com"), 110)
If $sock = -1 Then Exit MsgBox(48, "Error", "Couldn't connect to POP3 server!")

;reveice inital response
Do
  $data = TCPRecv($sock, 1024)
Untill $data <> ""
;Verify data for +OK or -ERR - todo

;send username
TCPSend($sock, "USER " & $user & @CRLF)
Do
  $data = TCPRecv($sock, 1024)
Untill $data <> ""
;Verify data for +OK or -ERR - todo

;send password
TCPSend($sock, "PASS " & $pass & @CRLF)
Do
  $data = TCPRecv($sock, 1024)
Untill $data <> ""
;Verify data for +OK or -ERR - todo

;request number of messages
TCPSend($sock, "STAT" & @CRLF)
Do
  $data = TCPRecv($sock, 1024)
Untill $data <> ""
;Verify data for +OK or -ERR - todo

;parse response
$data = StringSplit($data, " ")

If IsArray($data) and $data[0] > 1 and StringIsInt($data[2]) Then
$numbermessages = $data[2]
  MsgBox(32, "Mail Example", "There are " & $numbermessages & " messages in your POP3 box!")
Else
  MsgBox(48, "Mail Example", "Unexpected response from mailserver!")
EndIf

TCPSend($sock, "QUIT" & @CRLF)
TCPCloseSocket($sock)
TCPShutDown()
Exit
Edited by TomZ

Share this post


Link to post
Share on other sites

Thank you for reply,

but i imagine some step was made in past with Autoit and mail client (here)

Find also a similar product here but i think that Autoit is perfect for these task

Any other suggestion?

Anyone interested ? (possible?)

Think application...

M.

Share this post


Link to post
Share on other sites

This is certainly possible in AutoIt. Why doesn't my example meet your needs (or did you miss my post?)?

Share this post


Link to post
Share on other sites

TomZ,

sorry i miss your post (write reply in same time)

Your script return number of mail, is good start, but my goal is buld mini-client to read

only few informations (sender, object).

My idea is to send an email to my home pc and do some task

(mad idea here)

thank you for script and info,

thank to rudi too, you reply is funny :)

m.

Share this post


Link to post
Share on other sites

I'd like to give you a hint on adapting my script to actually receive email's. I believe you should use TCPSend($sock, "RETR message_number" & @CRLF);

This will then start outputting the contents of the message with the number you sent to the server, ending with a dot. Like so:

Message header

Message header

....

Message body

Message body

....

(Attachments)

. <--- ending dot

Message numbers range from 1 to the number of messages the script gives you.

Other usefull commands may be LIST and DELE.

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