2013-06-28 188 views
2

嘿家伙即时尝试创建一个重置密码为这个论坛即时开发...无论如何,我跟着一堆指南,并尝试了许多版本,你会看到什么,这是最少的错误。 ..我仍然无法弄清楚什么是错,我可以使用你的帮助。Codeigniter发送SMTP邮件

class CI_Email { //in library email.php 

var $useragent  = "CodeIgniter"; 
var $mailpath  = "/usr/sbin/msmtp"; // Sendmail path 
var $protocol  = "smtp"; // mail/sendmail/smtp 
var $smtp_host  = "smtp.googlemail.com";  // SMTP Server. 
var $smtp_user  = "[email protected]";  // SMTP Username 
var $smtp_pass  = "mypass";  // SMTP Password 
var $smtp_port  = "465";  // SMTP Port 
var $smtp_timeout = 5;  // SMTP Timeout in seconds 
var $smtp_crypto = "";  // SMTP Encryption. Can be null, tls or ssl. 
var $mailtype  = "html"; // text/html Defines email formatting 
var $charset  = "utf-8"; // Default char set: iso-8859-1 or us-ascii 

这是结果:

hello: 
The following SMTP error was encountered: 
Failed to send AUTH LOGIN command. Error: 
from: 
The following SMTP error was encountered: 
to: 
The following SMTP error was encountered: 
data: 
The following SMTP error was encountered:

The following SMTP error was encountered: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. Content-Type: multipart/alternative; boundary="B_ALT_51cd96f2daf24"

This is a multi-part message in MIME format. Your email application may not support this format.

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

My text here...

--B_ALT_51cd96f2daf24 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

我也尝试了很多其他配置的我在网上找到,如:

var $mailpath  = "/usr/sbin/sendmail"; // Sendmail path 
    var $smtp_host  = "ssl://smtp.googlemail.com";  // SMTP Server. 

或:

var $mailpath  = "/usr/sbin/sendmail"; // Sendmail path 
    var $smtp_host  = "ssl://smtp.gmail.com";  // SMTP Server. 

使用SSL协议在smtp_host我越来越无尽的错误无尽的屏幕。

+0

您正在使用什么SMTP端口? –

+0

我使用我发现的指南建议的465端口...即时通讯相当新的东西是有另一个文件,我必须配置端口? – Dennis

+0

你可以接受这两个: var $ smtp_host =“ssl://smtp.googlemail.com”; // SMTP服务器 var $ smtp_port =“25”; // SMTP端口 –

回答

2

我已经使用测试Gmail帐户进行非生产CodeIgniter电子邮件测试,但是当我部署到生产服务器时,我使用ENVIRONMENT常量检测正确的邮件连接设置。

对于Gmail,我发现这些配置设置(我已经把/application/config/email.php)很好地工作:

$config = Array(
     'protocol' => 'smtp', 
     'smtp_host' => 'ssl://smtp.googlemail.com', 
     'smtp_port' => 465, 
     'smtp_user' => '<test-account-name>@gmail.com', 
     'smtp_pass' => '<test-account-password>', 
    ); 

您的电子邮件很有可能被标记为收件人垃圾邮件,直到他们白名单的发件人。

和FWIW,不要编辑核心CodeIgniter文件,你可以提供你的连接细节许多不同的方式。

+0

对不起,延迟...我明天会检查这一天,我离开这些天...这只是我使用相同的配置,但可能我想念别的东西。 – Dennis

+0

感谢沃尔夫的帮助...实际上我使用这种格式来声明我的配置文件,但我有一个服务器的问题,并不得不在php.ini文件中取消对extension = php_openssl.dll的注释 – Dennis