Così che errore ti stampa?codice:/* Namespace alias. */ use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; /* Include the Composer generated autoload.php file. */ require 'C:\xampp\composer\vendor\autoload.php'; /* If you installed PHPMailer without Composer do this instead: */ /* require 'C:\PHPMailer\src\Exception.php'; require 'C:\PHPMailer\src\PHPMailer.php'; require 'C:\PHPMailer\src\SMTP.php'; */ /* Create a new PHPMailer object. Passing TRUE to the constructor enables exceptions. */ $mail = new PHPMailer(TRUE); /* Open the try/catch block. */ try { //Enable SMTP debugging. $mail->SMTPDebug = 3; //Set PHPMailer to use SMTP. $mail->isSMTP(); $mail->SMTPAutoTLS = true; //Set SMTP host name $mail->Host = "smtps.pec.aruba.it"; //Set this to true if SMTP host requires authentication to send email $mail->SMTPAuth = true; //Provide username and password $mail->Username = "areaverde@cert.azienda.it"; $mail->Password = "super_secret_password"; //If SMTP requires TLS encryption then set it $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Set TCP port to connect to $mail->Port = 465; /* Set the mail sender. */ $mail->setFrom('darth@empire.com', 'Darth Vader'); /* Add a recipient. */ $mail->addAddress('mariorossi@pec.it', 'Emperor'); /* Set the subject. */ $mail->Subject = 'Force'; /* Set the mail message body. */ $mail->Body = 'There is a great disturbance in the Force.'; /* Finally send the mail. */ $mail->send(); } catch (Exception $e) { /* PHPMailer exception. */ echo $e->errorMessage(); } catch (\Exception $e) { /* PHP exception (note the backslash to select the global namespace Exception class). */ echo $e->getMessage(); }