Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - LesiuNOL

Pages: [1]
1
SSL / SMTP Error: Could not connect to SMTP host.
« on: November 07, 2023, 10:25:22 AM »
Hello,
I have a problem connecting to SMTP with PhpMailer. It's throwing me this error:

SMTP Error: Could not connect to SMTP host. Connection failed. stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

Link to script: https://yaperfumy.pl/mail.php


Code: [Select]
<?php
use PHPMailer\PHPMailer\PHPMailer;
use 
PHPMailer\PHPMailer\SMTP;
use 
PHPMailer\PHPMailer\Exception;

require_once 
__DIR__ '/vendor/phpmailer/phpmailer/src/Exception.php';
require_once 
__DIR__ '/vendor/phpmailer/phpmailer/src/PHPMailer.php';
require_once 
__DIR__ '/vendor/phpmailer/phpmailer/src/SMTP.php';

$mail = new PHPMailer(true);
$mail->SMTPDebug 1;
$mail->isSMTP();
$mail->Host 'mail.yaperfumy.pl';
$mail->SMTPAuth true;
$mail->Username "test@yaperfumy.pl";
$mail->Password "password";
$mail->SMTPSecure "tls";
$mail->Port 587;

$mail->From "test@yaperfumy.pl";
$mail->FromName "Full Name";

$mail->addAddress("lesniewski.jakub94@gmail.com""recipient name");

$mail->isHTML(true);

$mail->Subject "Mail sent from php send mail script.";
$mail->Body "<i>Text content from send mail.</i>";
$mail->AltBody "This is the plain text version of the email content";

try {
    
$mail->send();
    echo 
"Message has been sent successfully";
} catch (
Exception $e) {
    echo 
"Mailer Error: " $mail->ErrorInfo;
}
?>

Pages: [1]