File: /home/clavospa/public_html/new.davidlachapelleamor.com/models/sendMail.php
<?php
include_once dirname(__FILE__, 2) . '/models/phpMailer/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
class sendMail {
private $email = null;
private $html = null;
public function __construct(){}
public function enviaMail($email, $html, $subject){
$this ->email = $email;
$this ->html = $html;
$mail = new PHPMailer(true);
try {
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'mail.davidlachapelleamor.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'no-reply@davidlachapelleamor.com'; //SMTP username
$mail->Password = 'gdNZ3_0crnzZ'; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = 465; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
$mail->CharSet = 'UTF-8';
//Recipients
$mail->setFrom('no-reply@davidlachapelleamor.com', 'Davidlachapelleamor');
$mail->addAddress($this ->email, 'Davidlachapelleamor'); //Add a recipient
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $this ->html;
$mail->send();
} catch (Exception $e) {
error_log($this ->email . "\t" . $mail->ErrorInfo . "\n", 3, DIR_ROOT.'/logs/'.date("Y-m-d")."_errorSendMail.txt");
}
}
}