使用 PHP imap_open 打开邮箱,DomainFactory 邮件

问题描述 投票:0回答:1

我尝试使用

imap_open()
打开我的邮件服务器。我总是收到此错误:

警告:imap_open():无法打开流 {sslin.df.eu:993/novalidate-cert}

我尝试了这段代码:

{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

我当前的代码:

//The location of the mailbox.
$mailbox = '{sslin.df.eu:993/novalidate-cert}INBOX.';
//The username / email address that we want to login to.
$username = '[email protected]';
//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);
}
}
php email imap imap-open
1个回答
0
投票

解决方案是什么?我现在也有同样的问题。

© www.soinside.com 2019 - 2024. All rights reserved.