使用CakePHP IMAP自定义数据源检查电子邮件
我想在服务器上使用带有CakePHP IMAP自定义数据源的电子邮件 在database.php中,我有:- 当我将使用CakePHP IMAP自定义数据源检查电子邮件,cakephp,imap,Cakephp,Imap,我想在服务器上使用带有CakePHP IMAP自定义数据源的电子邮件 在database.php中,我有:- 当我将port设置为143或ssl设置为true时,我得到以下错误:- 错误:重试4次后无法获取imap_线程。'radindesign.com的TLS/SSL失败:SSL协商失败' 当ssl设置为false或我更改端口时,我会出现以下错误:- 重试4次后无法获取imap_线程。'test.com的证书失败:自签名证书:/CN=linux10.centraldnserver.com/em
port
设置为143
或ssl
设置为true
时,我得到以下错误:-
错误:重试4次后无法获取imap_线程。'radindesign.com的TLS/SSL失败:SSL协商失败'
当ssl
设置为false
或我更改端口时,我会出现以下错误:-
重试4次后无法获取imap_线程。'test.com的证书失败:自签名证书:/CN=linux10.centraldnserver.com/emailAddress=ssl@linux10.centraldnserver.com"
IMAP身份验证有什么问题?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'
)
))
//如果我们有一些电子邮件ID,将它们从新到旧排序并显示出来
rsort(电子邮件)
var_dump($概述) 我想您必须添加到连接字符串中(不要在生产中使用!)。数据源不支持这一点,因此您可以将其添加到第530行中,并向存储库发送一封电子邮件。
// 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")));
$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++;
}