Sending with Templates
The simplest way to send a template:{{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.
Type-Safe Templates
Generate enums, DTOs, and Mailable classes from your templates for compile-time safety:Type Safety
Generate enums, DTOs, and Mailables for compile-time safety
Template Versioning
Specify a template version to use a specific iteration:- 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
Pull Templates Locally
Download templates from Lettr to edit locally as Blade files:--template=slug- Pull a specific template. Exits with a failure code if it doesn’t exist--as-html- Save as HTML instead of Blade--with-mailables- Also generate Mailable and DTO classes--skip-templates- With--with-mailables, generate only DTOs and Mailables, without downloading templates--dry-run- Preview what would be downloaded without writing files
resources/views/emails/lettr/. HTML files go to resources/templates/lettr/. Both paths are configurable in config/lettr.php.
When converting to Blade, merge tags become variables ({{first_name}} → {{ $first_name }}) and loops become null-safe @foreach blocks whose items are read as arrays ({{#each items}}{{this.name}} → @foreach($items ?? [] as $item){{ $item['name'] }}), which is the shape generated DTOs pass to the view.
Push Templates to Lettr
Upload local Blade templates to Lettr, creating them if they do not exist:--path, the command looks for templates in blade_path from config/lettr.php (where lettr:pull saves them), then in resources/views/emails, mails, email and mail, and asks before using a folder.
Options:
--path=- Custom path to the templates directory, absolute or relative to your project root--template=filename- Push only one template--purpose=- Module to create the templates in:transactional(default) orcampaign--dry-run- Preview what would be created without pushing
Listing Templates
Retrieve available templates via the API:key, a required flag, a type, and children for loop blocks, which is useful for validating your substitution data before sending.
What’s Next
Type Safety
Generate enums, DTOs, and Mailables for compile-time safety
Template Language
Full merge tag syntax including conditionals and loops
Projects & Folders
Organize templates into projects
Topol Editor
Design templates visually in the Lettr dashboard