in localhost xampp send mail and in Hostinger nothing

0

friends a support please, I am an apprentice of this language, and the following PHP works well on localhost with xampp and then uploaded to the server HOstinger does not send the email and the error appears:

  

Fatal error: require (): Failed opening required   'PHPMailer \ src \ Exception.php'   (include_path = '.: / opt / alt / php70 / usr / share / pear:.: / PHPMailer / src') in   /home/u861627377/public_html/enviar_mail.php on line 6.

I have the PHPmailer folder installed as well. How should I configure the path or what change should I make? Thanks friends.

<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'PHPMailer\src\Exception.php';
require 'PHPMailer\src\PHPMailer.php';
require 'PHPMailer\src\SMTP.php';

//Reseteo variables.
$error = NULL;
//Comprobamos si esta definida el formulario y no es NULL.
if (isset($_POST["email"])){

$dato1 = TRIM($_POST['email']);
$tabla = "members";
require('conexion.php');

$ssql = ("SELECT * FROM $tabla WHERE  correo = '$dato1' ");
$resultado = mysqli_query($enlace,$ssql);
//echo "$dato1  ";
//echo "br    ";

    if (mysqli_num_rows($resultado) > 0)
    {

            $row = mysqli_fetch_row($resultado);
            //echo "$row[5]";

        try {
            $mail = new PHPMailer(true);

            $mail->isSMTP(); // Usar SMTP
            //$mail->isMail();   

            $mail->SMTPOptions = array(
                'ssl' => array(
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                )
            );

            $mail->CharSet = 'UTF-8';
            $mail->Host = "smtp.gmail.com";
            //$mail->Host = "localhost";
            $mail->SMTPAuth = true; // si es isSMTP() es true
            $mail->Username = "[email protected]";
            $mail->Password = "*******"; 
            $mail->SMTPDebug = 0;
            //$mail->SMTPAutoTLS = false;
            //$mail->SMTPSecure = '';
            //$mail->SMTPSecure = 'tls';     // tls 587 o ssl 465 Habilita encriptacion
            $mail->Port = 587;    // Puerto SMTP 587 o 25 ok , 465 naca          
            //$mail->SMTPAuth = false;
            //$mail->SMTPSecure = false;


            $mail->Timeout = 30;
            //$mail->AuthType = 'LOGIN';
            $mail->From = "[email protected]";  //remitente
            $mail->FromName = "SISCLOUD xxx";              // nombre remitente
            $mail->addAddress($row[4]); //destinatario
            //Dirección a la que responderá destinatario.
            //$mail->addReplyTo("[email protected]","Administrador");
            //BCC ->  incluir copia oculta de email enviado.
            //$mail->addBCC("[email protected]");
            //Enviar codigo HTML o texto plano.
            $mail->isHTML(true);
            //Titulo email.
            $mail->Subject = "Envio de Contraseña " ;
            //Cuerpo email con HTML.
            $mail->Body = "Tu contraseña es:   " . $row[5]; //. $row[5]; //Podrias personalizar mediante HTML y CSS :)
            // envio mail
            $mail->send();
            echo "El mensaje fue enviado";
            } catch (Exception $e) {
                echo 'El mensaje no pudo ser enviado. Mailer Error: ', $mail->ErrorInfo;
            }
    } else {
        echo 'Error Usuario NO registrado' ;
        echo "<br>";
        Echo "<a href='index.html'>Retornar</a>";

    }

} 

?> 
    
asked by hcc 12.04.2018 в 00:13
source

0 answers