Sto provando un software in locale con XAMPP e non avendo un server smtp da usare per testare il codice o ripiegato sull'uso di un account gmail, con questo codice (puramente di prova)
	
	
	
		
Ma il risultato è il seguente
2019-04-25 08:38:36 Connection: opening to smtp.gmail.com:25, timeout=300, options=array()
2019-04-25 08:38:36 Connection: opened
2019-04-25 08:38:37 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP z13sm15373160wrh.41 - gsmtp
2019-04-25 08:38:37 CLIENT -> SERVER: EHLO localhost
2019-04-25 08:38:37 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [79.30.129.31]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2019-04-25 08:38:37 CLIENT -> SERVER: STARTTLS
2019-04-25 08:38:37 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2019-04-25 08:38:37 Connection failed. Error #2: failed loading cafile stream: `D:\XAMP\apache\bin\curl-ca-bundle.crt' [D:\XAMP\htdocs\dashboard\HSM\class\PHPMailer\src\SMTP.php line 403]
SMTP Error: Could not connect to SMTP host.
2019-04-25 08:38:37 CLIENT -> SERVER: QUIT
2019-04-25 08:38:37 SERVER -> CLIENT: F
2019-04-25 08:38:37 SMTP ERROR: QUIT command failed: F
2019-04-25 08:38:37 Connection: closed
SMTP Error: Could not connect to SMTP host.
Message could not be sent. Mailer Error: SMTP Error: Could not connect to SMTP host.
				
			
		PHP:
	
	<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
// Load Composer's autoloader
require 'src/Exception.php';
require 'src/PHPMailer.php';
require 'src/SMTP.php';
// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
    //Server settings
    $mail->SMTPDebug = 3;                                       // Enable verbose debug output
    $mail->isSMTP();                                            // Set mailer to use SMTP
    $mail->Host       = 'smtp.gmail.com';  // Specify main and backup SMTP servers
    $mail->SMTPAuth   = true;                                   // Enable SMTP authentication
    $mail->Username   = 'nome.cognome@gmail.com';                     // SMTP username
    $mail->Password   = 'password';                               // SMTP password
    //$mail->SMTPSecure = 'tls';                                  // Enable TLS encryption, `ssl` also accepted
    $mail->Port       = 25;                                    // TCP port to connect to
    //Recipients
    $mail->setFrom('nome.cognome@gmail.com', 'Mailer');
    $mail->addAddress('nome.cognome@gmail.net', 'Joe User');     // Add a recipient
    //$mail->addAddress('ellen@example.com');               // Name is optional
    //$mail->addReplyTo('info@example.com', 'Information');
    //$mail->addCC('cc@example.com');
    //$mail->addBCC('bcc@example.com');
    // Attachments
    //$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
    //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
    // Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>
	Ma il risultato è il seguente
2019-04-25 08:38:36 Connection: opening to smtp.gmail.com:25, timeout=300, options=array()
2019-04-25 08:38:36 Connection: opened
2019-04-25 08:38:37 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP z13sm15373160wrh.41 - gsmtp
2019-04-25 08:38:37 CLIENT -> SERVER: EHLO localhost
2019-04-25 08:38:37 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [79.30.129.31]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2019-04-25 08:38:37 CLIENT -> SERVER: STARTTLS
2019-04-25 08:38:37 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2019-04-25 08:38:37 Connection failed. Error #2: failed loading cafile stream: `D:\XAMP\apache\bin\curl-ca-bundle.crt' [D:\XAMP\htdocs\dashboard\HSM\class\PHPMailer\src\SMTP.php line 403]
SMTP Error: Could not connect to SMTP host.
2019-04-25 08:38:37 CLIENT -> SERVER: QUIT
2019-04-25 08:38:37 SERVER -> CLIENT: F
2019-04-25 08:38:37 SMTP ERROR: QUIT command failed: F
2019-04-25 08:38:37 Connection: closed
SMTP Error: Could not connect to SMTP host.
Message could not be sent. Mailer Error: SMTP Error: Could not connect to SMTP host.