微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – Codeigniter SMTP电子邮件错误

使用带有我的codeigniter应用程序的SMTP时,我无法收到要发送的电子邮件.

在SO上有很多类似的问题,但没有一个可以解决我的问题,所以这就是为什么我要再问一次.

这是我得到的错误

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.

User-Agent: CodeIgniter
Date: Tue, 22 Apr 2014 22:54:12 -0400
From: 
Return-Path: 
To: myemail@gmail.com
Subject: =?utf-8?Q?Request_from_C&J_Builders_Contact_form?=
Reply-To: "donotreply@C&JBuilders.us" 
X-Sender: donotreply@C&JBuilders.us
X-Mailer: CodeIgniter
X-Priority: 3 (normal)
Message-ID: <53572b54551be@C&JBuilders.us>
Mime-Version: 1.0


Content-Type: text/plain; charset=utf-8
Content-transfer-encoding: 8bit

From: jeff
Email: jeff@gmail.com
Phone: 555555555
Message: asdfs fds

Here's my config/email.PHP:
<?PHP  if (!defined('BASEPATH')) exit('No direct script access allowed');

$config['useragent'] = "CodeIgniter";
$config['protocol'] = "smtp";
$config['_smtp_auth']   = TRUE;
$config['smtp_host'] = "smtp.zoho.com";
$config['smtp_user'] = "donotreply@cjbuilders.info";
$config['smtp_pass'] = "mypassword";
$config['smtp_port'] = 465;
$config['wordwrap'] = TRUE;
$config['wrapchars'] = 76;
$config['mailtype'] = "text";
$config['charset'] = "utf-8";
$config['validate'] = FALSE;
$config['priority'] = 3;
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['bcc_batch_mode'] = TRUE;
$config['bcc_batch_size'] = "200";

?> 

这是我发送电子邮件的控制器代码段:

// sends the email to 
$this->email->from('donotreply@C&JBuilders.us');
$this->email->to('myemail@gmail.com');
$this->email->subject('Request from C&amp;J Builders Contact form');
$this->email->message('From: '.$this->input->post('name')."\n".
              'Email: '.$this->input->post('email')."\n".
              'Phone: '.$this->input->post('phone')."\n".
              'Message: '.$this->input->post('message')."\n");
$this->email->send();
echo $this->email->print_debugger();

解决方法:

对于SSL,将ssl://添加到SMTP主机地址

$config['smtp_host'] = "ssl://smtp.zoho.com";

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐