cakePHP-电子邮件客户端:在localhost上阅读gmail收件箱 [英] cakePHP- Email client: Reading gmail inbox on localhost

查看:194
本文介绍了cakePHP-电子邮件客户端:在localhost上阅读gmail收件箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在做一个项目,但我仍然在本地机器上工作。问题是,我似乎无法连接gmail邮箱使用这
插件

I am currently doing a project, but I am still working on the local machine. The problem is that I can't seem to connect the gmail mailbox using this plugin

真正的问题是,我不知道使用插件在localhost上连接gmail帐户的代码。我有这个在我的配置:

The real problem is, that I do not know the code for connecting with gmail account on localhost using the plugin. I have this in my config :

public $emailTicket = array(
        'datasource' => 'ImapSource',
        'server' => 'localhost',
        'connect' => 'imap/tls/novalidate-cert',
        'username' => '************@gmail.com',
        'password' => '*********',
        'port' => '143', //incoming port 
        'ssl' => false,
        'encoding' => 'UTF-8',
        'error_handler' => 'php',
        'auto_mark_as' => array(
        'Seen',
        // 'Answered',
        // 'Flagged',
        // 'Deleted',
        // 'Draft',
        ),
    );

然后cake返回错误:错误:无法在4次重试后获得imap_thread 。 '无法连接到** localhostName **,143:拒绝

Then cake returns an error : Error: Unable to get imap_thread after 4 retries. 'Can't connect to **localhostName**,143: Refused

任何人都知道正确的方法吗?或者如果它可能,我继续工作在本地机器上,如果是,如何?

Anyone knows the correct way to do it? Or if its possible that I continue working on this on the localmachine, if so, how?

在插件代码中,这是如何准备php的imap_open :

Within the plugin code, this is how it prepares the parameters for php's imap_open() :

case 'imap':
                $this->_connectionString = sprintf(
                    '{%s:%s%s%s}',
                    $this->config['server'],
                    $this->config['port'],
                    @$this->config['ssl'] ? '/ssl' : '',
                    @$this->config['connect'] ? '/' . @$this->config['connect'] : ''
                );
                break;

$retries = 0;
            while (($retries++) < $this->config['retry'] && !$this->thread) {
                $this->Stream = imap_open($this->_connectionString, $this->config['username'], $this->config['password']);
                $this->thread = @imap_thread($this->Stream);
            }


推荐答案

传入电子邮件imap服务器设置:

You need to use the Gmail incoming email imap server settings:

public $emailTicket = array(
        'datasource' => 'ImapSource',
        'server' => 'imap.gmail.com',
        'connect' => 'imap/tls/novalidate-cert',
        'username' => '************@gmail.com',
        'password' => '*********',
        'port' => '993', //incoming port 
        'ssl' => true,
        'encoding' => 'UTF-8',
        'error_handler' => 'php',
        'auto_mark_as' => array(
        'Seen',
        // 'Answered',
        // 'Flagged',
        // 'Deleted',
        // 'Draft',
        ),
    );

并且oncourse在您的Gmail帐户启用imap ...

And ofcourse enable imap on your gmail account...

这篇关于cakePHP-电子邮件客户端:在localhost上阅读gmail收件箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆