Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

num3thod's avatar

Yet another Mailgun question. Please help.

So I've used mailgun/mandrill in the past without issues. But on this Laravel 5.1 project, I am constantly getting timeouts on live. The error message says "Connection could not be established with host smtp.mailgun.org [Connection timed out #110]".

Yet, I am specifically using the Mailgun driver. Laravel should not be attempting to connect through SMTP (which is blocked by my hosting provider). What is going on here? How do I force Laravel to use the mailgun driver and NOT try smtp?

MAIL_DRIVER=mailgun
'mailgun' => [
        'domain' => env('mydomain.com'),
        'secret' => env('key-a2d3f9XXXXXXXXXXXXXXX'),
    ],
0 likes
2 replies
CorCronje's avatar

Do each and every email message fail, or is the failure intermittent? It may be that the driver connects to smtp.mailgun.org but does not necessarily mean that it is making an SMTP connection.

Since you've used it previously without issue, and if each and every email message fail, it may be a good idea to go over the mail.php file and check your connection parameters. It may also be possible that your AV or firewall proxy the connection, or that there may be DNS related issue.

You could also try using the IP of the host, as opposed to the FQDN, although I recommend this for testing and faultfinding only.

1 like
num3thod's avatar

Yeah, it seems to be a DNS issue. VPS hosts website -> GoDaddy manages email accounts (I know)

I will simply post to another L5 project that has no issues with smtp. Thanks.

Please or to participate in this conversation.