tss/automailer-bundle
Symfony bundle for Automailer integration that simplifies sending transactional and automated emails from your application. Configure mailers, templates, and delivery workflows with minimal setup, making it easy to add reliable email automation to Symfony projects.
This is a Symfony2 bundle, not a Composer package Laravel can autoload into service providers, so "getting started" splits into two tracks: evaluating the concept, and (if you insist) running it in a Symfony app alongside your Laravel code.
The concept (what it actually does): it wraps Swiftmailer's spool in a Doctrine-backed implementation. Instead of writing queued emails to disk (swiftmailer.spool.file), it persists Swift_Message objects to a DB table so multiple app servers share the queue and messages survive restarts.
In a Symfony2 app (the intended path):
composer require tss/automailer-bundlenew TSS\AutomailerBundle\TSSAutomailerBundle() in app/AppKernel.phptss_automailer: with your Doctrine connection/tableapp/console doctrine:schema:update --forceswiftmailer.spool service aliasapp/console swiftmailer:spool:send --env=prod every minuteWhere to look first: the DoctrineSpool class (the queueMessage / sendMessage / flushQueue implementation) — that is the whole package. Everything else is DI wiring.
In Laravel (what you should actually do): skip the package. Its day-to-day behavior is what Mail::to(...)->queue(new Mailable) plus the database queue driver already gives you, natively, with retries, backoff, failed-job storage, and Horizon visibility. Your "first use case" — durable, multi-server, restart-safe email queueing — is QUEUE_CONNECTION=database and a Mailable implementing ShouldQueue. Read the bundle's DoctrineSpool only as a reference for how a DB spool differs from a file spool.
If you are modeling your Laravel mail queue on this bundle's design, the patterns it encodes are:
swiftmailer.spool service to DoctrineSpool. That's the Symfony equivalent of swapping the queue connection. In Laravel the analog is config/mail.php 'queue' => ['connection' => 'database'] plus a dedicated emails queue.Mailables + queue:work. Implement it as Mail::to($u)->queue((new OrderShipped($order))->onQueue('emails')).database queue driver gives you this for free; the redis driver is the better upgrade.swiftmailer:spool:send on its own cron slot. Mirror that with a dedicated supervisor program: php artisan queue:work --queue=emails --tries=3 --backoff=60.DB::afterCommit() or the after_commit queue option to defer dispatch until commit — this is the pattern worth stealing.Jobs — but you will be reimplementing DoctrineSpool in a Laravel job class in ~40 lines, and that is the correct move.For new Laravel code, the mapping is direct: Swift_Message → Mailable, DoctrineSpool → Illuminate\Queue\DatabaseQueue, swiftmailer:spool:send → queue:work.
symfony/mailer. You will not get PHP 8 support, typed-property fixes, or Symfony 5+/Laravel 9+ compatibility. Treat it as a case study, not a dependency.TSSAutomailerBundle expects AppKernel, Symfony DI tags, and app/console. Composer may resolve it but nothing will wire up. Don't burn an afternoon on Symfony\Bundle\FrameworkBundle shims.swiftmailer:spool:send has no built-in lock in older versions — overlapping cron runs on a slow SMTP server will double-send. If you're mirroring this in Laravel, queue:work handles the atomic reserve for you; a naive SELECT … WHERE sent = 0 drain will not.Swift_Message (headers, attachments, embedded images) into the DB. Changing Swiftmailer versions can break unserialization of in-flight rows — a classic reason DB-spool implementations need a drain-before-upgrade step. Laravel's database driver JSON-serializes jobs and has the same constraint; queue:clear or drain before deploying serialization-changing code.queue:prune-batches-style housekeeping you must schedule yourself. Plan a DELETE FROM jobs WHERE created_at < … job.sentAt (cron not running or SMTP failing). In Laravel the equivalents are SELECT count(*) FROM jobs; and SELECT * FROM failed_jobs;.Mail::extend / custom transport mechanism. If you need DB-backed mail behavior Laravel doesn't have, extend the transport, don't emulate a spool.Mailables + ShouldQueue + after_commit + a supervisor-managed emails queue.How can I help you explore Laravel packages today?