Install the SDK via your preferred package manager:
2. Send your first email
Initialize the client with your API token:
Code
import { Lettermint } from "lettermint";const lettermint = new Lettermint({ apiToken: "your-api-token"});
Send your first email:
Code
const response = await lettermint.email .from('John Doe <john@yourdomain.com>') .to('recipient@example.com') .subject('Hello from Lettermint') .text('This is a test email sent using the Lettermint Node.js SDK.') .send();console.log(`Email sent with ID: ${response.message_id}`);
3. Email Features
Basic Email
Send a simple text or HTML email:
Code
const response = await 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: