Greetings. My problem is this: I am trying to send emails from my page with the PHPMailer library, but when I press the send button I get the following error:
Fatal error: Uncaught Error: Class 'PHPMailer' not found in C: \ xampp \ htdocs \ email \ contact_me.php: 6 Stack trace: # 0 {main} thrown in C: \ xampp \ htdocs \ email \ contact_me.php on line 6
You're telling me that the PHPMailer class does not exist, I do not understand why, I'm checking the file where that class is and it's all right.
Here I leave the code:
<?php
include 'conexionbd.php';
include 'PHPMailer/src/PHPMailer.php';
$oMail = new PHPMailer();
$oMail->isSMTP();
$oMail->Host = 'smtp.mailtrap.io';
$oMail->Username = ' 45d7f968676e1e';
$oMail->Password = '166b3920081adc';
$oMail->SMTPAuth = true;
$oMail->SMTPSecure = 'tls';
$oMail->Port = 25;
//Datos
$name = $_POST['name'];
$oMail->From = $_POST['email']; //remitente
$oMail->addAddress('[email protected]');
$oMail->Subject = 'HOLA JAVAEVENTOS SOY';
$mail->Body = $_POST['mensaje'];
$oMail->send();
if($oMail->send() == false){
header('Location:socios.php');
echo $oMail->ErrorInfo();
}else{
header('Location:index.php');
}
I check and review the library folder and it's all right, I went into the PHPMailer documentation and I've done everything the same but this error keeps coming up. Please, I would appreciate your help.