Add the SDK to your project using Maven or Gradle:
2. Send your first email
Initialize the client with your API token:
Code
import co.lettermint.Lettermint;Lettermint lettermint = new Lettermint("your-api-key");
Send your first email:
Code
SendEmailResponse response = lettermint.email() .from("John Doe <john@yourdomain.com>") .to("recipient@example.com") .subject("Hello from Lettermint!") .text("Hello! This is a test email.") .send();System.out.println("Email sent with ID: " + response.getMessageId());
3. Email Features
Basic Email
Send a simple text or HTML email:
Code
lettermint.email() .from("John Doe <john@yourdomain.com>") .to("recipient@example.com") .subject("Your account is ready!") .html("<h1>Welcome!</h1><p>Thanks for signing up.</p>") .text("Welcome! Thanks for signing up.") .send();
One tag per message. Tags can contain letters, numbers, hyphens, underscores, and spaces (max 255 characters).
See Tags documentation for more details.
Route Selection
Direct emails to specific routes within your project:
Code
lettermint.email() .from("notifications@yourdomain.com") .to("user@example.com") .subject("Welcome!") .route("transactional") .html("<p>Welcome to our platform.</p>") .send();