masilia / ibexa-mailer
The mail transport of an Ibexa 5 project, set in the admin instead of environment variables: one configuration per site, on Symfony Mailer and its bridges
Package info
github.com/MasiliaLabs/ibexa-mailer
Type:ibexa-bundle
pkg:composer/masilia/ibexa-mailer
Requires
- php: >=8.3
- ext-sodium: *
- doctrine/doctrine-bundle: ^2.13
- doctrine/doctrine-migrations-bundle: ^3.4
- doctrine/orm: ^2.20 || ^3.0
- ibexa/admin-ui: ^5.0
- ibexa/core: ^5.0
- masilia/ibexa-admin-kit: ^0.2
- masilia/ibexa-sites: ^0.3
- psr/cache: ^3.0
- psr/log: ^3.0
- symfony/config: ^7.4
- symfony/console: ^7.4
- symfony/dependency-injection: ^7.4
- symfony/event-dispatcher: ^7.4
- symfony/framework-bundle: ^7.4
- symfony/http-foundation: ^7.4
- symfony/http-kernel: ^7.4
- symfony/mailer: ^7.4
- symfony/messenger: ^7.4
- symfony/mime: ^7.4
- symfony/routing: ^7.4
- symfony/security-core: ^7.4
- symfony/security-csrf: ^7.4
- symfony/yaml: ^7.4
Requires (Dev)
- masilia/ibexa-ai: ^3.0
- masilia/ibexa-dev-tools: ^0.2
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
- symfony/amazon-mailer: ^7.4
- symfony/brevo-mailer: ^7.4
- symfony/cache: ^7.4
- symfony/google-mailer: ^7.4
Suggests
- masilia/ibexa-ai: The assistant lists, configures and tests the transports (mailer.* capabilities)
- symfony/amazon-mailer: Amazon SES transport
- symfony/brevo-mailer: Brevo transport
- symfony/google-mailer: Gmail transport
- symfony/mailgun-mailer: Mailgun transport
- symfony/postmark-mailer: Postmark transport
- symfony/sendgrid-mailer: Sendgrid transport
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-30 15:44:42 UTC
README
The mail transport of an Ibexa DXP 5 project, set in the admin instead of environment variables. It sits on Symfony Mailer and its bridges: one transport per site of the registry of masilia/ibexa-sites, plus a default one, and the MAILER_DSN of the project as the fallback.
Today the whole mail of a project (the newsletter, the forms, the confirmation mails) goes through the one framework.mailer.dsn. Changing the provider, rotating a password or giving one site its own sender service means editing the environment and deploying. With this package an administrator does it on a page of the admin, and the next mail uses it.
Features
- One transport per site, and a default one. A site with a transport of its own sends through it; a site without one sends through the default transport; without any, the DSN of the project is used, so a fresh install or an empty table still sends mail.
- Every transport of Symfony Mailer 7.4: SMTP, Sendmail, PHP's
sendmail_path, none, and the bridges (Amazon SES, Mailgun, Postmark, Sendgrid, Brevo, Mailjet, Mandrill, MailerSend, Resend, Scaleway, Azure, Infobip, MailPace, Mailomat, Postal, Sweego, Mailtrap, Microsoft Graph, AhaSend, Gmail), each with its ways to connect (SMTP, API...) and its fields. A bridge that is not installed is listed with thecomposer requirethat installs it, and cannot be saved. - Secrets are encrypted in the database (libsodium secretbox,
enc:v1:), never given back by the API, the page, the console or the assistant: they say which secrets are set, never what they are. A secret left empty in the form keeps the saved one. - A page in the admin (Admin > Mail transport), built with
masilia/ibexa-admin-kit: the scopes, the transport each really uses and why, a form generated from the fields of the provider, and a test mail that can try the form before it is saved. Policiesmasilia_mailer/viewandmasilia_mailer/manage. - Queued mail keeps its site. With Symfony Messenger a mail is sent by a worker, which has no siteaccess: the scope the mail was queued for travels with it (a Messenger stamp), so the worker uses the transport of that site.
- A transport that cannot be used never stops the mail: a bridge removed from the project, secrets that cannot be decrypted (the key changed), settings the provider refuses: the level is passed over, the reason is logged and shown, and the next level sends. An error of the provider when it sends is not hidden: it is raised as it would be without this package.
- The assistant (with
masilia/ibexa-ai):mailer.list,mailer.configure,mailer.test. It never sees nor sets a secret. - Console:
masilia:mailer:statusandmasilia:mailer:test.
Requirements
- PHP 8.3 or 8.4, with
ext-sodium - Ibexa DXP 5.0 (
ibexa/core,ibexa/admin-ui), Symfony 7.4,doctrine/ormanddoctrine/doctrine-migrations-bundle - MySQL or MariaDB
masilia/ibexa-admin-kit(the components of the admin page) andmasilia/ibexa-sites(the sites), with Node.js and Yarn to build the admin assets- The Symfony bridge of the provider you use (
symfony/brevo-mailer...): see the page - Optional:
masilia/ibexa-ai(the assistant)
Installation
composer require masilia/ibexa-mailer:^0.1@beta
Only beta versions exist for now, so Composer needs the @beta stability flag; it goes away with the first stable version.
-
Enable the bundle in
config/bundles.php(Symfony Flex does it), afterMasiliaIbexaAdminKitBundle:Masilia\Bundle\IbexaMailer\MasiliaIbexaMailerBundle::class => ['all' => true],
-
Import the routes of the page (
config/routes/masilia_ibexa_mailer.yaml):masilia_ibexa_mailer: resource: '@MasiliaIbexaMailerBundle/Resources/config/routes.yaml'
-
Configure the bundle (
config/packages/masilia_ibexa_mailer.yaml) and make Symfony Mailer ask it for the transport (config/packages/mailer.yaml):masilia_ibexa_mailer: fallback_dsn: '%env(MAILER_DSN)%' # used when nothing usable is saved in the admin encryption_key: '%env(default::MAILER_ENCRYPTION_KEY)%' # base64 of 32 random bytes framework: mailer: dsn: 'masilia://default'
Nothing changes in the environment:
MAILER_DSNkeeps its value and becomes the fallback. Make the key withphp -r 'echo base64_encode(random_bytes(32));'and put it inMAILER_ENCRYPTION_KEY. When it is empty the key is derived fromAPP_SECRET, and changingAPP_SECRETthen makes the saved secrets unreadable (they are asked again on the page); set the key in production. A key that is not base64 of 32 bytes is refused with a message that says how to make one, when the mailer is first built (it usually comes from an%env(), which cannot be read before run time, so the container still builds). -
Create the table and build the admin assets:
php bin/console doctrine:migrations:migrate php bin/console cache:clear yarn ibexa-generate-tsconfig php bin/console bazinga:js-translation:dump public/assets --merge-domains php bin/console ibexa:encore:compile
Inside DDEV, prefix the commands with
ddev exec.MasiliaIbexaAdminKitBundleandMasiliaIbexaSitesBundlemust be enabled too. Symfony 7.4'scache:cleardoes not clear the persistence cache: also runphp bin/console cache:pool:clear cache.redis(or your pool). -
Give a role the policies
masilia_mailer / view(see the page) andmasilia_mailer / manage(change a transport, send a test mail). The Administrator role has them. -
Messenger only: the middleware that gives a worker the site of a queued mail is added to the default bus (
messenger.bus.default) by the bundle. If your project names its own buses and has nomessenger.bus.default, addMasilia\Bundle\IbexaMailer\Messenger\SiteScopeMiddlewareto the bus the mailer uses; without it a worker sends with the default transport.
With Symfony Flex
Add the endpoint of the Masilia recipes once to the composer.json of your project, after the one of Ibexa (see the recipes); composer require masilia/ibexa-mailer:^0.1@beta then enables the bundle and writes the two files above. What is left is yours: framework.mailer.dsn, the key, the migration, the admin build and the policies.
Usage
Open Admin > Mail transport. The table has the default scope and each site, with the provider saved for it and what its mail really goes through: its own transport, the default one, or the DSN of the project, and why a higher level was passed over ("The transport of this site is not set", "...is disabled", "...needs a bridge that is not installed").
- The pencil opens the form: choose the provider and the way to connect; the fields are the ones that provider asks for. Passwords and API keys are typed there and nowhere else. A transport that is switched off is kept, and its site sends through the default one.
- Send a test mail from a row sends one through the transport the scope uses now; from the form it tries the transport as typed, before saving (a secret left empty is the saved one). The answer of the provider is shown as it came.
- The bin deletes the transport of a scope (the site then uses the default one).
From the console:
# Which transport each scope uses, and why not the one above (no secret is ever shown) php bin/console masilia:mailer:status # One test mail through the transport of a site (or of the default scope); --from defaults to the email of the site php bin/console masilia:mailer:test me@example.com --site=acme_group --from=noreply@example.com
How a transport is chosen
For a mail sent for the site acme: its transport if it is saved and on, else the default transport if it is saved and on, else fallback_dsn. The site is the one of the current siteaccess in the registry of masilia/ibexa-sites (front or admin siteaccess), or the one a queued mail carries. A siteaccess that is not in the registry, or a command without a siteaccess, uses the default scope.
A level that is on but cannot be used is passed over like one that is off, and is logged at error level (The mail transport of the scope "acme" is not used: ...).
The assistant
With masilia/ibexa-ai installed, the assistant gets three capabilities (nothing to configure):
| Capability | Risk | What it does |
|---|---|---|
mailer.list |
read | The scopes, their saved transport (which secrets are set, never their value), the transport they really use and why; with providers the catalog, with the install command of those that are not installed |
mailer.configure |
write (approval card) | Sets the provider, the way to connect, the fields that are not secret and enabled of a scope. Secrets already saved for the same provider are kept |
mailer.test |
write (approval card) | Sends one test mail through the transport a scope uses, and gives the answer of the provider |
mailer.configure refuses a secret, however it is given: it would travel through the chat and stay in its audit. For a provider that needs one that is not saved yet, it says so and asks the person to type it on the page.
In code
Read and write through the contracts of Masilia\Contracts\IbexaMailer, never the table:
TransportRegistry(list,find,save,delete):save()takes the secrets apart, throwsInvalidTransportConfig(with the problems by field) and keeps the secrets that are not given.ProviderCatalog: the providers, their variants and fields, and whether each is installed.MailerStatus::resolve($scope): which transport a scope uses, and why (ResolvedTransport, with theTransportSource).TestMailer::send(...): a test mail, through the transport of a scope or through a draft.
Your own code keeps sending mail with MailerInterface: nothing to change in a package that already does.
Tests
composer install vendor/bin/phpunit vendor/bin/phpstan analyse cd src/bundle/Resources/public/admin MASILIA_ADMIN_KIT=/path/to/ibexa-admin-kit/src/bundle/Resources/public/admin node --experimental-strip-types --import ./test-hooks/register.mjs --test mailer/*.test.ts
AI agent skill
This package ships a skill for AI coding agents (Claude Code and other agents that read SKILL.md skills): how to install, configure, operate and troubleshoot masilia/ibexa-mailer. It lives in skills/masilia-ibexa-mailer and is copied where your agent looks for skills:
# For the project (committed with it): from the installed package mkdir -p .claude/skills && cp -r vendor/masilia/ibexa-mailer/skills/masilia-ibexa-mailer .claude/skills/ # For all your projects: global mkdir -p ~/.claude/skills && cp -r vendor/masilia/ibexa-mailer/skills/masilia-ibexa-mailer ~/.claude/skills/
Restart the agent (or reload its skills) to pick it up. Update the copy after composer update.
The Masilia packages
| Package | What it does |
|---|---|
masilia/ibexa-admin-kit |
React components in the design of the Ibexa admin, for admin pages |
masilia/ibexa-sites |
A registry of sites that Ibexa serves without a deploy |
masilia/ibexa-mailer |
The mail transport of the project, set in the admin: one per site, on Symfony Mailer |
masilia/ibexa-ai |
The AI assistant for Ibexa: capabilities, providers, chat, approval flow |
masilia/ibexa-ai-craft |
The assistant builds sites and pages out of blocks |
masilia/ibexa-ai-editor |
AI suggestions and image generation in the content editing form |
masilia/ibexa-blocks |
Front-office rendering of pages made of blocks, with themes |
masilia/editorial-toolbox |
In-context editing toolbar for the front office |
What requires what (Composer installs it for you):
ibexa-mailerrequiresibexa-admin-kitandibexa-sites; it is happy to findibexa-ai(the assistant capabilitiesmailer.*)ibexa-sitesrequiresibexa-admin-kitibexa-airequiresibexa-admin-kitibexa-ai-editorrequiresibexa-aiibexa-ai-craftrequiresibexa-ai,ibexa-blocksandibexa-sitesibexa-blocksandeditorial-toolboxrequire none of the others; they are happy to findibexa-sites(and each other) when installed.
Compatibility
| Package version | PHP | Ibexa | Symfony |
|---|---|---|---|
latest |
8.3+ | 5.0 | 7.4 |
Download
- Composer (recommended):
composer require masilia/ibexa-mailer:^0.1@beta— ibexa-mailer on Packagist - Archive of a release: GitHub releases (each release lists what changed)
- Source:
git clone https://github.com/MasiliaLabs/ibexa-mailer.git - What changed between versions: CHANGELOG.md
Stay informed
New versions are announced as GitHub releases, with their notes taken from the CHANGELOG. Watch this repository (Custom, Releases), or follow https://github.com/MasiliaLabs/ibexa-mailer/releases.atom; composer outdated "masilia/*" lists what is behind in your project. Before 1.0 a minor version (0.x) may contain breaking changes: they are marked Breaking in the CHANGELOG and explained in UPGRADE.md. Security problems are announced as GitHub security advisories (see SECURITY.md).
Support
GitHub issues. Upgrading across a breaking change: UPGRADE.md. Security: see SECURITY.md. Contributions: see CONTRIBUTING.md.
License
MIT