Search code examples
phpimapaol

PHP IMAP for AOL - Can't connect to internal-aol.imap.mail.g03.yahoodns.net,143: Timed out (errflg=1)


I've been testing connections to various mail servers and encountered a problem with AOL:

Notice: Unknown: Can't connect to internal-aol.imap.mail.g03.yahoodns.net,143: Timed out (errflg=1) in Unknown on line 0

Now this looks like it's a problem on their end however I haven't been able to confirm that this configuration (beyond my user name and pass word) are valid.

Here is the code I'm using to test the connection:

<?php
echo '<pre>';
//AOL "generate app password": https://login.aol.com/myaccount/security/app-password/
$user = '__user__';
$password = '__password__';
$server = '{imap.aol.com:143/imap/novalidate-cert}';
//$server = '{imap.aol.com:143/imap/ssl}';
$connection = imap_open($server, $user, $password);

if ($connection)
{
 $mailboxes = imap_list($connection, $server,'*');
 echo '<pre>AOL Mailboxes: ';print_r($mailboxes);echo '</pre>'; 
 imap_close($connection);
}
echo '</pre>';
?>

Is the $server valid and secure?

I've also tried {imap.aol.com:143/imap/ssl} however that results in the following error:

Notice: Unknown: Can't connect to internal-aol.imap.mail.g03.yahoodns.net,143: Timed out (errflg=1) in Unknown on line 0

Also note that I've created and am using the "app password" as noted in the code.


Solution

  • The server address was wrong, the correct one is:

    <?php
    $server = '{imap.aol.com:993/imap/ssl}';
    ?>