Swift_TransportException · Connection could not be established with smtp.sendgrid.net [Connection timeout: 110]

I am using Laravel 4.2 which uses swiftmailer lib for email. I am trying to use the Sendgrid SMTP service, but I am getting a timeout error on my staging server.

Everything works fine in my local development.

Mail.php

return array(
    'driver' => 'smtp',
    'host' => 'smtp.sendgrid.net',
    'port' => 587,
    'encryption' => 'tls',
    'username' => 'username'
    'password' => ...

I have a switch to port 465 and 'ssl', it works on local, but not luck on the server. OpenSSL is enabled on the server.

Interestingly, Mandrill smtp (this uses a different laravel driver), and the local SMTP server works fine on the server.

. telnet sendgrid . IPv4 - , smtp.gmail.com IPv4 IPv6. .

:

    $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);
    if (false === $this->_stream) {
        throw new Swift_TransportException(
            'Connection could not be established with host '.$this->_params['host'].
            ' ['.$errstr.' #'.$errno.']');

, , , , swiftmailer stream_socket_client php , . mac, centOS.

+4
1

, 587. , , , , .

+5

Source: https://habr.com/ru/post/1620381/


All Articles