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

clarkpd's avatar

Production server not sending emails mailgun

Local server: vagrant homestead

Production server: digital ocean ubuntu 16.04.2 x64 512MB

I am using the mailgun api driver and have been able to send emails on the local server using the same credentials that are on the production server. I have turned on and off my firewall to see if that was the problem. I have checked and double checked that I have guzzlehttp/guzzle installed. I have also tried to send emails defined as Mail::raw as opposed to the inherit MailMessage that is the default for the forgot password setup. I have attempted to send emails defined as a function call on a test route to no avail. The user defined attribute to notify is email just as the default is set.

Any help is much appreciated. Thanks in advance.

Solved: "php artisan config:clear" to clear the cache

0 likes
1 reply
ejdelmonico's avatar

If you used Forge then everything is configured already. Otherwise make sure the appropriate mail port is open (587). Make sure you have the correct .env values.

MAIL_DRIVER="mailgun"
MAIL_HOST="smtp.mailgun.org"
MAIL_USERNAME="[email protected]"
MAIL_PASSWORD="YOUR-PASSWORD"
MAILGUN_DOMAIN="https://api.mailgun.net/v3/YOUR-SITE.com"
MAILGUN_SECRET="key-YOUR_KEY"

Please or to participate in this conversation.