Lettr templates let you manage email designs in the Lettr dashboard while your application provides the dynamic data. This separation means designers can update email layouts without touching application code, and developers can change data without worrying about design.This page covers sending templates, versioning, projects, and syncing templates between Lettr and your local codebase. For type-safe template usage with generated enums and DTOs, see Type Safety.
The array keys correspond to merge tags in your template (e.g., {{first_name}}). If a required merge tag is missing from the array, the tag renders as an empty string in the sent email. See Merge Tags & Template Language for the full syntax including conditionals and loops.
Specify a template version to use a specific iteration:
Copy
Mail::lettr() ->to('user@example.com') ->sendTemplate( templateSlug: 'welcome-email', subject: 'Welcome!', substitutionData: $data, version: 2 // Use version 2 of the template );
Omit the version to use the active (published) version.When to use versioning:
Production safety — Pin to a known-good version so publishing a new draft doesn’t affect live emails
A/B testing — Send different versions to different cohorts and compare metrics in Analytics
Gradual rollout — Test a new version with a subset of users before publishing it as the active version
See Versions for how versioning works in the Lettr dashboard.
Download templates from Lettr to edit locally as Blade files:
Copy
php artisan lettr:pull
Options:
--template=slug - Pull a specific template
--as-html - Save as HTML instead of Blade
--with-mailables - Also generate Mailable classes
By default, templates are saved as Blade files to resources/views/emails/lettr/. HTML files go to resources/templates/lettr/. Both paths are configurable in config/lettr.php.
Use --with-mailables to generate ready-to-use Mailable classes alongside the templates. This is the fastest way to scaffold email classes from your existing Lettr templates.
The mergeTags property returns an array of merge tag names defined in the template, which is useful for validating your substitution data before sending.