Swiftmailer times out when trying to send an email from my Symfony App (Flex)

Posted March 18, 2018 8.4k views
MySQLApachePHPEmailUbuntu 16.04

Hello peeps!

I have a Symfony Flex (v4) app on one of my droplets.
I am using SwiftMailer in my app so i can send emails.
It sends to another host (a mail server) the email so it can handles it.

The MAILER_URL is in an Apache2 SetEnv variable and it something like this:

SetEnv MAILER_URL "smtp://"

The log of my applications says that it timed out

[2018-03-17 21:24:36] app.ERROR: Exception occurred while flushing email queue: Connection could not be established with host [Connection timed out #110] [] []
  • In my dev environment it sends the email correctly.
  • Its not a problem of the email service provider.. I’ve checked it and its working great
  • The settings of the connection are correct.. so its not a wrong password nor username nor type of connection nor port of the host…

I am starting to believe that something is blocking it.. maybe i need to add some outbound rule.. any ideas?
Any rule i have to add to my firewall? to my ufw Ubuntu droplet?

Thanks for the help in advance.
I love this community. Much love.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi, can you please post the output of this command? It will check if your Droplet is able to communicate over the ports required to send emails externally:

nc -vz 25
  • Kamai, thanks for your answer!
    Basically I contacted DO for support by opening a ticket and they told me that it got blocked when i updated my billing info, probably because i bought a new droplet.
    They removed it and i was able to send emails.

    But thanks for your answer, that command will be helpful to future users!