Skip to content
Advertisement

Laravel – No emails sending using mailgun

Server: Digital Ocean

Ubuntu 16.04

Laravel 5.8

I cannot get email to send out of laravel using mailgun.com

In Digital Ocean I have all outgoing ports open on the firewall, I have the correct DNS settings in Digital ocean for TXT and MX records. I have the correct and verified DNS records on my domain registar and mailgun has a green checkmark on all

config/mail.php

JavaScript

config/services.php

JavaScript

Controller

JavaScript

When I change mail driver to log and then check log file it looks great. Everything looks perfect and I have used mailgun before on Laravel 5.5 with no problems. I have also tried the new laravel build method and same issue.

I get no errors, I checked logs on apache2, no logs are appearing in mailgun and of course no email comes through in inbox or spam.

My question is, am I missing anything? What other troubleshooting can I do? Seems like my app isn’t connecting to mailgun correctly.

Advertisement

Answer

I think that in your config/services.php the mailgun.domain should be more like mg.domain.com (or sandboxXXXXXXX.mailgun.org if that’s a dev environment), and not a url like the one you’ve set.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement