Error sending e-mails from a form using PHPMailer with an Gmail e-mail account

Good day,

This is a form page for the customers to contact us via e-mail:
http://www.libromania.cl/spanish/contactus_spanish.shtml

After press the button “Enviar”, the information is passed to PHPMailer, sending the e-mail using a dummy e-mail created in CPanel noreply@libromania.cl and addressed to our mailbox contacto@libromania.cl, a Gmail account.
All has been working fine for years.

When try to generate an e-mail using the contact page, an error message is generated:
Error: SMTP Error: The following recipients failed: contacto@libromania.cl
SMTP server error: Temporary local problem - please try later

We have tested contacto@libromania.cl account and it is working fine, sending and receiving e-mails.

This is the code calling PHPMailer library:

<?php  
require_once("class.phpmailer.php");
//include("class.smtp.php");
$mail = new PHPMailer(); 
$mail->IsSMTP();
$mail->SMTPAuth = true;
//$mail->SMTPSecure = "ssl";
$mail->Host = "localhost";
$mail->Port = 25;
$mail->Username = "noreply@libromania.cl";
$mail->Password = "*****";

$email = $_POST['email'];
$message_body = "<b>Formulario enviado desde nuestro website:</b><br><br>";
$message_body .= "Nombre: " . $_POST['name'] . "<br>";
$message_body .= "E-mail: " . $_POST['email'] . "<br>"; 
$message_body .= "Asunto: " . $_POST['subject'] . "<br>";
$message_body .= "Comentario: " . $_POST['comment'] . "<br>";

$mail->From = "noreply@libromania.cl"; 
$mail->FromName = "Libromania"; 
$mail->Subject = "Formulario recibido desde website Libromania";
$mail->AddAddress("contacto@libromania.cl", "Contacto Libromania");
   
$mail->WordWrap = 50; 
  
$mail->IsHTML(true);//Para indicar si el mensaje contiene HTML:
$mail->Body = $message_body; 

if(!$mail->Send()) {
  echo "Error: " . $mail->ErrorInfo;
} else {
  header('Location: http://www.libromania.cl/spanish/answer_spanish.shtml');
  die();
}
?>

I’d appreciate any help.

Thanks a lot!!!

How long has this “temporary” been happening?

The following might solve your problem when testing locally.

$mail->Port       = 587;     // Local Host Server - comment out for remote server

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.