Laravel 8 Mailgun Integration Not Working Without Error Messages

I’m having trouble with Mailgun email delivery in my Laravel 8 application. The emails aren’t being sent but there are no error messages showing up anywhere. When I remove the Mailgun credentials from my environment file, still no errors appear.

I’m using Mailgun’s free sandbox domain in the US region. Here’s my configuration:

.env settings:

MAIL_MAILER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_NAME="${APP_NAME}"
MAILGUN_DOMAIN=https://api.mailgun.net/v3/....mailgun.org
MAILGUN_SECRET=abc123xyz

config/services.php:

<?php

return [
    'mailgun' => [
        'domain' => env('MAILGUN_DOMAIN'),
        'secret' => env('MAILGUN_SECRET'),
    ],
    
    'ses' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    ],
];

My mailable class:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class WelcomeEmail extends Mailable
{
    use Queueable, SerializesModels;

    public function __construct()
    {
        //
    }

    public function build()
    {
        return $this
            ->from('[email protected]')
            ->markdown('emails.welcome');
    }
}

Controller code:

Mail::to('[email protected]')->send(new WelcomeEmail());

I have Guzzle HTTP client installed version 7.4 so that shouldn’t be the issue. The frustrating part is there are no error messages to help debug this. Has anyone encountered this before?

check your mail queue config - if ur using queues, jobs might be failing silently. run php artisan queue:work to see what’s happening. ur also missing MAIL_FROM_ADDRESS in .env, which Mailgun needs. add [email protected] and ensure it matches ur domain.

Your MAILGUN_DOMAIN config is wrong. You’re putting in the full API URL when it should just be the domain name. Fix your .env file like this:

MAILGUN_DOMAIN=sandbox123abc.mailgun.org

Drop the “https://api.mailgun.net/v3/” part - just use the domain. Laravel builds the API URL automatically.

Also check that your MAIL_FROM_ADDRESS matches an authorized sender in Mailgun. With sandbox domains, you can only send to verified recipients you’ve added in the Mailgun panel.

Wrap your mail code in try-catch or check storage/logs/laravel.log for the real error messages. Mailgun errors often show up there even when they don’t surface elsewhere.

I encountered a similar issue before, and it turned out to be related to the log driver configuration. Laravel may suppress Mailgun errors depending on your LOG_LEVEL setting. Temporarily set LOG_LEVEL=debug in your .env file and then check storage/logs/laravel.log after attempting to send an email.

Additionally, verify your Mailgun endpoint configuration to ensure you’re using the correct API endpoint for your region. Since you’re using the US region, double-check that this aligns with what’s specified in your Mailgun dashboard.

It can also be helpful to directly test your Mailgun credentials using curl. This will help you determine whether the problem lies within your Laravel configuration or if it’s an authentication issue with Mailgun itself. Silent failures are often indicative of underlying authentication problems that haven’t been logged appropriately.