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.
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:
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.app/AppKernel.php (new IC\Bundle\Base\MailBundle\ICBaseMailBundle()). Symfony2 has no auto-discovery, so nothing works until this line exists.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.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.
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.
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.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.load()/Configuration class, or inspect the compiled container. Do not guess key names.Swift_* signatures). Pin the exact commit you evaluated and run your suite before deploying..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.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.How can I help you explore Laravel packages today?