Hi the community,
I have a problem on smtp configuration of application web Laravel. I have this error when I want to send email via a command line:
Symfony\Component\Mailer\Exception\TransportExceptionConnection could not be established with host "ssl0.ovh.net:587": stream_socket_client(): Unable to connect to ssl0.ovh.net:587 (Connection refused)
at vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php:154
150▕ $streamContext = stream_context_create($options);
151▕
152▕ $timeout = $this->getTimeout();
153▕ set_error_handler(function ($type, $msg) {
➜ 154▕ throw new TransportException(sprintf('Connection could not be established with host "%s": ', $this->url).$msg);
155▕ });
156▕ try {
157▕ $this->stream = stream_socket_client($this->url, $errno, $errstr, $timeout, \STREAM_CLIENT_CONNECT, $streamContext);
158▕ } finally {1 [internal]:0
Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream::Symfony\Component\Mailer\Transport\Smtp\Stream{closure}("stream_socket_client(): Unable to connect to ssl0.ovh.net:587 (Connection refused)", "/home/ulydebp/rent-reminder/vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php")
+13 vendor frames
15 app/Console/Commands/TestSendEmailCommand.php:30
Illuminate\Mail\PendingMail::send(Object(App\Mail\TestEmail))
I also tried to use Gmail's smtp, same result.
Here are the different configurations on the server:
- pro hosting with PHP 8.2
- application web with Laravel 11
- my .env content:
MAIL_MAILER=smtp
MAIL_HOST=ssl0.ovh.net
MAIL_PORT=587
MAIL_USERNAME="EMAIL_DOMAIN"
MAIL_PASSWORD="PASSWORD_EMAIL_DOMAIN"
MAIL_ENCRYPTION=tls
I also called the support team, who unfortunately didn't help me any more than that. They sent me to this url https://help.ovhcloud.com/csm/fr-web-hosting-monitoring-automatic-emails?id=kb_article_view&sysparm_article=KB0052902#envoi-de-mails-a-laide-dun-script-smtp
An idea of what I could do would be most welcome.
Thanks in advance