wolkano / craft-mail-studio
Source-aware transactional email templates for Craft CMS 6.
Package info
github.com/Yxanu/craft-mail-studio
Type:craft-plugin
pkg:composer/wolkano/craft-mail-studio
Requires
- php: ^8.5
- craftcms/cms: ^6.0.0-beta.1
Requires (Dev)
- laravel/pint: ^1.27
- phpunit/phpunit: ^12.5
Suggests
- solspace/craft-freeform: Adds the Pro Freeform notification adapter.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-19 11:36:34 UTC
README
Mail Studio for Craft CMS 6
Transactional email, composed in Craft.
Published by wolkano. Support: dev@tosa.io.
Mail Studio manages source-aware transactional email content in the Craft control panel. Editors compose constrained blocks, preview HTML and plain text, send tests, then publish immutable revisions for Craft system messages, Freeform notifications, or explicit application sources.
Mail Studio runs inside your Craft installation, not as an adapter for a separate hosted template service. Email delivery uses your configured Craft mail transport; any mail-provider fees are separate.
Craft CMS 6 and Mail Studio are in beta. APIs and adapters may change before the stable releases.
Requirements
- Craft CMS
^6.0.0-beta.1 - PHP
^8.5 - Node.js 22+ only when rebuilding control panel assets
Installation
For local path development:
{
"repositories": [
{
"type": "path",
"url": "plugins/*",
"options": { "symlink": true }
}
]
}
composer require wolkano/craft-mail-studio:@dev php artisan craft:plugin:install mail-studio pro
The compiled files under public/build are part of the package. Consumers do not need Node.js.
For the public beta package on Packagist, the consuming Craft 6 project must permit beta dependencies:
composer config minimum-stability beta
composer config prefer-stable true
composer require wolkano/craft-mail-studio:^0.1@beta
php artisan craft:plugin:install mail-studio
Public API
Register a semantic source during application boot:
use Yxanu\MailStudio\Data\SourceDefinition; use Yxanu\MailStudio\Services\SourceRegistry; app(SourceRegistry::class)->register(new SourceDefinition( key: 'musicshop.download-link', label: 'Music download link', variables: [ 'customer.name' => ['label' => 'Customer', 'type' => 'string', 'required' => true], 'downloadUrl' => ['label' => 'Download URL', 'type' => 'url', 'required' => true], ], sampleData: fn () => [ 'customer' => ['name' => 'Ada Lovelace'], 'downloadUrl' => 'https://example.test/download/demo', ], defaultTemplate: [ 'subject' => 'Your download is ready', 'document' => ['version' => 1, 'blocks' => []], ], ));
Create a mailable from the active published revision:
use Illuminate\Support\Facades\Mail; use Yxanu\MailStudio\Services\ManagedMailableFactory; $mailable = app(ManagedMailableFactory::class)->make( 'musicshop.download-link', $variables, siteId: $siteId, locale: 'de-DE', ); $mailable->replyTo('support@example.test')->attach($invoicePath); Mail::to($recipient)->send($mailable);
The factory validates required variables before sending and pins the returned mailable to the active revision snapshot. Unknown sources, missing variables, and missing published fallbacks throw explicit exceptions.
Editions
Free includes Craft system messages, the public PHP API, one brand profile, starter templates, draft/publish, previews, and test delivery.
Pro adds Freeform mappings, multiple brand profiles, site/language variants and fallback, revision rollback, reusable project presets, and JSON import/export. Development and staging environments can exercise Pro through Craft's standard trial behavior.
Content Model
Templates contain a subject, preheader, and versioned JSON document. Supported blocks are heading, rich text, button, image, callout, divider/spacing, and key/value list. Mail Studio renders deterministic one-column table HTML with inline styles and an independent plain-text body.
Free HTML, arbitrary CSS, scripts, Twig control structures, and MJML are intentionally excluded. Rich text uses a fixed element allowlist. Tokens must be simple paths declared by the selected source.
Buttons, images, rich-text links, and brand logos accept HTTP, HTTPS, and root-relative URLs only. Resolved URL tokens use the same allowlist; unsafe URLs are omitted from the output.
Development
composer install npm ci npm run build vendor/bin/phpunit vendor/bin/pint --test
Built assets must be committed after editor changes. See ARCHITECTURE.md and INTEGRATIONS.md for extension boundaries.
Status
The current pre-release is 0.1.0-beta.3, targeting Craft 6.0.0-beta.1. For Craft 6.0.0-alpha.20, use 0.1.0-alpha.4. See CHANGELOG.md for compatibility notes.
The 0.1.x pre-release line is published as wolkano/craft-mail-studio. The original 0.1.0-alpha.1 tag predates the publisher change. Craft Plugin Store approval and edition pricing remain pending; the beta is distributed via GitHub and Packagist.