1

我尝试使用 codeigniter 发送电子邮件并执行 print_debugger ..

这是我的控制器

$this->load->library('email');   
     $this->email->from('blablabla@gmail.com', 'Blabla');
     $this->email->to('xxx@gmail.com');    
     $this->email->subject('This is an email test');      
     $this->email->message('It is working. Great!');
    $this->email->send();
     echo $this->email->print_debugger();

和结果..

220 mx.google.com ESMTP s7sm28822467paz.7

hello: 250-mx.google.com at your service, [125.165.91.123]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
250 ENHANCEDSTATUSCODES

from: 250 2.1.0 OK s7sm28822467paz.7

to: 250 2.1.5 OK s7sm28822467paz.7

data: 354  Go ahead s7sm28822467paz.7

250 2.0.0 OK 1357110923 s7sm28822467paz.7

quit: 221 2.0.0 closing connection s7sm28822467paz.7

Your message has been successfully sent using the following protocol: smtp

User-Agent: CodeIgniter
Date: Wed, 2 Jan 2013 08:15:21 +0100
From: "Blabla" 
Return-Path: 
To: xxx@gmail.com
Subject: =?utf-8?Q?This_is_an_email_test?=
Reply-To: "blablabla@gmail.com" 
X-Sender: pendaftaransiswabaruminor@gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <50e3de8936e41@gmail.com>
Mime-Version: 1.0


Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

It is working. Great!

它告诉它成功“您的消息已使用以下协议成功发送:smtp”但是为什么我的电子邮件没有发送?

4

1 回答 1

1

这是我用来在 codeigniter 中发送带有 gmail 地址的电子邮件的配置:

$ci = get_instance();
$ci->load->library('email');
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.gmail.com";
$config['smtp_port'] = "465";
$config['smtp_user'] = "blablabla@gmail.com"; 
$config['smtp_pass'] = "yourpassword";
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['newline'] = "\r\n";

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

$ci->email->from('blablabla@gmail.com', 'Blabla');
$list = array('xxx@gmail.com');
$ci->email->to($list);
$ci->email->subject('This is an email test');
$ci->email->message('It is working. Great!');
$ci->email->send();
于 2013-04-13T18:20:37.980 回答