T
T
tosterphp2016-08-20 17:18:04
Yii
tosterphp, 2016-08-20 17:18:04

Swiftmailer yii2 or fsockopen on smtp.yandex.ru?

For the second day I can not set up the usual sending to the mail! In config:

'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'ssl://smtp.yandex.com',
                'username' => $params['supportMail'],
                'password' => 'pass',
                'port' => '465',
                'encryption' => 'ssl',
            ],

I tried different options, both with and without ssl, and yandex.ru and yandex.com, and put the ssl certificate on the server, and tried tls and port 587, nothing helps. With the config above, it throws the following error:
Exception 'Swift_TransportException' with message 'Connection could not be established with host ssl://smtp.yandex.com [php_network_getaddresses: getaddrinfo failed: Name or service not known #0]'

If, for example, I remove 'ssl://', ​​then this:
Exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.yandex.com [Connection timed out #110]'

As I understand it, the first error is due to fsockopen, and the second one is most likely just an incorrect setting and falls off by timeout. tried with fsockopen:
fsockopen('ssl://smtp.yandex.com', 465, $errno, $errstr, 10); // по тайм ауту ошибка
fsockopen('ssl://smtp.gmail.com', 465, $errno, $errstr, 10); // тоже самое, просто решил попробовать
fsockopen('mysitedomain.ru', 443, $errno, $errstr, 10); // на мой сайт нормально коннектится c ssl:// и без

phpinfo says ssl is enabled. What could be the problem? Elementary mailing! I have vps.
Even ports all opened outgoing:
iptables -P OUTPUT ACCEPT

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nazar Mokrinsky, 2016-08-20
@nazarpc

Use port 587 and tls.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question