C# checking Hotmail Inbox through HTTP
I am looking for a fast way or a library to check a hotmail inbox using HTTP. Note that it must be through Http and not pop3 or Imap(that is not supported anyway). I need that because I need to connect to several accounts using Http Proxies that is not supported in pop3 sessions. Any kind of help is appreciated.
Thanks buddies =开发者_高级运维]
I believe it is currently not possible without simulating what the user would do within a browser. Easiest way to go is to use "VS2010 Test Professional" or "VS2010 Ultimate" abilities to record a browsing session and generate C# code which does the same! See here, it worked for me quite well out-of-the-box and generates readable code you can re-use in your applications
BWT, those seems to be the existing APIs:
- pop3.live.com, port 995 (SSL Required) for incoming mails;
- smtp.live.com, port 25 (no SSL) or 587 (SSL) for sending e-mail;
- Windows Live Messenger Contacts API (legacy) allows accessing the contacts;
- Windows Live Messenger Connect allows doing anything messenger can do;
- Windows Live Messenger Mailbox properties allow to see the number of mails and unread mails;
There is no official way to read Hotmail using HTTP(S). There used to be DAV but this has been phased out, here is the official statement:
Continuing DAV protocol retirement
Windows Mail & Outlook Connector both use a protocol named DeltaSync that is not documented.
Some people are trying to reverse engineer it like this guy: DeltaSync HU01 decompression code released, but there is asolutely no guarantee this will not evolve - in fact, you can be sure this will evolve :-)
So, you're better off with POP3: Hotmail and MSN Accounts POP3/SMTP Access
You could use a hidden WebBrowser control. And then use the source code to capture the email titles and all. In that answer I explain how to do it.
I think it's the most easy way to do it.
You need to reverse-eningeer the DeltaSync protocol. Use the 32-Bit version of MS-Mail and oSpy to capture the SSL packets + Wireshark to capture the http packets.
This is probably not what you are looking for, but you could tunnel a pop3 connection through http. The down side is that you would need a server somewhere outside your lan that you can connect to. Here is an example: Pop3 over Http
Not sure if this may help:
Hotmail using C#
Try looking at WaTiN. It's a framework we use to perform tests on our webapplication, mimicing user interaction. We also use to to communicate with Mailinator to check dummy emails.
I'm pretty sure WaTiN can be of help here, but the downside is that it will actually open a specific browser, so if you can live with that, it's the way to go.
You could also make webrequests and provide the correct post data to perform a login, it's not that difficult really. Afterwards, just parse the content of the response to check if there's email.
You used to be able to use the System.Net.mail namespace and mailclients to connect to the hotmail servers directly, but i'm not sure if hotmail still allows this.
精彩评论