Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Base Mail Bundle Laravel Package

instaclick/base-mail-bundle

Instaclick BaseMailBundle is a Symfony bundle that provides a reusable foundation for composing and sending email, with mailer services and extension points for custom transports, templates, and application-specific mail workflows. It helps standardize mail setup across Symfony projects.

View on GitHub
Deep Wiki
Context7

Getting Started

This is a Symfony2-era bundle (last release January 2014, 4 stars, no dependents). Treat it as legacy code you are reading or vendoring, not as a drop-in dependency you adopt casually. The "lower level support" it advertises means it wraps Swift Mailer with a thin mailer service rather than providing templating, layouts, or a send queue — you are expected to build messages yourself.

Minimum steps to evaluate it:

  1. Read composer.json first. Note the symfony/symfony and swiftmailer/swiftmailer version constraints. If your project is Symfony 4+ or on symfony/mailer, stop here — the bundle will not install or bootstrap.
  2. Register the bundle in app/AppKernel.php (new IC\Bundle\Base\MailBundle\ICBaseMailBundle()). Symfony2 has no auto-discovery, so nothing works until this line exists.
  3. Open DependencyInjection/ICBaseMailBundleExtension.php and Resources/config/services.xml. The extension is the only real documentation: it tells you the config key, the service IDs, and which class implements the mailer contract.
  4. Look at the Mailer/ (or equivalent) directory for the interface. That interface — not the bundle's own code — is what you should type-hint in your own services.

First useful use case: inject the bundle's mailer into one application service (e.g. App\Notification\RegistrationMailer), build a message there, and send it. Do not call the mailer from controllers; keeping one composition class per email makes the eventual migration to Symfony Mailer mechanical.

Implementation Patterns

Compose in services, send through the mailer. The bundle gives you transport plumbing, not message composition. Create small classes that own one email each, take the mailer and a message factory (or Swift_Message) as constructor arguments, and expose send(array $recipients, array $context). This is the pattern that survives the package's death.

Centralize From/Reply-To/Return-Path. Whatever factory or config the bundle exposes for defaults, wire those values from parameters (%mailer_defaults.from%) so that a change of sender is a config edit rather than a grep across services.

Swap transport per environment, not per call. Keep the bundle's transport config environment-scoped: real SMTP in prod, null or array transport in test, and a file/memory spool in dev so you can inspect messages before they leave the box. If the bundle predates Symfony's swiftmailer config block, verify whether it reads its own parameters or delegates to the framework bundle — duplicating transport config between two places is the most common source of "emails go out in test".

Decorate the mailer service for cross-cutting concerns. Logging, retry-on-transport-failure, and "record every outbound mail for audit" belong in a decorator that implements the same interface as the bundle's mailer, registered under the original service ID with the real one moved to a private alias. This is the cleanest extension point in a package with no event system you can rely on.

Batch carefully. The bundle's mailer likely wraps a single Swift_Mailer, which reuses one transport connection. Sending a loop of N messages through the same instance is correct and fast; constructing a new mailer per message is not. If you need per-recipient personalization at scale, prefer one message with many To addresses plus a Swift_Plugins_DecoratorPlugin-style decorator over N separate sends.

Integration tip: if the bundle dispatches any events (check EventDispatcher/ and the mailer's send()), hook auditing there rather than in each composition class. If it does not, add the event yourself in your decorator — you will want it when you migrate.

Gotchas and Tips

  • It is abandoned. No release since January 2014, zero dependents. Assume no security patches, no PHP 8 compatibility, and no Symfony 4/5/6 support. Use it only if you are already on Symfony2 and cannot move; otherwise read the source and reimplement the ~200 lines you actually need.
  • Swift Mailer itself is end-of-life (November 2021, replaced by symfony/mailer). Even in a working Symfony2 app, this bundle chains you to a dead transport layer. Budget the migration before you build on it.
  • Service ID collisions. Symfony's SwiftmailerBundle also registers a mailer service. If both are installed, determine which one you get from debug:container mailer --show-private before writing a single type-hint. Prefer the bundle's explicit interface over the string ID.
  • Undocumented configuration. There is no reference config in the repo worth the name. Generate one by reading the extension's load()/Configuration class, or inspect the compiled container. Do not guess key names.
  • PHP version drift. Code written for PHP 5.3/5.4 will at minimum emit deprecations on 7.x and may fatal on 8.x (dynamic properties, old Swift_* signatures). Pin the exact commit you evaluated and run your suite before deploying.
  • No test coverage you can trust. With 4 stars and no dependents, there is no community signal that any edge case works. Write an integration test that actually sends through the null/array transport and asserts recipients, subject, and body for each of your composition classes.
  • Debugging sends: use the spool. If the bundle exposes a spool path, send to it in dev, inspect the .eml files, then flush with swiftmailer:spool:send --env=dev. If it does not expose a spool, that alone is a reason to wrap the mailer in your own decorator that writes messages to disk.
  • Extension points, in order of durability: (1) your own interface + adapter around the bundle's mailer, (2) service decoration in services.yml, (3) a compiler pass to rewrite arguments, (4) forking the bundle. Only the first survives your migration to Symfony Mailer, so invest there.
  • Verdict for day-to-day use: this scores 0.11 for a reason. Skim the mailer interface and DI wiring for ideas, but do not let it become load-bearing infrastructure in a codebase you intend to maintain.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource