Welcome Guest, Not a member yet? Register   Sign In
SMTP fails on localhost
#1

I'm on Windows 10 Pro x64 and using XAMPP 7.4.4 & CI 4.1.1 on a local machine. I'm not able to send an email.

The code and the output:

PHP Code:
$email = \Config\Services::email();
$config = [
    "protocol" => "smtp",
    "SMTPHost" => "___.___.___",
    "SMTPPort" => 587,
    "SMTPUser" => "___@___.___",
    "SMTPPass" => "___",
    "newline"  => "\r\n",
];
$email->initialize($config);
$email->setFrom($config["SMTPUser"]);
$email->setTo("___@___.___");
$email->setSubject("Hey");
$email->setMessage("Howdy?");
$email->send(false);
echo 
$email->printDebugger(); 

Quote:Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in C:\xampp\htdocs\___\system\Email\Email.php on line 2103

220 ___.___.___ ESMTP ___ Corporate Mail Service; Sun, 23 May 2021 14:48:50 +0300

hello: 250-___.___.___ Hello localhost [___.___.___.___], pleased to meet you.
250-ENHANCEDSTATUSCODES
250-SIZE
250-EXPN
250-ETRN
250-ATRN
250-DSN
250-CHECKPOINT
250-8BITMIME
250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI
250-STARTTLS
250 HELP

starttls: 220 2.0.0 Ready to start TLS

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: Sun, 23 May 2021 06:48:48 -0500
From: <___@___.___>
Return-Path: <___@___.___>
To: ___@___.___
Subject: =?UTF-8?Q?Hey?=
Reply-To: <___@___.___>
User-Agent: CodeIgniter
X-Sender: ___@___.___
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <60aa4120963c59.49387580@___.___>
Mime-Version: 1.0


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

Howdy?

The weird thing is the same code in CI3 works:

PHP Code:
$this->load->library('email');
$config = [
    "protocol"  => "smtp",
    "smtp_host" => "___.___.___",
    "smtp_port" => "587",
    "smtp_user" => "___@___.___",
    "smtp_pass" => "___",
    "newline"   => "\r\n",
];
$this->email->initialize($config);
$this->email->from($config["smtp_user"]);
$this->email->to("___@___.___");
$this->email->subject("Hey");
$this->email->message("Howdy?");
$this->email->send(false);
echo 
$this->email->print_debugger(); 

CI3 output:

Quote:220 ___.___.___ ESMTP ___ Corporate Mail Service; Sun, 23 May 2021 15:03:08 +0300

hello: 250-___.___.___ Hello localhost [___.___.___.___], pleased to meet you.
250-ENHANCEDSTATUSCODES
250-SIZE
250-EXPN
250-ETRN
250-ATRN
250-DSN
250-CHECKPOINT
250-8BITMIME
250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI
250-STARTTLS
250 HELP

from: 250 2.1.0 ... Sender ok
to: 250 2.1.5 ... Recipient ok
data: 354 Enter mail, end with "." on a line by itself

250 2.6.0 450 bytes received in 00:00:00; Message id 202105231503083047 accepted for delivery

quit: 221 2.0.0 ___.___.___ closing connection

Your message has been successfully sent using the following protocol: smtp

Date: Sun, 23 May 2021 14:03:06 +0200
From: <___@___.___>
Return-Path: <___@___.___>
To: ___@___.___
Subject: =?UTF-8?Q?Hey?=
Reply-To: <___@___.___>
User-Agent: CodeIgniter
X-Sender: ___@___.___
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <60aa447ad2853@___.___>
Mime-Version: 1.0


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

Howdy?

I've examined the STMP connect methods in both email classes, but couldn't find a noticable difference. If I remove the tls check, it works, but I'm not sure if that's a good idea. So what's the problem here?
Reply


Messages In This Thread
SMTP fails on localhost - by akinuri - 05-23-2021, 05:28 AM
RE: SMTP fails on localhost - by akinuri - 05-23-2021, 07:56 AM
RE: SMTP fails on localhost - by ogomez - 05-23-2021, 11:26 AM
RE: SMTP fails on localhost - by InsiteFX - 05-23-2021, 11:34 AM
RE: SMTP fails on localhost - by paliz - 05-23-2021, 07:17 PM
RE: SMTP fails on localhost - by InsiteFX - 05-23-2021, 08:35 PM
RE: SMTP fails on localhost - by paliz - 05-23-2021, 09:20 PM
RE: SMTP fails on localhost - by InsiteFX - 05-24-2021, 04:03 AM
RE: SMTP fails on localhost - by akinuri - 05-25-2021, 11:34 AM
RE: SMTP fails on localhost - by chaos - 11-23-2022, 10:50 AM
RE: SMTP fails on localhost - by motoroller - 11-23-2022, 02:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB