CI框架邮件发送失败问题,openssl有,smtp也开了
下面是debug返回的信息220 163.com Anti-spam GT for Coremail System (163com)
hello: 500 Error: bad syntaxThe following SMTP error was encountered: 500 Error: bad syntax
Failed to send AUTH LOGIN command. Error: 503 Error: send HELO/EHLO first
from: 503 Error: send HELO/EHLO firstThe following SMTP error was encountered: 503 Error: send HELO/EHLO first
to: 503 Error: send HELO/EHLO firstThe following SMTP error was encountered: 503 Error: send HELO/EHLO first
data: 503 Error: send HELO/EHLO firstThe following SMTP error was encountered: 503 Error: send HELO/EHLO first
502 Error: command not implemented
The following SMTP error was encountered: 502 Error: command not implemented
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
代码部分我用过论坛里的标准的ci框架email格式发送,寄件人的邮箱是163的已经开启smtp服务,收件人的也是163的开启了smtp服务。我这个错误表示跟目前论坛出现的都不同,我这个openssl也有,smtp协议也开启了,换别的邮箱也还是报这些错误,甚至把下面的代码改改值依旧不行,代码参照这个的
[*]$this->load->library('email');
[*] $config['protocol' = 'smtp';
[*] $config['smtp_host' = 'smtp.163.com';
[*] $config['smtp_user' = 'phpddt1990@163.com';//这里写上你的163邮箱账户
[*] $config['smtp_pass' = 'phpddt;';//这里写上你的163邮箱密码
[*] $config['mailtype' = 'html';
[*] $config['validate' = true;
[*] $config['priority' = 1;
[*] $config['crlf'= "\r\n";
[*] $config['smtp_port' = 25;
[*] $config['charset' = 'utf-8';
[*] $config['wordwrap' = TRUE;
[*]
[*] $this->email->initialize($config);
[*]
[*]
[*] $this->email->from('phpddt1990@163.com', '合肥学院青年志愿者联合会');//发件人
[*] $this->email->to('987044391@qq.com');
[*]
[*] $this->email->message('哈哈,测试邮件发送');
[*] $this->email->send();
[*] echo $this->email->print_debugger();
你的CI版本是多少?
试一下这个配置:
$config['smtp_host'] = 'ssl://smtp.163.com';
$config['smtp_port'] = '465'; //或994
pcjingl 发表于 2015-7-28 19:36
你的CI版本是多少?
试一下这个配置:
都不行
去找版主大人..我相信版主大神会把你解决掉的
:@ 刀锋魅影 发表于 2015-7-29 11:53
都不行
我刚才用163的邮箱测试了一下,没有问题。CI版本3.0
下面是我的邮件测试代码:
// 配置项
$config = array(
'protocol' => 'smtp',
'smtp_host' => '', //SMTP服务器:smtp.163.com
'smtp_port' => '', //25
'smtp_user' => '', //邮箱地址
'smtp_pass' => '', //邮箱密码
'smtp_timeout' => '5',
'charset' => 'utf-8',
'mailtype' => 'text'
);
// 加载类库
$this->load->library('email', $config);
// 邮件
$this->email->from('发件人email地址', 'From email name');
$this->email->to('收件人email地址');
$this->email->subject('测试邮件');
$this->email->message('email正文:这是一封测试是邮件');
// 发送
if($this->email->send())
{
//成功信息
}
else
{
//失败信息
echo $this->email->print_debugger();
}
页:
[1]