Search by

trueapps / boldem-symfony-mailer

Symfony Mailer transport for the Boldem API (boldem.cz).

Maintainers

Package info

github.com/trueapps/boldem-symfony-mailer

Type:symfony-mailer-bridge

pkg:composer/trueapps/boldem-symfony-mailer

Transparency log

Statistics

Installs: 28

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.1 2026-09-02 12:52 UTC

This package is auto-updated.

Last update: 2026-09-02 12:54:38 UTC


README

A Symfony Mailer transport for the Boldem transactional-email API.

The transport authenticates with OAuth client credentials, caches the returned bearer token for the lifetime of the object, and delivers messages through the /api/transactionalemails endpoint. Recipient lists larger than batchSize (default 50) are split across multiple API calls to match the per-request recipient cap.

Supersedes trueapps/boldem-swiftmailer, which targeted the now-EOL SwiftMailer 6.

Installation

composer require trueapps/boldem-symfony-mailer

Requires PHP 8.1+ and symfony/mailer ^6.4 || ^7.0.

Usage

use Boldem\Transport;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;

$transport = new Transport('<CLIENT_ID>', '<SECRET_CLIENT_KEY>');
$mailer    = new Mailer($transport);

$email = (new Email())
    ->from(new Address('john@example.com', 'John Doe'))
    ->to('jane@example.com')
    ->subject('Hello from Boldem!')
    ->text('Plain-text alternative')
    ->html('<b>HTML body</b>');

// Optional Boldem tag:
$email->getHeaders()->addTextHeader('X-MK-Tag', 'custom-tag');

$mailer->send($email);

Bulk sends

Set $transport->isBulk = true; before sending campaign traffic to have the API treat the message as bulk.

Custom HTTP client / dispatcher / logger

The constructor optionally accepts a Symfony\Contracts\HttpClient\HttpClientInterface, a PSR-14 EventDispatcherInterface, and a PSR-3 LoggerInterface, so the transport plays with the standard Symfony Mailer wiring:

$transport = new Transport(
    clientId:        '<CLIENT_ID>',
    secretClientKey: '<SECRET_CLIENT_KEY>',
    defaultHeaders:  ['X-MK-Tag' => 'newsletters'],
    client:          $httpClient,
    dispatcher:      $eventDispatcher,
    logger:          $logger,
);

Notes

  • Boldem re-derives Subject, Content-Type, MIME-Version, Date, From, To, Cc, Bcc, and Reply-To from the payload; those headers are filtered out before the request is sent.
  • X-MK-Tag is mapped to the API's Tag field.
  • Non-2xx responses raise Symfony\Component\Mailer\Exception\HttpTransportException.

License

MIT. See LICENSE.