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

lse123's avatar

send Success OK, but I used Mail gun PHP code in Laravel 8.x and Not Laravel 8.x native code

I TRIED SENDING EMAIL in my Laravel 8.x via Mail Gun, but failing, and I think is a configuration setup problem, In fact using Mailgun's in Laravel the PHP code for SMTP at: https://documentation.mailgun.com/en/latest/quickstart-sending.html#send-via-api send Success OK, but I used Mail gun PHP code in Laravel 8.x and Not Laravel 8.x native code... like in:

https://laravel.com/docs/8.x/mail#mailgun-driver https://laravel.com/docs/8.x/mail#failover-configuration

Mail gun Driver

To use the Mailgun driver, first install the Guzzle HTTP library. Then, set the default option in your config/mail.php configuration file to mailgun. Next, verify that your config/services.php configuration file contains the following options:

'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), 'endpoint' => env('MAILGUN_ENDPOINT', 'api.eu.mailgun.net'), ],

CONTROLLER: // CAN YOU SAY A TEST CODE STATEMENT HERE IN LARAVEL 8.X TO TEST ALL OK... TILL HERE IN CONFIG MAIL VIA MAIL GUN?

Mail::to("lsepolis123@gmail.com")->cc("[email protected]")->send(new BookingPlaced());

0 likes
1 reply
lse123's avatar

Do you have any idea how in configuration config\mail.php, etc. files distinguish using mail gun from: mailgun SMTP vs mailgun API... in Laravel 8.x...?

Please or to participate in this conversation.