How to connect to the box on mail.ru and receive mail from there? imap_open returns an error:

Couldn't open stream

I tried different options:

 $mbox = imap_open("{imap.mail.ru:143/novalidate-cert}INBOX", "логин", "пароль"); $mbox = imap_open("{imap.mail.ru:143/imap/ssl/novalidate-cert}INBOX", "логин", "пароль"); $mbox = imap_open("{pop.mail.ru:110}INBOX", "логин", "пароль"); 

    2 answers 2

     imap_open("{imap.mail.ru:993/imap/ssl}INBOX", "логин", "пароль"); 

    SSL is on port 993 .

    • Does not work. 502 Bad Gateway also tried this. - thecoder 2:49 PM
    • 502 is about nothing. What exactly falls on? Look in the logs, run from the console. I do not have mail.ru account, the given call naturally answers "Please specify user / password". By the way, and mailru support imap does not need to be included in the profile? - Fine
     <?php $stream = imap_open('{imap.mail.ru:993/imap/ssl}', 'тут логин@mail.ru', 'тут пароль') or die("can't connect: " . imap_last_error());; if ($stream) { $n=1; $st = imap_fetchstructure($stream, $n); if (!empty($st->parts)) { for ($i = 0, $j = count($st->parts); $i < $j; $i++){ $part = $st->parts[$i]; if ($part->subtype == 'PLAIN') { $body = imap_fetchbody($stream, $n, $i+1); } else { $body = imap_body($stream, $n); echo('$body: '.imap_body($stream, 1)); } } } imap_close($stream); ?>