2

我在本地开发环境中设置了 WAMP 服务器(启用了 php_openssl 扩展)。我安装了 Code Igniter 并尝试配置 TankAuth,我想在其中使用 GMail(实际上是 Google Apps)发送测试邮件。

我通过以下 URL 进行配置

根据上面的输入,我更新_send_email了 tank auth 的功能如下

function _send_email($type, $email, &$data)
{
    $this->load->library('email');

    $config['protocol'] = "smtp";
    $config['smtp_host'] = "ssl://smtp.googlemail.com";
    $config['smtp_port'] = "465";
    $config['smtp_user'] = "mymail@youthpark.org";//also valid for Google Apps Accounts
    $config['smtp_pass'] = "mypass";
    $config['charset'] = "utf-8";
    $config['mailtype'] = "html";
    $config['newline'] = "\r\n";

    $this->email->initialize($config); 

    $this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
    $this->email->reply_to($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
    $this->email->to($email);
    $this->email->subject(sprintf($this->lang->line('auth_subject_'.$type), $this->config->item('website_name', 'tank_auth')));
    $this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));
    $this->email->set_alt_message($this->load->view('email/'.$type.'-txt', $data, TRUE));
    //$this->email->send();

    if ( ! $this->email->send())
    {
        show_error($this->email->print_debugger());
    } else {
        //echo('DONE');        
    } 
}

我收到消息mail sent..,但实际上邮件没有发送。有人可以指出我在哪里做错了吗?

在 Gmail 设置中也启用了弹出窗口

4

3 回答 3

1

不要在 Tank Auth 中编辑 _send_email 功能。而是添加

$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.googlemail.com";
$config['smtp_port'] = "465";
$config['smtp_user'] = "mymail@youthpark.org";//also valid for Google Apps Accounts
$config['smtp_pass'] = "mypass";

到“config”文件夹中的文件“email.php”。

这对我有用

于 2012-11-21T14:40:06.670 回答
0

我有同样的问题。以下_send_email功能以及删除/application/config/email.php对我有用:

function _send_email($type, $email, &$data)
{       
    $config['protocol'] = 'smtp'; 
    $config['smtp_host'] = 'ssl://smtp.googlemail.com'; 
    $config['smtp_port'] = 465; 
    $config['smtp_user'] = 'my.email.address@gmail.com'; 
    $config['smtp_pass'] = 'NiceTry'; 
    $config['mailtype'] = 'html';

    $this->load->library('email', $config); 

    $this->email->set_newline("\r\n"); 

    $this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
    $this->email->reply_to($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
    $this->email->to($email);
    $this->email->subject(sprintf($this->lang->line('auth_subject_'.$type), $this->config->item('website_name', 'tank_auth')));
    $this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));
    $this->email->set_alt_message($this->load->view('email/'.$type.'-txt', $data, TRUE));

    if ($this->email->send()) { 
        echo "Sent!"; 
    } else { 
        echo "FAILED"; 
    } 

}

Tank Auth 电子邮件问题让我走上了正确的道路。

于 2013-01-26T01:03:56.213 回答
0

您是否检查日志以查看是否记录了错误?

我使用邮戳来处理所有邮件传递,他们有一些免费发送,并且 CI 也有火花。

我在我的设置开始中使用新项目。核实:

https://github.com/ramirors/DD-Auth

于 2012-10-25T21:56:33.350 回答