php – Error al configurar PHPMailer

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:xampphtdocsemailersendemail.php on line 5

Fatal error: require(): Failed opening required ‘PHPMailer/src/Exception.php’ (include_path=’C:xamppphpPEAR’) in C:xampphtdocsemailersendemail.php on line 5


mi código es el siguiente:


    use PHPMailerPHPMailerPHPMailer;
    use PHPMailerPHPMailerException;
    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       = '';                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = '';                     //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`
        $mail->setFrom('', 'Opcional');
        $mail->addAddress('', 'Andrey Molina Dev');     //Add a recipient //Name is optional
        //$mail->addAttachment('/var/tmp/file.tar.gz');         //Add attachments
        //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    //Optional name
        $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';
        echo 'Mensaje enviado';
    } catch (Exception $e) {
        echo "Error inesperado: {$mail->ErrorInfo}";

Ya revisé que los required estén en la ruta especificada.