Package Configuration
The package configuration is located inconfig/lettermint.php. Publish it using:
API Token
Your Lettermint API token. Every Lettermint project has a unique API token that can be found in your project settings.Environment Variable: Alternatively, you can configure the token in
LETTERMINT_TOKENconfig/services.php:Webhook Configuration
All webhook-related settings are nested under thewebhooks key.
The signing secret used to verify incoming webhook requests from Lettermint. This ensures that the webhook payload is authentic and hasn’t been tampered with.Environment Variable: Find your webhook signing secret in your Lettermint project settings under the Webhooks section.
LETTERMINT_WEBHOOK_SECRETDefault: nullThe route prefix for the webhook endpoint. The full webhook URL will be constructed as Example URLs:
{your-app-url}/{prefix}/webhook.Environment Variable: LETTERMINT_WEBHOOK_PREFIXDefault: lettermint- Default:
https://yourapp.com/lettermint/webhook - Custom prefix
api/events:https://yourapp.com/api/events/webhook
The maximum allowed time difference (in seconds) between the webhook timestamp and the current server time. This helps prevent replay attacks.Environment Variable: If the timestamp difference exceeds this value, the webhook request will be rejected.
LETTERMINT_WEBHOOK_TOLERANCEDefault: 300 (5 minutes)Mail Transport Configuration
Configure the Lettermint mail transport inconfig/mail.php to send emails using Laravel’s Mail facade.
Basic Setup
Transport Options
The Lettermint route ID to use for sending emails through this mailer. When specified, all emails sent through this mailer will use the specified route.This is useful when you have multiple sending routes configured in Lettermint and want to assign specific mailers to specific routes.
Enable automatic idempotency key generation for emails sent through this mailer. When enabled, the package automatically generates a stable idempotency key based on email content.Default: The idempotency key is generated using a SHA256 hash of:
false- Email subject
- Recipients (to, cc, bcc)
- Email body (HTML or text)
- Sender address
- Timestamp (if window is less than 24 hours)
Individual emails can override this by setting a custom
Idempotency-Key header, which takes precedence over automatic generation.The time window (in seconds) for automatic idempotency key generation. This option is only used when How it works:
idempotency is enabled.Default: 86400 (24 hours)- 24 hours (default): The idempotency key remains the same for the same email content indefinitely, matching Lettermint’s API retention period. This provides permanent deduplication.
- Less than 24 hours: The current timestamp (rounded to the window) is included in the key generation. This allows the same email to be sent again after the window expires.
| Window | Use Case |
|---|---|
86400 (24h) | Prevent duplicate sends permanently (useful for transactional emails) |
3600 (1h) | Allow resending the same email after 1 hour (useful for notifications) |
300 (5m) | Short-term retry protection for queue failures |
Configuration Examples
Basic Configuration
config/lettermint.php:Multiple Mailers with Different Routes
config/mail.php:Custom Webhook Endpoint
config/lettermint.php:https://yourapp.com/api/webhooks/lettermint/webhook.