【发布时间】:2019-05-29 01:20:58
【问题描述】:
我正在使用 CodeIgniter 版本 2.2.1 发送电子邮件。但这给了我错误。这是我的 PHP 代码:
$config = array(
'protocol'=>'smtp',
'smtp_host'=>'ssl://smtp.googlemail.com',
'smtp_port'=>465,
'smtp_user'=>'xxx@gmail.com',
'smtp_pass'=>'xxx'
);
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from('xxx@gmail.com', "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" <iljimae.ic@gmail.com>
Return-Path: <iljimae.ic@gmail.com>
To: iljimae.ic@gmail.com
Subject: =?utf-8?Q?subject?=
Reply-To: "iljimae.ic@gmail.com" <iljimae.ic@gmail.com>
X-Sender: iljimae.ic@gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <561f4b884c5d7@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Every find bro ? I am here for u .
我正在使用 xampp 的 localhost。我需要在我的 localhost 中配置一些东西吗?
【问题讨论】:
-
认证失败,表示用户名或密码错误
-
对不起。发布了错误的错误信息。现在我编辑了它。那么请问是什么问题?
-
你的 startTLS 命令没有执行,这意味着 TLS 端口要么被禁用,要么没有添加到防火墙中
-
请问如何启用 TLS 端口?
-
你的操作系统是什么?
标签: php codeigniter email authentication