php Codeigniter SMTP 电子邮件错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23234021/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Codeigniter SMTP Email Error
提问by Catfish
I can't get my emails to send when using SMTP with my codeigniter app.
将 SMTP 与我的 codeigniter 应用程序一起使用时,我无法发送电子邮件。
There are many similar questions on SO, but none that solve my problem so that's why I'm asking again.
SO上有很多类似的问题,但没有一个能解决我的问题,这就是我再次问的原因。
Here's the error i'm getting:
这是我得到的错误:
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: [email protected]
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: [email protected]
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'] = "[email protected]";
$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";
?>
Here's my controller snippet that sends the email:
这是我发送电子邮件的控制器代码段:
// sends the email to
$this->email->from('donotreply@C&JBuilders.us');
$this->email->to('[email protected]');
$this->email->subject('Request from C&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();
回答by Egor Sazanovich
For SSL add ssl://
to Your SMTP host address
对于 SSL 添加ssl://
到您的 SMTP 主机地址
$config['smtp_host'] = "ssl://smtp.zoho.com";