pf2pr / dasha-mail-mailer
Symfony DashaMail Mailer Bridge
Package info
github.com/pf2pr/dasha-mail-mailer
Type:symfony-mailer-bridge
pkg:composer/pf2pr/dasha-mail-mailer
Requires
- php: >=8.1
- symfony/mailer: ^6.3
Requires (Dev)
- phpunit/phpunit: ^10.4
- symfony/http-client: ^6.3
- symfony/remote-event: ^6.3
- symfony/webhook: ^6.3
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-16 00:10:23 UTC
README
Provides DashaMail integration for Symfony Mailer.
Installation
composer config extra.symfony.allow-contrib true
composer require pf2pr/dasha-mail-mailer
Supported versions:
- PHP 8.1 or later;
- Symfony Mailer 6.4, 7.4 or 8.1.
This package is a Symfony Mailer bridge. In full Symfony applications, the contributed Flex recipe registers the optional DashaMailMailerBundle DI adapter. Without the recipe, register the adapter manually:
// config/bundles.php return [ // ... Pf2Pr\DashaMailMailer\DashaMailMailerBundle::class => ['all' => true], ];
The API transport additionally requires Symfony HttpClient:
composer require symfony/http-client
Configuration
# SMTP MAILER_DSN=dashamail+smtp://USERNAME:PASSWORD@default?no_track_opens=false&no_track_clicks=false # API MAILER_DSN=dashamail+api://KEY@default?no_track_opens=false&no_track_clicks=false
where:
KEYis your DashaMail API Keyno_track_opensdisabling tracking opens. Default isfalseno_track_clicksdisabling tracking (substitution) of links. Default isfalse
The API transport uses DashaMail REST API v2.
API delivery semantics
- The envelope recipient list controls delivery to
To,CcandBcc. Symfonyframework.mailer.envelope.recipientsoverrides also exclude original copy recipients unless they are included in the overridden envelope. - The visible sender comes from the message's
Fromheader, orSenderwhenFromis absent; overriding the envelope sender does not replace it. - Plain-text and HTML bodies support strings and streams. Their declared charset is converted to UTF-8 for the API request. Named inline image references are resolved through Symfony Mime so HTML links match attachment content IDs.
- HTTP transport failures use Symfony Mailer exceptions and participate in
failover(...), including failures raised before an HTTP response is available.
Per-message options
The same DashaMail headers work with API and SMTP transports:
| Header | Purpose |
|---|---|
DM-Message-ID |
Correlate a message with delivery events |
DM-Campaign-ID |
Group messages in statistics |
DM-Delivery-Timestamp |
Schedule delivery using a Unix timestamp |
DM-Domain |
Select the sending domain |
DM-Ignore-Delivery-Policy |
Ignore the account delivery policy |
DM-No-Track-Opens |
Disable open tracking |
DM-No-Track-Clicks |
Disable click tracking |
$email->getHeaders()->addTextHeader('DM-Message-ID', 'order-123'); $email->getHeaders()->addTextHeader('DM-Campaign-ID', 'order-paid'); $email->getHeaders()->addTextHeader('DM-Delivery-Timestamp', '1790000000');
Configure headers
# config/packages/mailer.yaml framework: mailer: dsn: '%env(MAILER_DSN)%' headers: X-Dashamail-Unsub-Ignore: '1'
Webhooks
Webhook handling is optional. Install the required Symfony components before using
DashaMailRequestParser or DashaMailPayloadConverter:
composer require symfony/webhook symfony/remote-event
Required webhook fields (event, email, message_id, event_time and secret)
must be strings. Optional custom_vars accepts an empty string or a JSON object
or array encoded as a string. Invalid field types, dates, JSON and scalar JSON
metadata are rejected with HTTP 406. Direct use of DashaMailPayloadConverter
reports malformed event data with ParseException.