0

I tried to open my mail server with imap_open(). I always get this error:

Warning: imap_open(): Couldn't open stream {sslin.df.eu:993/novalidate-cert}

I tried this code:

{sslin.df.eu:993/novalidate-cert}INBOX
{sslin.df.eu:993}INBOX
{sslin.df.eu:993}
{sslin.df.eu:993/imap/ssl/novalidate-cert}
{sslin.df.eu:993/imap/ssl/novalidate-cert}INBOX
{sslin.df.eu:993/imap/novalidate-cert}INBOX
{sslin.df.eu:993/novalidate-cert}INBOX

my current code:

//The location of the mailbox.
$mailbox = '{sslin.df.eu:993/novalidate-cert}INBOX.';
//The username / email address that we want to login to.
$username = 'example@example.com';
//The password for this email address.
$password = 'xxx';

//Attempt to connect using the imap_open function.
$imapResource = imap_open($mailbox, $username, $password);

//If the imap_open function returns a boolean FALSE value,
//then we failed to connect.
if($imapResource === false){
//If it failed, throw an exception that contains
//the last imap error.
throw new Exception(imap_last_error());
}

//If we get to this point, it means that we have successfully
//connected to our mailbox via IMAP.

//Lets get all emails that were received since a given date.
$search = 'SINCE "' . date("j F Y", strtotime("-7 days")) . '"';
$emails = imap_search($imapResource, $search);

//If the $emails variable is not a boolean FALSE value or
//an empty array.
if(!empty($emails)){
//Loop through the emails.
foreach($emails as $email){
    //Fetch an overview of the email.
    $overview = imap_fetch_overview($imapResource, $email);
    $overview = $overview[0];
    //Print out the subject of the email.
    echo '<b>' . htmlentities($overview->subject) . '</b><br>';
    //Print out the sender's email address / from email address.
    echo 'From: ' . $overview->from . '<br><br>';
    //Get the body of the email.
    $message = imap_fetchbody($imapResource, $email, 1, FT_PEEK);
}
}
ADyson
  • 57,178
  • 14
  • 51
  • 63
Newbie
  • 57
  • 1
  • 7
  • are you closing the imap at the end? – Ibu May 28 '19 at 01:04
  • Is this on your home computer? Or on a server? Is there a firewall? Have you tried a network tool like `openssl s_client` to check connectivity? Can you log in with thunderbird. I can reach that server from here just fine. – Max May 28 '19 at 14:02

0 Answers0