Jump to content



Photo

IMAP Script!


  • Please log in to reply
9 replies to this topic

#1 mikeytown2

mikeytown2

    Polymath

  • Active Members
  • PipPipPipPip
  • 210 posts

Posted 28 January 2007 - 12:20 PM

I decided to implement IMAP. My big goal in doing all of this is to make a program that gets the AOL mail and forwards it to GMAIL using just the MX records so that the From field in the Email is preserved.

Attached is the IMAP program, tested on AOL, is able to retrieve unread read email header and body
Attached File  Imap_get.au3   3.25KB   387 downloads Attached File  Imap_get.au3   5.57KB   1021 downloads Attached File  _Base64.au3   13.86KB   706 downloads

To Exit program click on Tray Icon and hit Exit then press Cancel.

Any help/input is greatly appreciated!


Used this for help
http://networking.ringofsaturn.com/Protocols/imap.php
http://www.wireshark.org/

EDIT: New Version, Actually Useful Now!

Edited by mikeytown2, 01 February 2007 - 05:58 AM.








#2 orange

orange

    Prodigy

  • Active Members
  • PipPipPip
  • 180 posts

Posted 30 January 2007 - 03:58 AM

I decided to implement IMAP. My big goal in doing all of this is to make a program that gets the AOL mail and forwards it to GMAIL using just the MX records so that the From field in the Email is preserved.

Attached is the IMAP program, tested on AOL, is able to retrieve unread email header and body
Attached File  Imap_get.au3   3.25KB   387 downloads Attached File  _Base64.au3   13.86KB   706 downloads

To Exit program click on Tray Icon and hit Exit then press Cancel.

Any help/input is greatly appreciated!
Used this for help
http://networking.ringofsaturn.com/Protocols/imap.php
http://www.wireshark.org/


I am going to immediatly test this. I have been wanting an IMAP function forever.

#3 NELyon

NELyon

    Do you wanna brew my avatar?

  • Active Members
  • PipPipPipPipPipPip
  • 3,526 posts

Posted 30 January 2007 - 10:50 PM

I decided to implement IMAP. My big goal in doing all of this is to make a program that gets the AOL mail and forwards it to GMAIL using just the MX records so that the From field in the Email is preserved.

Attached is the IMAP program, tested on AOL, is able to retrieve unread email header and body
Attached File  Imap_get.au3   3.25KB   387 downloads Attached File  _Base64.au3   13.86KB   706 downloads

To Exit program click on Tray Icon and hit Exit then press Cancel.

Any help/input is greatly appreciated!
Used this for help
http://networking.ringofsaturn.com/Protocols/imap.php
http://www.wireshark.org/

Tested it, but it only got 501/632 emails. The rest... well... didn't lol.

Oh well, Nice work.

#4 bulbasas

bulbasas

    Seeker

  • New Members
  • 1 posts

Posted 31 January 2007 - 08:53 AM

maybe enother authentication mechanism becose no work whit hmailserver(imap4)
<SEND> 1 capability <RECV> * OK Heloo imap <SEND> 2 authenticate plain <RECV> * CAPABILITY IMAP4 IMAP4rev1 CHILDREN IDLE QUOTA SORT 1 OK CAPABILITY completed <SEND> AGFkbWluQGdlbG1hZ2lzLmx0AGFkbWluMQ== <RECV> 2 NO Unsupported authentication mechanism. <SEND> 3 namespace <RECV>  BAD NULL COMMAND ....


for test imap server:
host:mail.gelmagis.lt
user:test@gelmagis.lt
pass:testpass

#5 mikeytown2

mikeytown2

    Polymath

  • Active Members
  • PipPipPipPip
  • 210 posts

Posted 01 February 2007 - 05:52 AM

Thanks for the input, bulbasas you should be able to login now.
After reading this http://www.ietf.org/rfc/rfc2060.txt i was able to improve the program quite a bit.
It's about ready to be merged with my mx mailing program!

I need your input on this though, let me know how the IMAP client works for you, and if you guys have a good idea on how to make TCPRecv not miss data and still be fast that would be cool. I have a nested loop so that it wont miss anything.

The program is set to receive your Seen emails, the opposite of the one above.
Attached File  Imap_get.au3   5.57KB   1021 downloads


Your Input is greatly Appreciated!

#6 Andrew Peacock

Andrew Peacock

    Wayfarer

  • Active Members
  • Pip
  • 85 posts

Posted 06 March 2007 - 04:29 PM

Hi Mikey,
Great piece of work so far, and just in time for me to use it.

I'll be using it much more as a behind-the-scenes script, to poll a mailbox for specific mails, so I'll be modifying what you've done to make it non-interactive with the user. Once I've done that, I'll fire a copy back to you.

Andy

#7 myspacee

myspacee

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 649 posts

Posted 28 March 2008 - 09:33 AM

Nice script!

In my case i've some error...
_______________________________________________________________________________
<RECV>
220 mailxxxx.eeerrrttt.it ESMTP Sendmail 8.13.8/8.12.11; Fri, 28 Mar 2008 10:18:58 +0100
<SEND>
1 capability
<RECV>
500 5.5.1 Command unrecognized: "1 capability"
<SEND>
2 login "mikey" "mouse"
<RECV>
500 5.5.1 Command unrecognized: "2 login "mikey" "mouse""
<SEND>
3 select "INBOX"
<RECV>
500 5.5.1 Command unrecognized: "3 select "INBOX""
<SEND>
4 fetch 1:* (FLAGS)
<RECV>
500 5.5.1 Command unrecognized: "4 fetch 1:* (FLAGS)"
<SEND>
5 logout
<RECV>
500 5.5.1 Command unrecognized: "5 logout"
______________________________________________________________________________

(server, login and password are invented in this log)


Command result unrecognized, maybe _Base64.au3 is involved ?

Can anyone help me to understand

Thank you!

M.

#8 mikeytown2

mikeytown2

    Polymath

  • Active Members
  • PipPipPipPip
  • 210 posts

Posted 05 April 2008 - 10:09 PM

Nice script!

In my case i've some error...
_______________________________________________________________________________
<RECV>
220 mailxxxx.eeerrrttt.it ESMTP Sendmail 8.13.8/8.12.11; Fri, 28 Mar 2008 10:18:58 +0100
<SEND>
1 capability
<RECV>
500 5.5.1 Command unrecognized: "1 capability"
<SEND>
2 login "mikey" "mouse"
<RECV>
500 5.5.1 Command unrecognized: "2 login "mikey" "mouse""
<SEND>
3 select "INBOX"
<RECV>
500 5.5.1 Command unrecognized: "3 select "INBOX""
<SEND>
4 fetch 1:* (FLAGS)
<RECV>
500 5.5.1 Command unrecognized: "4 fetch 1:* (FLAGS)"
<SEND>
5 logout
<RECV>
500 5.5.1 Command unrecognized: "5 logout"
______________________________________________________________________________

(server, login and password are invented in this log)


Command result unrecognized, maybe _Base64.au3 is involved ?

Can anyone help me to understand

Thank you!

M.


The server keeps saying
Command unrecognized

Is this a POP server and not a SMTP server?

#9 ITMan2000

ITMan2000

    Seeker

  • New Members
  • 1 posts

Posted 12 June 2008 - 09:39 AM

mikeytown2,

Is there a way to add secure IMAP feature in yr function?

Can u provide me the steps required?

#10 mikeytown2

mikeytown2

    Polymath

  • Active Members
  • PipPipPipPip
  • 210 posts

Posted 13 June 2008 - 08:41 AM

mikeytown2,

Is there a way to add secure IMAP feature in yr function?

Can u provide me the steps required?


IMAP in principle works the same as POP. Both send messages to a server and both get a response back.

In my POP v2 script
http://www.autoitscript.com/forum/index.ph...mp;#entry151770
it opens a connection to the secure sever using OpenSSL. It then sends the command though the open command window and reads its response this way as well. I believe that someone made a better implementation of OpenSSL and POP.
http://www.autoitscript.com/forum/index.php?showtopic=64051
Not sure if he has posted a script yet...


Get a script working with POP & SSL before you translate the POP & SSL script over to use IMAP. Doing a google search for RFC IMAP will help fill in any holes and let you understand what is going on.
Good Luck, this is not an easy task!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users