lockally/symfony-mailer

Official Lockally Mailer transport for Symfony — send transactional email via Lockally with MAILER_DSN=lockally+api://KEY@default.

Maintainers

Package info

github.com/LockallyInc/lockally-symfony

Homepage

pkg:composer/lockally/symfony-mailer

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-08-05 17:37 UTC

This package is auto-updated.

Last update: 2026-08-06 11:35:26 UTC


README

Official Symfony Mailer transport that sends through the Lockally API. Point your MAILER_DSN at Lockally and every $mailer->send($email) — including Messenger-queued mail — is delivered by Lockally, with no other code changes.

composer require lockally/symfony-mailer

Configure

# .env
MAILER_DSN=lockally+api://YOUR_API_KEY@default

The API key is the DSN user. Sandbox vs. live is implicit in the key prefix (lk_test_… runs against the sandbox, lk_live_… sends real mail) — there is no separate endpoint to configure. A private base URL can be set with ?base_url=https://api.internal.example.

Register the transport factory

In the full Symfony framework, register the factory as a tagged service so the DSN scheme resolves (a Flex recipe does this automatically; otherwise add it yourself):

# config/services.yaml
services:
    Lockally\Symfony\LockallyTransportFactory:
        parent: mailer.transport_factory.abstract
        tags: ['mailer.transport_factory']

Standalone (without the framework), build a transport directly:

use Lockally\Symfony\LockallyTransportFactory;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport\Dsn;

$transport = (new LockallyTransportFactory())
    ->create(Dsn::fromString('lockally+api://YOUR_API_KEY@default'));
$mailer = new Mailer($transport);

Send

use Symfony\Component\Mime\Email;

$email = (new Email())
    ->from('alerts@yourdomain.com')
    ->to('user@example.com')
    ->replyTo('support@yourdomain.com')
    ->subject('Your code')
    ->text('code 123')
    ->html('<b>code 123</b>');

$mailer->send($email);

Mapping notes

  • Reply-To — Lockally has no reply_to field, so it is sent as a Reply-To header.
  • Attachments — sent as {filename, content_type, content_base64} (base64 of the raw bytes). Inline/CID parts are delivered as normal attachments in v1.
  • Idempotency — one Idempotency-Key is generated per send; the API dedupes on it for 24 h.

Requirements

  • PHP 8.1+
  • symfony/mailer 6.2+ or 7.x
  • A Lockally API key (console)

License

MIT © Lockally