Jump to content

IMAP Script!


mikeytown2
 Share

Recommended Posts

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

Imap_get.au3 Imap_get.au3 _Base64.au3

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

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

Imap_get.au3 _Base64.au3

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.

Link to comment
Share on other sites

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

Imap_get.au3 _Base64.au3

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Imap_get.au3

Your Input is greatly Appreciated!

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

  • 1 year later...

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.

Link to comment
Share on other sites

  • 2 weeks later...

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?

Link to comment
Share on other sites

  • 2 months later...

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!

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...