Support the ongoing development of Laravel.io →
Mail Packages

Sending from localhost, Windows 10, OpenServer!

Settings .env:

MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=0dc42c9b6f41****
MAIL_ENCRYPTION=tls

MAILGUN_DOMAIN=sandbox8f2a44666f194644b026b0c188ab2497.mailgun.org
MAILGUN_SECRET=key-bb6ec37e9d79bdf76e*****

** Settings of services.php:**

'mailgun' => [
        'domain' => env('sandbox8f2a44666f194644b026b0c188ab2497.mailgun.org'),
        'secret' => env('key-bb6ec37e9d79bdf76e****'),
    ],

Controller:

Mail::send('emails.csrfImported', $user, function($message) use ($user) {
        $message->to($user['email']);
        $message->subject('Mailgun Testing');
    });
    dd('Mail Send Successfully');

Error:

ClientException in RequestException.php line 111:
Client error: `POST https://api.mailgun.net/v3//messages.mime` resulted in a `404 NOT FOUND` response:

<!doctype html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 l (truncated...)
in RequestException.php line 111
at RequestException::create(object(Request), object(Response)) in Middleware.php line 65
at Middleware::GuzzleHttp\{closure}(object(Response)) in Promise.php line 203
at Promise::callHandler(1, object(Response), array(object(Promise), object(Closure), null)) in Promise.php line 156
at Promise::GuzzleHttp\Promise\{closure}() in TaskQueue.php line 47
at TaskQueue->run(true) in Promise.php line 246
at Promise->invokeWaitFn() in Promise.php line 223
at Promise->waitIfPending() in Promise.php line 267
at Promise->invokeWaitList() in Promise.php line 225
at Promise->waitIfPending() in Promise.php line 62
at Promise->wait() in Client.php line 129
at Client->request('post', 'https://api.mailgun.net/v3//messages.mime', array('auth' => array('api', null), 'multipart' => array(array('name' => 'to', 'contents' => 'bonbonslicker@gmail.com'), array('name' => 'message', 'contents' => 'Message-ID: <2e8f99b1b97d928c9fca5....

Where problem is and how to solve it?

Last updated 2 years ago.
0

It should be eg

env('MAILGUN_DOMAIN', 'some_default_value') 
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.