How to make Mailgun integration work after upgrading to Laravel 9

Categorized as Laravel Tagged

If you’re receiving errors like "Class Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory not found", you need to know that the app codebase has been impacted by one of the largest changes in Laravel 9, when the development team transitioned from SwiftMailer to Symfony Mailer.

Let’s fix the problem. Run this command in your Laravel application folder:

composer require symfony/mailgun-mailer symfony/http-client

Also, don’t forget to use correct Mailgun API endpoint, depending on it’s region.

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

Leave a reply

Your email address will not be published. Required fields are marked *