Configuration
After installing the package, configure Lettermint Laravel to integrate with your application’s mail system.Configuration file
The main configuration file is located atconfig/lettermint.php after publishing:
Environment variables
Add these variables to your.env file:
Find your API token and webhook signing secret in your Lettermint project settings.
Mail configuration
Basic setup
Configure the Lettermint transport in yourconfig/mail.php:
Using routes
Lettermint routes help you organize your email traffic. You can specify a route ID for each mailer:.env:
Multiple mailers with different routes
Configure multiple mailers using the same Lettermint transport but with different route IDs:Services configuration
Add the Lettermint service to yourconfig/services.php:
Idempotency configuration
Idempotency prevents duplicate email sends, which is especially useful for queued jobs that might be retried.Enable automatic idempotency
Configure idempotency settings in yourconfig/mail.php mailer configuration:
Configuration options
Enable or disable automatic content-based idempotency
true: Generates idempotency keys based on email contentfalse: Disables automatic idempotency (user headers still work)
Time window in seconds for deduplication
- Default:
86400(24 hours to match Lettermint API retention) - Set to match your needs (e.g.,
3600for 1 hour,300for 5 minutes) - When set to
86400or higher, emails with identical content are permanently deduplicated within the API retention period
How automatic idempotency works
Whenidempotency is true, the driver generates a unique key based on:
- Email subject, recipients (to, cc, bcc), and content
- Sender address (to differentiate between different sending contexts)
- Time window (if less than 24 hours)
- Identical emails are only sent once within the configured time window
- Retried queue jobs won’t create duplicate emails
- Different emails or the same email after the time window will be sent normally
Per-mailer configuration
You can configure idempotency differently for each mailer:Webhook configuration
Configure webhooks to receive email delivery events from Lettermint.Webhook settings
The webhook configuration is inconfig/lettermint.php:
Environment variables
Add webhook settings to your.env file:
Webhook endpoint
The package automatically registers a webhook endpoint at:POST /lettermint/webhook. Configure this URL in your Lettermint dashboard.
Learn more about handling webhook events in the Webhooks guide.
Configuration options reference
Lettermint config (config/lettermint.php)
| Option | Type | Default | Description |
|---|---|---|---|
token | string | null | Your Lettermint API token |
webhooks.secret | string | null | Webhook signing secret for verification |
webhooks.prefix | string | lettermint | Route prefix for webhook endpoint |
webhooks.tolerance | integer | 300 | Timestamp tolerance in seconds |
Mail config (config/mail.php)
| Option | Type | Default | Description |
|---|---|---|---|
transport | string | - | Must be lettermint |
route_id | string | null | Lettermint route ID for this mailer |
idempotency | boolean | false | Enable automatic content-based idempotency |
idempotency_window | integer | 86400 | Idempotency window in seconds |
Next steps
Idempotency
Learn about automatic and custom idempotency keys
Webhooks
Handle email delivery events with typed Laravel events
Tags and metadata
Add tags and metadata for better tracking and analytics
Routes
Organize email traffic with Lettermint routes