我想在我的服务器上使用CakePHP IMAP Custom Datasource。
在 database.php 中我有: -
public $myCustomEmail = array(
'datasource' => 'ImapSource',
'server' => 'test.com',
'username' => 'info@test.com',
'password' => 'email password',
'port' => 143,
'ssl' => true,
'encoding' => 'UTF-8',
'error_handler' => 'php',
'auto_mark_as' => array(
'Seen',
// 'Answered',
// 'Flagged',
// 'Deleted',
// 'Draft',
),
);
当我将port
设置为143
或ssl
设置为true
时,我收到此错误: -
错误:重试4次后无法获取imap_thread。 'radindesign.com的TLS / SSL失败:SSL协商失败'
当ssl
设置为false
或我更改port
时,我收到此错误: -
重试4次后无法获取imap_thread。 'test.com证书失败:自签名证书:/ CN = linux10.centraldnserver.com/emailAddress=ssl@linux10.centraldnserver.com'
IMAP身份验证有什么问题?
答案 0 :(得分:0)
CakePHP IMAP自定义数据源并没有帮助我使用它:
// Configure your imap mailboxes
$mailboxes = array(
array(
'label' => 'Gmail',
'mailbox' => '{imap.gmail.com:993/imap/ssl}INBOX',
'username' => 'yourusername@gmail.com',
'password' => 'yourpassword'
),
array(
'label' => 'My Cpanel website',
'mailbox' => '{mail.yourdomain.com:143/notls}INBOX',
'username' => 'info+yourdomain.com',
'password' => 'yourpassword'
),
array(
'label' => 'Another mail account',
'mailbox' => '{mail.yourdomain.com:143/notls}INBOX',
'username' => 'info@yourdomain.com',
'password' => 'yourpassword'
)
);
//check inbox
$current_mailbox = array(
'label' => 'My Cpanel website',
'mailbox' => '{mail.test.com:143/notls}INBOX',
'username' => 'info@test.com',
'password' => '***'
);
// Open an IMAP stream to our mailbox
$stream = @imap_open($current_mailbox['mailbox'], $current_mailbox['username'], $current_mailbox['password']);
$emails = imap_search($stream, 'SINCE ' . date('d-M-Y', strtotime("-1 week")));
//如果我们有一些电子邮件ID,请将它们从新到旧排序并显示它们 rsort($电子邮件);
$i = 0;
$overview = array();
foreach ($emails as $email_id) {
// Fetch the email's overview and show subject, from and date.
$overview[$i] = imap_fetch_overview($stream, $email_id, 0);
$i++;
}
的var_dump($概观);