Skip to content

codemonkey76/ValidateMailgunMiddleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

ValidateMailgunMiddleware

Middleware to Validate Mailgun Webhook

Add the following to your config/mail.php file

'webhook' => ['signing_key' => env('MAILGUN_WEBHOOK_KEY')],

Add the API Key to your .env file

MAILGUN_WEBHOOK_KEY=

make sure you disable CSRF protection for the mailgun webhook URI by adding the following to app\Http\Middleware\VerifyCsrfToken.php

protected $except = ['/Mailgun-Webhook-Uri'];

then just move the ValidateMailgun.php file to your app/Http/Middleware folder and add the middleware to your route in routes/web.php

Route::middleware(['validateMailgun'])->group(function() {
    Route::post('/Mailgun-Webhook-Uri', 'InboundEmailController@receive');
});

About

Middleware to Validate Mailgun Webhook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages