Good afternoon, I am trying to send emails using the PHPMailer library through an email from Sendmail. The configuration has worked successfully for me, connecting with the SMTP of Gmail, but when making the connection to the mail of sendmail, it fails. I attach the code:
<?php
session_start();
include_once('clases/class.phpmailer.php');
include_once('clases/class.smtp.php');
EnvioMensaje($_POST['id'],$_POST['name_comer'],$_POST['eml_usr'], $_POST['eml_pas'], $_POST['eml_srv_smtp'], $_POST['eml_pue'], $_POST['eml_env'], $_POST['eml_cit_body']);
function EnvioMensaje($id, $nom_comer, $mail_user, $mail_pass, $mail_smtp, $mail_port, $mail_env,$mail_body){
$asunto = 'Recordatorio de Cita';
$destino = $mail_env;
$mensaje = $mail_body;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = $mail_smtp;
$mail->Port = $mail_port;
$mail->Username = $mail_user;
$mail->Password = $mail_pass;
$mail->AddAddress($destino);
$mail->Subject = $asunto;
$mail->MsgHTML($mensaje);
if($mail->Send()){
echo 'Enviado con exito';
}else
{
print_r($mail);
echo 'No enviado';
}
}
?>
I have tried several configurations but all have given errors. I would appreciate any help.
I enclose a capture of the failure that occurs when trying to send the message: