Problema con envío de correos en Prestashop

Versión de Prestashop: 1.5.0.17 (aunque seguramente será válido para otras versiones)

Hoy después de varias horas intentando averiguar por qué no podía enviar emails a través de la última tienda Prestashop que configuré, por fin di con la solución. El problema era que a pesar de tener la configuración correcta (servidor SMTP externo con todos sus datos bien puestos), al enviar el correo de prueba la tienda me devolvía el odioso mensaje en rojo:

Error: please check your configuration
There was a problem reading line 1 of an SMTP response. The response so far was:
[]. It appears the connection has died without saying goodbye to us! Too many emails in one go perhaps? (fsockopen: #0)

Finalmente, la clave estaba en la parte «the connection has died without saying goodbye to us«, lo que podía significar que, o bien el servidor de correo estaba mal configurado (descartado), o bien el tiempo que Prestashop estaba esperando por una respuesta era insuficiente. Después de dar muchas vueltas por el backend buscando este posible valor de configuración y no encontrarlo (qué raro que no sea un valor configurable), decidí mirar el código. Encontré el problema en las líneas 170 y 274 del fichero /classes/Mail.php, que efectivamente tenían valores que estaba claro que eran insuficientes:

Línea 170 :

$connection->setTimeout(4);

Línea 274 :

$smtp->setTimeout(5);

Cambié los respectivos valores por 5 y 10, y por fin pude ver el mensaje en verde que me indicaba que mis correos se estaban enviando.

Share this post

Related post

  1. Fernando 2013.05.23 2:42pm

    Brillante !!!

    Cambiaron las líneas de referencia por la versión pero están muy cerca y se pueden buscar con 10 y 20 funciona perfecto.

    Muchas gracias

  2. Mattia 2016.03.12 4:30pm

    Ottimo!
    l’unico che funziona tra le soluzioni trovate!

{ Piensa / Think }

"This is a waste of life. [...] the entire educational system in the modern day is nothing more than a cookie cutter processing plant that prepares humans for mostly predefined occupational roles. This element of human life has become so traditionally ingrained, that many falsely consider the nature of ‘having a job’ some form of human instinct. Even parents will ask their kids “What do you want to be when you grow up?” as though there was only one thing. This is disturbing and a violation of human potential." - The Zeitgeist Movement


"He aprendido que hay cosas que pueden ser comprendidas pero que nunca podrán ser explicadas con palabras sin desvirtuar su grandeza" - Andrés Pascual


"You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete." - Buckminster Fuller


"... I am the master of my fate. I am the captain of my soul." - William Ernest Henley