wrep/fosuserbundle-mandrill-mailer
Integrates Mandrill with Symfony's FOSUserBundle to deliver account confirmation, password reset, and other transactional emails through Mandrill. A lightweight mailer bridge for projects needing reliable FOSUserBundle email delivery.
Read this first: this is not a Laravel package. wrep/fosuserbundle-mandrill-mailer is a Symfony 2-era bundle that plugs a Mandrill-backed implementation into FOSUserBundle's MailerInterface. There is no service provider, no illuminate/* dependency, and no config file Laravel will ever load. Its value to you is the pattern — roughly a hundred lines of glue — not the package itself.
FOS\UserBundle\Mailer\MailerInterface (sendConfirmationEmailMessage, sendResettingEmailMessage), plus a Resources/config/services.xml that registers it and swaps it in for FOSUserBundle's default Swiftmailer mailer. Bodies come from FOSUserBundle's Twig email templates (Registration/email.txt.twig, Resetting/email.txt.twig) and are handed to the Mandrill API (messages/send.json) instead of Swiftmailer.composer.json (note the symfony/* and friendsofsymfony/user-bundle constraints), then the mailer class, then services.xml, then FOSUserBundle's own TwigSwiftMailer side by side. The diff between those two mailers is the package.composer require wrep/fosuserbundle-mandrill-mailer, enable the bundle in AppKernel, set the Mandrill key, and point FOSUserBundle at it via fos_user.service.mailer: <bundle mailer service id>. Verify with a password-reset request in dev and check Mandrill's outbound activity log.Illuminate\Auth\Notifications\ResetPassword plus a signed URL reproduces the FOSUserBundle flow. For Mandrill delivery, either register a custom transport (Mail::extend('mandrill', ...)) or wrap Http::withHeaders(['Authorization' => ...])->post('https://mandrillapp.com/api/1.0/messages/send.json', ...) in a queued Mailable.MandrillUserMailer class with sendConfirmation(User $user) and sendPasswordReset(User $user, string $token), a Blade view each, and a queued job. That is the bundle's entire scope.UserMailer contract and bind it, so local and testing environments can swap in a LogMailer. Keeps email decisions out of controllers and out of the User model..txt.twig and .html.twig per message and substitutes %username% / %confirmationUrl% placeholders (plus the FOSUserBundle translation domain) rather than Twig variables. When porting to Blade, keep the text/HTML pair and always render absolute URLs — relative links in email are dead on arrival.html/text to Mandrill. Simplest, fully testable, works with Laravel's __().template_name + template_content and let Mandrill's merge language substitute. Better when copy is owned by non-developers, but the *|MERGE|*/handlebars syntax collides with Twig and Blade delimiters — you end up escaping or using @{{ }}.message.to[], global_merge_vars vs per-recipient merge_vars, tags for analytics, track_opens/track_clicks, async. Set async: true and/or queue the send — a synchronous API call in the reset-request path is exactly the latency problem you don't want.fos_user.mailer.default; the Laravel analogue is a container binding ($this->app->bind(UserMailer::class, MandrillUserMailer::class)) plus a Notification that sends through a named mailer.X-Mandrill-User header) are the intended mechanism if you send for several brands. Keep keys in config/services.php sourced from env().password-reset, confirm-email) and log the _id Mandrill returns — it's the only handle for "did the user actually get the mail?" Wire the mandrill_events webhook to a queued endpoint if deliverability matters.composer.json. Treat it as reference code.symfonycasts/reset-password-bundle and MakerBundle. The mailer abstraction is the only part worth reusing.messages/send.json returns HTTP 200 with an array of per-recipient results; status (sent / queued / rejected / invalid) and reject_reason carry the truth. A naive "response was 2xx" check silently drops mail. Same trap with messages/send-template.json.FOSUserBundle translation domain or the %confirmationUrl% substitution and users get raw keys or a literal %confirmationUrl% in the body. Assert on rendered output in tests.TrustProxies, Laravel emits http:// links and the reset URL 404s.test unless you override it — same instinct as Mail::fake() / Notification::fake() / Http::fake() in Laravel. A passing fake with the wrong template_name is a silent production failure, so assert the payload.env() outside config files returns null after config:cache; put the Mandrill key in config/services.php. This is the same failure class as Symfony's compiled container.log in local/testing. That is the reusable core of this package; everything else is 2015 Symfony plumbing.How can I help you explore Laravel packages today?