symfonysymfony4mailerionos

Connection could not be established with host "ssl://null:465": stream_socket_client(): php_network_getaddresses: getaddrinfo failed


If I use symfony/mailer in symfony4.4 on the my localhost with mailtrap, it works. No error

But If I try on the server https://my.ionos.fr, it display error like this :

Connection could not be established with host "ssl://null:465": stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known at /vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php:138)"} []

Can anyone please help me? I have tried in .env but no one is working.

MAILER_DSN=smtp://xxx:xxx@smtp.ionos.fr:465?encryption=ssl&auth_mode=login 

MAILER_DSN=sendgrid://KEY@default

Solution

  • You need to check if you have any environment specific yaml configuration files, because they could not use ENV variables, but instead hardcoded ones.

    For example you can have something like this in your config/packages/dev/mailer.yaml

    framework:
        mailer:
            dsn: 'smtp://null'