Search code examples
phpimap

Using php imap_search with FROM option and hotmail account


I have successfully connected to my hotmail account, but when I try to do any sort of imap_search with the 'FROM' option, the webpage runs forever and then later chrome asks to kill the page. imap_search works with the 'ALL' option. Also the 'FROM' option worked with my gmail and yahoo account. Does anyone have any suggestions?

$inbox = imap_open("{pop3.live.com:995/pop3/ssl/novalidate-cert}", "[email protected]", "password")or die(imap_last_error())or die("can't connect: ".imap_last_error());
$emails = imap_search($inbox, 'FROM "[email protected]"');
imap_close($inbox);

Solution

  • Try it by hand:

    $ openssl s_client -connect pop3.live.com:995 -crlf
    ...
    +OK COL0-POP187 POP3 server ready
    

    "POP3 server ready". So it's a POP3 server, not an IMAP server. No surprise, since the hostname says "pop3" and the port number is 995.

    As far as I can tell, Hotmail does not provide IMAP access.