Use when migrating a project to Lettr from another email provider (Resend, Mailgun, SendGrid, Postmark, SES, Mandrill), setting up Lettr for the first time, or installing the Lettr SDK.
Migrate your project to Lettr for transactional email delivery. This skill auto-detects your stack, installs the Lettr SDK, migrates email sending, imports provider-hosted templates, and sets up your sending domain.
Scan the project root for dependency files to detect the language and framework:
| File | Language | Framework Detection |
|---|---|---|
composer.json | PHP | laravel/framework (Laravel), symfony/symfony (Symfony) |
package.json | Node.js | next (Next.js), express (Express), @nestjs/core (NestJS) |
go.mod | Go | Check module path |
Cargo.toml | Rust | Check dependencies |
pom.xml| Java |
| Check for Spring Boot |
requirements.txt / pyproject.toml | Python | django, flask, fastapi |
Report what you found before proceeding.
Search the project for current email provider usage. Check dependencies AND source code:
Resend:
resend/resend-php, resend/resend-laravel, resend (npm)RESEND_API_KEYMailgun:
mailgun/mailgun-php, mailgun.jsMAILGUN_SECRET, MAILGUN_DOMAINMAIL_MAILER=mailgunSendGrid:
sendgrid/sendgrid, @sendgrid/mailSENDGRID_API_KEYPostmark:
wildbit/postmark-php, postmark (npm)POSTMARK_TOKENMAIL_MAILER=postmarkAWS SES:
aws/aws-sdk-php with SES usage, @aws-sdk/client-sesMAIL_MAILER=sesMandrill:
mandrill/mandrill, mailchimp_transactionalMANDRILL_API_KEY*|VARIABLE|* format)No provider / SMTP only:
MAIL_MAILER=smtp or direct SMTP credentialsReport the detected provider and email patterns.
Scan the codebase to categorize how emails are sent:
| Pattern | Detection | Migration Action |
|---|---|---|
| Inline HTML | HTML strings in code | Keep inline, swap send call to Lettr |
| Framework templates | Blade, Pug, Jinja, ERB files | Keep templates, swap mail driver to Lettr |
| Provider-hosted templates | Template IDs/slugs referencing provider | Import via API, update references |
| SMTP relay | SMTP host/port/credentials in config | Swap to Lettr SMTP credentials |
| Direct API calls | HTTP calls to provider endpoints | Replace with Lettr API calls |
curl -s -H "Authorization: Bearer $LETTR_API_KEY" https://app.lettr.com/api/auth/check
If invalid, ask the user for a valid key. Keys start with lttr_.
See references/installation.md for full installation instructions per language.
Quick start by framework:
Laravel:
composer require lettr/lettr-laravel
php artisan lettr:init
Set in .env: LETTR_API_KEY=lttr_xxx and MAIL_MAILER=lettr
Node.js: npm install lettr or bun add lettr
PHP: composer require lettr/lettr-php
Python: pip install lettr
Go: go get github.com/lettr/lettr-go
After installation, set the LETTR_API_KEY environment variable.
Extract the sending domain from project config:
MAIL_FROM_ADDRESS in .env or config/mail.phpDEFAULT_FROM_EMAIL in settings.pyfrom fields in email send callsFROM_EMAIL, SENDER_EMAILExtract the domain part (e.g., [email protected] → example.com).
# Create domain
curl -s -X POST \
-H "Authorization: Bearer $LETTR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain": "DOMAIN"}' \
https://app.lettr.com/api/domains
# Verify (after DNS records are added)
curl -s -X POST \
-H "Authorization: Bearer $LETTR_API_KEY" \
https://app.lettr.com/api/domains/DOMAIN/verify
Display the DNS records from the response (CNAME, DKIM TXT, DMARC TXT) and tell the user to add them. DNS propagation can take up to 48 hours.
See references/migration-examples.md for provider-specific migration code.
Key principles:
MAIL_MAILER=lettr: no code changes needed for MailablesIMPORTANT: Only import if the user stores templates on their email provider. If templates are in the codebase (Blade, Pug, Jinja, inline HTML), skip this step.
If provider-hosted templates are detected:
curl -s -X POST \
-H "Authorization: Bearer $LETTR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"provider": "PROVIDER", "api_key": "OLD_KEY", "region": "us", "domain": "example.com"}' \
https://app.lettr.com/api/templates/import
curl -s -H "Authorization: Bearer $LETTR_API_KEY" \
https://app.lettr.com/api/templates/import/IMPORT_ID
Supported providers: mailgun, sendgrid, postmark, ses, mandrill
Send a test email:
curl -s -X POST \
-H "Authorization: Bearer $LETTR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": [{"email": "USER_EMAIL"}],
"from": {"email": "test@DOMAIN"},
"subject": "Lettr Setup Complete",
"html": "<h1>Your Lettr setup is working!</h1><p>This email was sent via your new Lettr integration.</p>"
}' \
https://app.lettr.com/api/emails
Ask the user for their email address.
curl -s -X POST \
-H "Authorization: Bearer $LETTR_API_KEY" \
-H "Content-Type: application/json" \
-d '{}' \
https://app.lettr.com/api/onboarding/complete
Summarize: SDK installed, domain configured, email sending migrated, templates imported (if applicable), test email sent.
If an SDK doesn't exist for the user's language, generate raw HTTP calls. Full API spec: https://app.lettr.com/openapi.json