PHPmailer is not sending mails from hosting

Viewed 37

I have developed a small webapp. Before uploading it to hosting*r(hosting provider), I did the tests and everything worked normally. One of the functions of this webapp is that it sends notifications by mail using PHPMailer. But here I have a problem, the emails are sent from localhost, but once in the hosting the emails are no longer sent. I contacted support and they told me that dns records were missing, they gave me a solution, I waited for the dns propagation, but it still does not work.

  • Hosting*r has sendmail by default, I deactivated it.
  • I am not using composer.
  • I tried smtp and ssl and neither works.

Attached is the script I am using:

class Email extends PHPMailer{
<?php
/* librerias necesarias para que el proyecto pueda enviar emails */
require('class.phpmailer.php');
include("class.smtp.php");

---some lines ommited---
public function ticket_asignado($tick_id){
        $this->IsSMTP();
        $this->Host = 'smtp.hostinger.com';//Aqui el server
        $this->Port = 465;
        $this->SMTPAuth = true;
        $this->Username = $this->gCorreo;
        $this->Password = $this->gContrasena;
        $this->From = $this->gCorreo;
        $this->SMTPSecure = 'ssl';
        $this->FromName = $this->tu_nombre = "Ticket Asignado ".$id;
        $this->CharSet = 'UTF8';
        $this->addAddress($correo);
        $this->addAddress($this->admin);
        $this->WordWrap = 50;
        $this->IsHTML(true);
        $this->Subject = "Ticket Asignado";
        //Igual//
        $cuerpo = file_get_contents('../public/AsignarTicket.html'); /*template */

        $cuerpo = str_replace("xnroticket", $id, $cuerpo);
        $cuerpo = str_replace("lblNomUsu", $usu, $cuerpo);
        $cuerpo = str_replace("lblTitu", $titulo, $cuerpo);
        $cuerpo = str_replace("lblCate", $categoria, $cuerpo);
        $this->Body = $cuerpo;
        $this->AltBody = strip_tags("Ticket Asignado");
        return $this->Send();
    }

}
0 Answers
Related