lettr-java package gives you an idiomatic Java client that works with any Java application — Spring Boot, Jakarta EE, Android, or standalone applications. It follows Java conventions and integrates seamlessly with your existing codebase.
Using Cursor? Jump straight in using this prompt
Why Use the Java SDK?
Rather than making raw HTTP requests, the SDK provides:- Type-safe API — Full type safety with builder patterns and immutable objects
- Fluent builders — Chainable methods for constructing complex emails
- Exception handling — Typed exceptions for different error scenarios
- Java 11+ support — Works with modern Java versions and HTTP clients
- Zero runtime dependencies — Minimal footprint with only HTTP client requirements
Prerequisites
Before you begin, make sure you have:API Key
Create an API key in the Lettr dashboard
Verified Domain
Add and verify your sending domain
- Java 11 or later installed
- Maven or Gradle for dependency management
- A verified sending domain in your Lettr dashboard
Quick Setup
Get started in three quick steps: add the dependency, create a client, and send.1
Add the dependency
Add the Lettr SDK to your project using Maven or Gradle:The SDK requires Java 11+ and uses the Java HTTP Client (java.net.http) for making requests.
2
Create a client
3
Send your first email
requestId for tracking and the number of accepted recipients.Configuration
Environment Variables
Read your API key from an environment variable:Using Properties Files
Load configuration from a properties file:Custom HTTP Client
Use a custom HTTP client with custom timeouts:Sending Emails
Basic HTML Email
Send a simple HTML email:With Display Name
Add a friendly display name to the sender address:Plain Text Email
Send a plain text email without HTML:Multipart Emails (HTML + Text)
Send both HTML and plain text versions for maximum compatibility:Explore the SDK
Beyond sending, the SDK manages every Lettr resource:Templates
Manage Lettr templates and merge tags
Domains
Add, verify, and manage sending domains
Webhooks
Manage webhook endpoints for delivery and engagement events
Audience
Lists, contacts, topics, properties, and segments
Campaigns
List, send, and schedule campaigns
What’s Next
Advanced Features
Attachments, templates, batch sending, and more
API Reference
Complete API documentation
Best Practices
Email deliverability tips