代码点火器 SMTP 错误

Codeigniter SMTP error

我正在尝试通过 Zoho SMTP 服务器从我的 CodeIgniter 应用程序发送电子邮件。

代码如下: $this->load->library('email');

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.zoho.com';
$config['smtp_user'] = '<username>';
$config['smtp_pass'] = '<password>';
$config['smtp_port'] = 465;
$config['smtp_crypto'] = 'ssl';
$config['mailtype'] = 'text';

$this->email->initialize($config);

$this->email->from('<mail>', '<name>');
$this->email->to('<mail>');
$this->email->subject("Test");

$this->email->message("Test message");

if(!$this->email->send()){
    echo $this->email->print_debugger();
}

我得到了这个输出:

220 mx.zohomail.com SMTP Server ready July 12, 2018 10:58:40 AM PDT

hello: 250-mx.zohomail.com Hello [::1] (83.240.61.40 (83.240.61.40))
250-STARTTLS
250 SIZE 53477376

starttls: 220 Ready to start TLS.

hello: 250-mx.zohomail.com Hello [::1] (83.240.61.40 (83.240.61.40))
250-AUTH LOGIN PLAIN
250 SIZE 53477376

from: 250 Sender  OK

to: 250 Recipient  OK

data: 354 Ok Send data ending with .


quit: 

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.

Date: Thu, 12 Jul 2018 19:58:40 +0200
From: <from>
Return-Path: <from>
To: me@jradl.cz
Subject: =?UTF-8?Q?Test?=
Reply-To: <from>
User-Agent: CodeIgniter
X-Sender: <from>
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <id>
Mime-Version: 1.0


Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Test message

(已删除个人数据)

我在尝试使用 Gmail SMTP 服务器或其他帐户时收到相同的消息。有人可以帮忙吗?

使用 Windows 10,XAMPP,CodeIgniter 3.1.9。

好的,所以我只是通过添加这一行解决了这个问题:

$this->email->set_newline("\r\n");