Estoy tratando de configurar el PHPMailer y me presenta esta serie de errores.
Warning: require(PHPMailer/src/Exception.php): failed to open stream: No such file or directory in C:\xampp\htdocs\emailer\sendemail.php on line 5
Fatal error: require(): Failed opening required 'PHPMailer/src/Exception.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\emailer\sendemail.php on line 5
==============================================================================
mi código es el siguiente:
==============================================================================
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'path/to/PHPMailer/src/Exception.php';
require 'path/to/PHPMailer/src/PHPMailer.php';
require 'path/to/PHPMailer/src/SMTP.php';
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 2; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'smtp.gmail.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = '[email protected]'; //SMTP username
$mail->Password = 'supersecret'; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$mail->Port = 587; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom('[email protected]', 'Opcional');
$mail->addAddress('[email protected]', 'Andrey Molina Dev'); //Add a recipient //Name is optional
//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 = 'Prueba de proyecto Emailer';
$mail->Body = 'Uso de librerias PHPmailer <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Mensaje enviado';
} catch (Exception $e) {
echo "Error inesperado: {$mail->ErrorInfo}";
}
?>
Ya revisé que los required estén en la ruta especificada.