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:

After press the button “Enviar”, the information is passed to PHPMailer, sending the e-mail using a dummy e-mail created in CPanel and addressed to our mailbox, 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:
SMTP server error: Temporary local problem - please try later

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

This is the code calling PHPMailer library:

$mail = new PHPMailer(); 
$mail->SMTPAuth = true;
//$mail->SMTPSecure = "ssl";
$mail->Host = "localhost";
$mail->Port = 25;
$mail->Username = "";
$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 = ""; 
$mail->FromName = "Libromania"; 
$mail->Subject = "Formulario recibido desde website Libromania";
$mail->AddAddress("", "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 {

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.