使用CodeIgniter将电子邮件发送到gmail会显示&“已发送的消息"但是收件箱里没有东西吗? [英] Sending email to gmail with CodeIgniter displays "message sent" but there nothing in the inbox?

查看:62
本文介绍了使用CodeIgniter将电子邮件发送到gmail会显示&“已发送的消息"但是收件箱里没有东西吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注这个了不起的 nettusts +教程关于向gmail发送电子邮件.

I'm following this amazing nettusts+ tutorial about sending a email to gmail.

它显然起作用了.当我加载页面时,它会显示:您的电子邮件已发送,傻瓜." ,但随后我检查了我的gmail,那里什么也没有.

It aparently worked. When I load the page it says: 'Your email was sent, fool.' but then I check my gmail and there's nothing there.

CodeIgniter可以处理所有事情吗?还是我必须在我的PC上安装smtp或其他东西,因为我正在使用localhost(在Ubuntu中为LAMP)?

Does CodeIgniter take care of everything? Or I have to install smtp or something in my PC because I'm using localhost (LAMP in Ubuntu)?

代码:

/* SEND EMAIL WITH GMAIL */

class Email extends Controller {

    function __construct()
    {
        parent::Controller();
    }

    function index()
    {
        $config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => 465,
            'smtp_user' => 'janoochen@gmail.com',
            'smtp_pass' => '***',
        );

        $this->load->library('email', $config);
        $this->email->set_newline("\r\n");

        $this->email->from('janoochen@gmal.com', 'Alex Chen');
        $this->email->to('janoochen@gmal.com');
        $this->email->subject('This is an email');
        $this->email->message('It is working. Great!');

        if($this->email->send())
        {
            echo 'Your email was sent, fool.';
        }

        else
        {
            show_error($this->email->print_debugger());
        }
    }
}

推荐答案

我不知道这是不是,但是在您的代码中,您得到的是 @ gmal.com 而不是> @ gmail.com

I don't know if this is it, but in your code you've got @gmal.com instead of @gmail.com

这篇关于使用CodeIgniter将电子邮件发送到gmail会显示&“已发送的消息"但是收件箱里没有东西吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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