Is there a way to retrieve EMAIL (not contacts) using a Hotmail PHP Api? Is there EVEN one?
4 Answers
Good question. Hotmail supports POP3 so have a look into the PECL POP3 library. It's not likely going to be easy but I don't see any reason why you shouldn't be able to get something working.
UPDATE:
I've never actually used the PECL POP3 Library before, I just knew it existed. I've had a better look at the files and it's pretty easy to follow. The README is only 37 lines as is very clear about how to install it. It also comes with 2 examples, one shows how to use the library procedurally, the other how to use it as an Object for OOP designed systems.
You will have to be able to edit your php.ini to add the extension but I doubt you're going to get around that for any solution to this problem.

- 21,038
- 13
- 59
- 90
-
@Jahkr: That's just one mirror, others work fine - http://www.php.net – Piskvor left the building Feb 13 '11 at 09:33
-
Using this extension imposes several limitations. One of them is that if you do not control your own server, you need to beg to the hosting company to install it and often they do not do it for you. Another problem is that it does not provide a means to retrieve messages in small chunks at a time. This means that if you retreive a large message with this extension, it will exhaust your PHP memory limits and crashes your PHP script. The [http://www.phpclasses.org/pop3class][POP3 class] mentioned by alecgorge answer does not have neither these problems. – mlemos Feb 20 '11 at 05:15
-
@mlemos I'm going to assume you're the author of that pop3 package. Given the phpclasses site is massively unresponsive for me (pages not loading etc...) I can't really find out much about it. Personally I wold still go with the PECL extension as I prefer code that has had more eyes of the community on it. If you're writing something like this, you shouldn't really be on a hosted account. You should at least be on a VPS. – Endophage Feb 20 '11 at 07:48
-
1I have never had a problem with the phpclasses site. Also, maybe he wants his code to be portable. – Alec Gorge Feb 20 '11 at 16:25
-
1@Endophage there is nothing unresponsive now in the site. It seems your prejudice. Anyway, the site itself does not matter. I am talking as the developer of the POP3 and MIME parser classes. I use them in my projects, so I eat my own dog food. The fact is that classes do not depend on any non-standard PHP extension and can deal with arbitrarily long messages without exceeding PHP memory limits. You may not be able to do that with the PECL extension. The POP3 class itself even provide streams support, so you can access messages like file, for instance using fopen('pop3://user@password:server'.. – mlemos Feb 20 '11 at 21:53
-
@mlemos Prejudiced? No. Biased? Yes. So are you though. Of course you are going to stand up and defend your package. I expect you to. None the less, I favour software that is a product of an open source community, not something written by one individual who says it does the job. If I were to use your classes, I would feel it a necessity to make sure your code doesn't steal my user details. The PECL extension on the other hand, I trust has had enough eyes on it that it is unlikely to have anything malicious. I'm just highly security conscious. – Endophage Feb 20 '11 at 23:26
-
@Endophage, there is some confusion here. The POP3 class has been published as Open Source since 1999 when it was released. Since it is written in PHP, anybody can see it does NOT steal any user details. Claiming that that a provel PHP Open Source class is insecure, just makes evident that you never seen it and still making judgements about it. That is prejudice to me. FYI, the site recorded 39,000 registered users have downloaded the class. There are no claims that it is insecure. Otherwise I would like to know. – mlemos Feb 21 '11 at 00:22
-
@mlemos I never said it was insecure. I said I would feel it a necessity to make sure it isn't. Licensing something as open source isn't the same as having a community of developers working on it. – Endophage Feb 21 '11 at 03:06
-
No, actually you said worse things, you raised suspicions that the POP 3 class could be stealing user passwords. What I am telling you is that it would be silly if the class did that because it is Open Source and anybody can look at the code and see that it does not do anything malicious. As for your claim that the class does not have developers working on it, just check Freshmeat and see that both the POP 3 and MIME parser classes had many regular updates over the years to address bugs and user wishes. http://freshmeat.net/projects/pop3class http://freshmeat.net/projects/phpmimemaildecoder – mlemos Feb 21 '11 at 05:17
-
@mlemos All those updates on freshmeat look to be by you. I'm sorry if I don't trust one individual who is a total stranger to me... – Endophage Feb 21 '11 at 17:51
-
Those updates is just to show you that these classes have been frequently updated over the years to addresss bug reports, feature requests and patches. It does not show who actually did what in the project because Freshmeat only allows one person to update the project in their site. Whether or not you trust code you never seen, it is not relevant to the original poster and everybody else reading this. The code is Open Source and anybody can verify it does what it claims it does and there is nothing malicious in it as you imply. – mlemos Feb 21 '11 at 18:37
-
Use the PHP POP3 and Mimetype classes: http://www.phpclasses.org/package/2-PHP-Access-to-e-mail-mailboxes-using-the-POP3-protocol.html and http://www.phpclasses.org/package/3169-PHP-Decode-MIME-e-mail-messages.html
If you change the information in this sample file you should be able to read the messages: http://www.phpclasses.org/browse/file/21753.html
Configuration information for Hotmail: http://www.ghacks.net/2009/03/14/hotmail-pop3-configuration/
Ask if you need more clarification.

- 17,110
- 10
- 59
- 71
-
You may also want to take a look at this article that teaches how to process incoming e-mail using that POP3 PHP class. http://www.phpclasses.org/blog/package/2/post/1-Process-incoming-email-messages-using-PHP.html – mlemos Feb 17 '11 at 07:22
You can try using IMAP,POP3,NNTP of PHP It provides functions that you want. It provides installation guidelines. Also details for run time configuration.
Hope this helps.
-
This is exactly what I would suggest but I would also suggest using a pre-built mail class for making it extremely easy. Something like Zend Framework's [Zend_Mail](http://framework.zend.com/manual/en/zend.mail.read.html) – KSolo Feb 15 '11 at 15:53
-
@KSolo: yes if he wants and requires he can also use zend_mail. It will make task easy(as per I think). – Harry Joy Feb 16 '11 at 04:11
Hotmail supports POP3 access since late 2009 so you should normally be able to retrieve the messages in Hotmail with a pop3 connector. The easiest one I know of is Zend Framework and Zend_Mail_Storage_Pop3. Since ZF is so widely used you are most likely to find tutorials and help on using these libraries.
Connection details on how to connect to a Hotmail account through pop3 are at the official pop3 announcement blogpost on the windows live blog.

- 14,370
- 16
- 70
- 107
-
Hotmail has supported POP3 since much longer ago than 2009. I was using POP3 with hotmail about 10 years ago. – Endophage Feb 20 '11 at 00:46
-
correct, but not worldwide and for their free accounts. http://windowslivewire.spaces.live.com/blog/cns!2F7EB29B42641D59!32413.entry – ChrisR Feb 20 '11 at 21:40