lettr/lettr-php package gives you a fluent interface for building and sending emails, managing templates, and tracking delivery — all with full IDE autocompletion and compile-time safety.
Using Cursor? Jump straight in using this prompt
Why Use the PHP SDK?
Rather than making raw HTTP requests, the SDK provides:- Type-safe API client — Full IDE autocompletion and type hints for all methods
- Fluent email builder — Chainable methods for constructing complex emails
- Template support — Send Lettr-managed templates with merge tags and versioning
- Error handling — Typed exceptions for different API errors (validation, auth, not found)
- Zero dependencies — Only requires Guzzle HTTP client (which most PHP projects already use)
If you’re using Laravel, consider using the framework-specific SDK instead for deeper integration: Laravel SDK
Prerequisites
Before you begin, make sure you have: You’ll also need:- PHP 8.4+ and Composer installed
- A verified sending domain in your Lettr dashboard
Quick Setup
The fastest way to get started is a three-step install, configure, and send process.Install the package
Verify Your API Key
Test that your API key is valid before sending emails:Using a Framework?
If you’re working within a specific PHP framework, these integrations provide deeper integration:Laravel
Mail facade integration, Mailables, and code generation
SMTP
Use SMTP instead of the HTTP API
WordPress
Send all WordPress emails through Lettr
Section Overview
This quickstart is organized into three focused pages:| Page | What You’ll Learn |
|---|---|
| Installation | Package requirements, client setup, and verifying your installation |
| Sending Emails | All sending methods — HTML, text, templates, attachments, tracking, and error handling |
| Templates | Managing Lettr templates, versioning, and retrieving merge tags |