LETTERMINT_PROJECT_TOKEN=your-lettermint-project-token# Optional: required only when using the Team API clientLETTERMINT_API_TOKEN=your-lettermint-api-tokenLETTERMINT_ROUTE_ID=your-route-id
LETTERMINT_PROJECT_TOKEN is used for sending email through Laravel mail.
The legacy LETTERMINT_TOKEN variable is still supported as a fallback, but
LETTERMINT_PROJECT_TOKEN is preferred for new applications and v2 upgrades.
use Illuminate\Mail\Mailables\Envelope;public function envelope(): Envelope{ return new Envelope( subject: 'Welcome to Our Platform', tags: ['onboarding'], );}
One tag per message. Tags can contain letters, numbers, hyphens, underscores, and spaces (max 255 characters).
See Tags documentation for more details.
5. Metadata
Attach custom data for tracking and webhook payloads.
Using the metadata() Method
Code
Mail::to('customer@example.com') ->send( (new OrderConfirmation($order)) ->metadata('order_id', $order->id) ->metadata('customer_id', $order->customer_id) );
In Mailable Envelope
Code
use Illuminate\Mail\Mailables\Envelope;public function envelope(): Envelope{ return new Envelope( subject: 'Order Confirmation', metadata: [ 'order_id' => $this->order->id, 'customer_id' => $this->order->customer_id, 'order_total' => $this->order->total, ], );}
Metadata is included in webhook payloads but not sent to recipients.
6. Multiple Routes
Configure separate mailers for different email types (transactional, marketing, etc.):
use Illuminate\Mail\Mailables\Headers;public function headers(): Headers{ return new Headers( text: [ 'Idempotency-Key' => "welcome-{$this->user->id}", ], );}
Set idempotency_window to 86400 or higher for permanent deduplication within API retention.
8. Webhooks
The driver automatically registers a webhook endpoint and dispatches Laravel events.