- How do I install and configure the Mailjet driver in Laravel?
- Install it with composer require thedoctor0/laravel-mailjet-driver. Package auto-discovery registers the service provider, so you only need to add your Mailjet API key and secret to config/services.php under the mailjet entry and set MAIL_MAILER=mailjet with a matching mailers entry in config/mail.php or your .env file. After that, Mail::send() and your Mailables route through Mailjet's API with no further code changes.
- Which Laravel and PHP versions does laravel-mailjet-driver support?
- Release 2.x targets Laravel 11 through 13 and requires PHP 8.2 or newer. Be aware that the CI matrix runs PHP 8.3 to 8.5, so 8.2 is declared but not exercised by tests. The 1.x line is a maintenance branch for Laravel 9 and 10 with no published end-of-life or security-fix policy.
- Does this driver work with Mail::fake() and Laravel mail events?
- Mail sent through the transport path behaves like any other Laravel mailer, so Mail::fake(), mail events, queueing and log or array driver fallbacks all work as expected in local and test environments. The static Mailjet::sendEmail() and Mailjet::sendSms() helpers bypass Illuminate\Mail\Mailer entirely, so Mail::fake() will not intercept them and no mail events fire. Treat those calls as a separate integration with its own mocking and observability story.
- What is the difference between the mail transport and Mailjet::sendEmail()?
- The transport is registered with Laravel's mail manager and is used automatically whenever your mailer is set to mailjet, which means Mailables, events and queues all apply. Mailjet::sendEmail() is a thin static wrapper around the Mailjet SDK that posts directly to the Send API and hands back the raw API response. Use the transport for application email and reach for the facade only when you need API-level responses or a channel the mail system does not model.
- Can I send SMS with this package, and should I?
- Version 2.1.0 adds Mailjet::sendSms(), which calls Mailjet's SMS v4 API and is architecturally independent of the mail transport. It carries the same caveats as the other static helpers: no Laravel notifications, no queue integration and no Mail::fake() support. If SMS is not a real requirement, forbid the call explicitly in review or static analysis instead of inheriting it from the mail decision.
- Does it use the Mailjet Send API v3.1 or v3?
- The package targets the Send API v3.1 by default, with an opt-in configuration flag to fall back to v3. If different applications set that flag inconsistently you get divergent payloads for identical code, which is a painful debugging trap. Pick one value, document it, and keep it identical across all environments and services.
- Is this package production-ready, and what are the maintenance risks?
- The adapter is small, Composer-installable and limited in blast radius to outbound email, which is the right shape for a third-party dependency. The suite has 184 tests and full line coverage of src, but there are no contract tests against the live Mailjet HTTP API, which is where failures actually originate. It is also a single-maintainer wrapper around the official mailjet-apiv3-php SDK, so pin ^2.1 to collect SDK fixes and plan for the bus factor before routing revenue-critical messaging through it.
- Can I use queued Mailables and Markdown mail with this driver?
- Yes. Because the driver plugs into Laravel's native mail system, queued Mailables, Markdown templates and the usual recipient handling work exactly as they do with any other transport. The static sendEmail() helper does not participate in any of that, so queued or templated mail should always go through the Mail facade.
- How do I migrate from 1.x to 2.x, or from Laravel 10 to 11+?
- There is no in-place migration from 1.x to 2.x for Laravel 9 or 10 applications; upgrading the framework to Laravel 11 or later is the prerequisite. For apps already on 2.0.x, 2.1.0 is a minor additive release with a mailjet-apiv3-php ^1.6 bump, so pin ^2.1 rather than ^2.0 and expect no code changes to existing mail sending. Do review the SDK bump, since it changes the authentication surface and raw-data parameter handling.
- What alternatives exist to this package for sending Mailjet email in Laravel?
- The most common alternative is pointing Laravel's SMTP mailer at Mailjet's relay, which avoids a third-party package but returns SMTP status codes instead of structured API responses. You can also use symfony/mailjet-mailer as the underlying Symfony transport, though it lacks the direct API helpers this package offers. Staying with this driver makes sense when you want Mailjet's API, structured responses and support for Laravel 11 through 13.