Error «Unable to connect with TLS encryption» al configurar un servidor SMTP externo

  Sin categoría

También aparece el error «Connection could not be established with host miserver.com :stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed»

En función de la encriptación que queremos utilizar se debe utilizar el puerto 587 para TLS y el 465 para SSL.

Añadir la siguiente línea en el archivo StreamBuffer.php ubicado en vendor/swiftmailer/swiftmailer/lib/classes/swift/transport/

$options = array_merge($options, array('ssl' => array('allow_self_signed' => true, 'verify_peer' => false, 'verify_peer_name' => false)));

Cerca de la línea 263, encima del siguiente texto de la función establishSocketConnection

if (isset($this->params['stream_context_options'])) {
            $options = array_merge($options, $this->params['stream_context_options']);
        }
$streamContext = stream_context_create($options);

Deja un comentario