Search code examples
symfonyswiftmailerovh

Send email problems with OVH hosted websites


I looked a little everywhere but I'm not finding a solution to my problem. There are few months, my emails was working good on my websites on OVH with this configuration (Symfony/Swift_Mailer) :

mailer_transport: smtp
mailer_auth_mode: login
mailer_host: ssl0.ovh.net
mailer_port: 587
mailer_user: [email protected]
mailer_password: *******

This configuration is still working good in local, but not anymore on my websites online (shared hosting, perso offer 2014).

In between, I did evoluate my perso offer on OVH that was from few years already to the 2014 one and I think I did accept the IPv6 (but I don't remember if it was like this before) + I passed to PHP 5.6.

I tried different things like changing the mailer host ns0.ovh.net to ss0.ovh.net, I tried other ports, etc. nothing worked. The error I get all the time is :

Connection could not be established with host ssl0.ovh.net [Connection timed out #110]

and in the Silenced Error (Profiler of Symfony) :

stream_socket_client(): unable to connect to ssl0.ovh.net:25 (Connection timed out)

I already called the customer service of OVH that told me that everything is working good for them and it shloud come from my code, but everything works good in local so I'm a little stuck.

Is that possible that it's coming from the version of PHP ( 7 in local on Apache and in my composer.json of Symfony is written : "php": ">=5.5.9" and on OVH I have the 5.6) ? Or from the IPv6, I read some articles that talks about the possibility of having a connection timed out because of this. Or the service DNSSEC of OVH ?

I'm a little lost in all this and I can't tell from when it's not working anymore, because it's by making a new website that I found out the problem, so it's difficult to tell from what manipulation it can come, knowing that I didn't change anything on my old websites that was working fine before.

Thanks for your help.


Solution

  • I finally found the solution and it looks like it's coming from the fact that the shared hosting from OVH is not supporting the smtp so that we need to use the transport : mail. The smtp was working before so I guess it's coming from the update of the perso offer 2014, but I can't confirm about that.

    Anyway if it can help anyone else, you need to replace all the configuration in your file parameters.yml (in Symfony):

    mailer_transport: smtp
    mailer_auth_mode: login
    mailer_host: ssl0.ovh.net
    mailer_port: 587
    mailer_user: [email protected] (your email address)
    mailer_password: ******* (your password)
    

    by simply :

    mailer_transport: mail
    

    and putting away all the other parameters from the config.yml file too. And you don't need your email address anymore for passing your email that will pass with an address of OVH.

    So in local you can keep the first config, but when your website is on a shared host of OVH just use the mail transport.