Problem when using PHPMailer library

0

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.

    
asked by Alejo Mendoza 03.12.2017 в 02:00
source

1 answer

0

It does not appear that all the files necessary to use that class are present. I would start again:

Download the link package by clicking on the "Download ZIP" button in the lower right corner of the page. extract the zip file

load the language folder, class.phpmailer.php, class.pop3.php, class.smtp.php, and PHPMailerAutoload.php all in the same directory on your server, I like to create a directory on the server called phpmailer to place all of these in.

Include the class in your PHP project:

require_once('phpmailer/PHPMailerAutoload.php');

Author of the response: Drew

the question was this: enter the description of the link here

    
answered by 03.12.2017 / 02:42
source