|
用CI写email发送邮件,很是奇怪,我用个人的gtf505055@163.com可以测试成功,配置如下
email.php
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.163.com';
$config['smtp_user'] = 'gtf505055@163.com';
$config['smtp_pass'] = '*******';
$config['mailtype'] = 'html';
$config['validate'] = true;
$config['priority'] = 1;
$config['crlf'] = "\r\n";
$config['smtp_port'] = 25;
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
控制器文件
class Email extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->library('email');
$this->email->from('gtf505055@163.com', 'Your Name');
$this->email->to('785965002@qq.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
}
}
这样可以发送成功,可是当我换成企业邮箱的时候
email.php
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.ym.163.com';//这样的我也试过'smtp.163.com'还是不行
$config['smtp_user'] = 'service@hxyjw.com';
$config['smtp_pass'] = '*******';
$config['mailtype'] = 'html';
$config['validate'] = true;
$config['priority'] = 1;
$config['crlf'] = "\r\n";
$config['smtp_port'] = 25;
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
控制器文件
class Email extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->library('email');
$this->email->from([url=mailto:]'service@hxyjw.com[/url]', 'Your Name');
$this->email->to('785965002@qq.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
}
}
爆出这样的错误220 Welcome to Hmail SMTP server (Version. 1.0)
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.
各位哥哥姐姐们这是这么回事啊,救命啊在线等答案啊
|
|