Search by

masilia / ibexa-mailer

masilia

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

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0-beta.2 2026-11-30 15:12 UTC

This package is auto-updated.

Last update: 2026-11-30 15:44:42 UTC


README

CI Latest version Downloads PHP License: MIT

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 the composer require that 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. Policies masilia_mailer/view and masilia_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:status and masilia: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/orm and doctrine/doctrine-migrations-bundle
  • MySQL or MariaDB
  • masilia/ibexa-admin-kit (the components of the admin page) and masilia/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.

  1. Enable the bundle in config/bundles.php (Symfony Flex does it), after MasiliaIbexaAdminKitBundle:

    Masilia\Bundle\IbexaMailer\MasiliaIbexaMailerBundle::class => ['all' => true],
  2. Import the routes of the page (config/routes/masilia_ibexa_mailer.yaml):

    masilia_ibexa_mailer:
        resource: '@MasiliaIbexaMailerBundle/Resources/config/routes.yaml'
  3. 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_DSN keeps its value and becomes the fallback. Make the key with php -r 'echo base64_encode(random_bytes(32));' and put it in MAILER_ENCRYPTION_KEY. When it is empty the key is derived from APP_SECRET, and changing APP_SECRET then 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).

  4. 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. MasiliaIbexaAdminKitBundle and MasiliaIbexaSitesBundle must be enabled too. Symfony 7.4's cache:clear does not clear the persistence cache: also run php bin/console cache:pool:clear cache.redis (or your pool).

  5. Give a role the policies masilia_mailer / view (see the page) and masilia_mailer / manage (change a transport, send a test mail). The Administrator role has them.

  6. 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 no messenger.bus.default, add Masilia\Bundle\IbexaMailer\Messenger\SiteScopeMiddleware to 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, throws InvalidTransportConfig (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 the TransportSource).
  • 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-mailer requires ibexa-admin-kit and ibexa-sites; it is happy to find ibexa-ai (the assistant capabilities mailer.*)
  • ibexa-sites requires ibexa-admin-kit
  • ibexa-ai requires ibexa-admin-kit
  • ibexa-ai-editor requires ibexa-ai
  • ibexa-ai-craft requires ibexa-ai, ibexa-blocks and ibexa-sites
  • ibexa-blocks and editorial-toolbox require none of the others; they are happy to find ibexa-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