我使用codeigniter版本2.2.1发送电子邮件。但它给了我错误。请告诉我为什么 ?这是我的PHP代码。为什么发送电子邮件在codeigniter中不起作用?
$config = array(
'protocol'=>'smtp',
'smtp_host'=>'ssl://smtp.googlemail.com',
'smtp_port'=>465,
'smtp_user'=>'[email protected]',
'smtp_pass'=>'xxx'
);
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', "My Name");
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
return $this->email->print_debugger();
但是当我发送。它给了我这个错误。请问为什么?我尝试了很多方法。但不工作。为什么?
220 smtp.gmail.com ESMTP ci2sm13227458pbc.66 - gsmtp
hello: 250-smtp.gmail.com at your service, [61.4.76.240]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
from: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
to: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
data: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
502 5.5.1 Unrecognized command. ci2sm13227458pbc.66 - gsmtp
The following SMTP error was encountered: 502 5.5.1 Unrecognized command. ci2sm13227458pbc.66 - gsmtp
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Thu, 15 Oct 2015 08:45:28 +0200
From: "War" <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Subject: =?utf-8?Q?subject?=
Reply-To: "[email protected]" <[email protected]>
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Every find bro ? I am here for u .
我使用本地主机的XAMPP。那么我需要在我的本地主机上配置 吗?
其验证失败,意味着用户名或密码不正确 –
对不起。发布错误的错误消息。现在我编辑它。那么请问是什么问题? –
您的startTLS命令未执行,这意味着TLS端口被禁用,或者它们未被添加到防火墙中 –