Я пытаюсь отправить электронные письма из моего приложения CodeIgniter через SMTP-сервер Zoho.
Вот код: $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: [email protected]
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
(удалены личные данные)
Я получаю такое же сообщение при попытке использовать SMTP-серверы Gmail или другую учетную запись. Кто-нибудь может помочь с этим?
Использование Windows 10, XAMPP, CodeIgniter 3.1.9.
php -m
из командной строки илиphpinfo()
из скрипта, чтобы проверить, включена ли она. - person Alex Howansky   schedule 12.07.2018