### Install SDK using npm Source: https://docs.lettermint.co/guides/send-email-with-nodejs This code snippet demonstrates how to install the SDK using the npm package manager. It is a shell script command. ```shellscript npm install ``` -------------------------------- ### Install Lettermint Node.js SDK Source: https://docs.lettermint.co/guides/send-email-with-nodejs Installs the Lettermint SDK using npm. This is the first step to integrate email sending capabilities into your Node.js application. ```bash npm install lettermint ``` -------------------------------- ### Install and Configure Lettermint for Laravel Source: https://docs.lettermint.co/guides/send-email-with-laravel Commands and configuration snippets to install the package via Composer, publish the configuration, and set up environment variables and service providers. ```bash composer require lettermint/lettermint-laravel php artisan vendor:publish --tag="lettermint-config" ``` ```env LETTERMINT_TOKEN=your-api-token LETTERMINT_ROUTE_ID=your-route-id MAIL_MAILER=lettermint ``` ```php // config/services.php 'lettermint' => [ 'token' => env('LETTERMINT_TOKEN'), ], // config/mail.php 'mailers' => [ 'lettermint' => [ 'transport' => 'lettermint', 'route_id' => env('LETTERMINT_ROUTE_ID'), 'idempotency' => true, 'idempotency_window' => 86400, ], ] ``` -------------------------------- ### Install Swaks for SMTP Testing (Shell) Source: https://docs.lettermint.co/guides/send-email-with-smtp Instructions for installing the swaks tool, a command-line SMTP testing utility. It covers installation methods for macOS using Homebrew and Ubuntu using apt-get. ```shellscript # Install swaks (SMTP testing tool) # On macOS: brew install swaks # On Ubuntu: apt-get install swaks ``` -------------------------------- ### Configure Idempotency Headers Source: https://docs.lettermint.co/guides/send-email-with-laravel Example of setting up an Idempotency-Key header in a Laravel-style driver. It demonstrates constructing a dynamic key using user identifiers to prevent duplicate requests. ```php return new Headers([ 'Idempotency-Key' => "welcome-{$this->user->id}", ]); ``` -------------------------------- ### Install and Configure Lettermint Package Source: https://docs.lettermint.co/guides/send-email-with-laravel Commands to install the package via Composer and publish the configuration file to the Laravel project. ```shellscript composer require lettermint/lettermint-laravel php artisan vendor:publish --tag="lettermint-config" ``` -------------------------------- ### Install Lettermint Package Source: https://docs.lettermint.co/guides/send-email-with-nodejs Commands to install the Lettermint library using common JavaScript package managers. Choose the command corresponding to your preferred package manager. ```shellscript npm install lettermint ``` ```shellscript yarn add lettermint ``` ```shellscript pnpm add lettermint ``` ```shellscript bun add lettermint ``` -------------------------------- ### Configure Idempotency Headers Source: https://docs.lettermint.co/guides/send-email-with-laravel Example of initializing Headers with an Idempotency-Key. This ensures that requests are deduplicated based on the provided key structure. ```php return new Headers( text: [ 'Idempotency-Key' => "welcome-{$this->user->id}", ], ); ``` -------------------------------- ### Install Lettermint PHP SDK using Composer Source: https://docs.lettermint.co/guides/send-email-with-php This snippet shows how to install the official Lettermint PHP SDK using Composer. Ensure you have Composer installed and configured in your project. ```bash composer require lettermint/lettermint-php ``` -------------------------------- ### GET /domains Source: https://docs.lettermint.co/guides/send-email-with-nodejs List all domains associated with the team. ```APIDOC ## GET /domains ### Description Retrieves a list of all domains configured for the current team. ### Method GET ### Endpoint /domains ### Response #### Success Response (200) - **domains** (array) - List of domain objects #### Response Example { "domains": [{"id": "dom_1", "name": "example.com"}] } ``` -------------------------------- ### Send Email with Lettermint Python SDK Source: https://lettermint.co/changelog/python-sdk-now-available Example demonstrating how to send a transactional email using the Lettermint Python SDK. It initializes the client with an API token and constructs an email with HTML and plain text content before sending. Requires the 'lettermint' library to be installed. ```python from lettermint import Lettermint client = Lettermint(api_token="your-api-token") response = ( client.email .from_("hello@yourdomain.com") .to("recipient@example.com") .subject("Hello from Python!") .html("

Welcome!

") .text("Welcome!") .send() ) ``` -------------------------------- ### GET /projects Source: https://docs.lettermint.co/guides/send-email-with-java Lists all projects associated with the team. ```APIDOC ## GET /projects ### Description Returns a list of all projects for the team. ### Method GET ### Endpoint /projects ``` -------------------------------- ### GET /team Source: https://docs.lettermint.co/guides/send-email-with-nodejs Retrieves basic team information and configuration settings. ```APIDOC ## GET /team ### Description Returns basic team information with optional includes for related resources. ### Method GET ### Endpoint /team ### Response #### Success Response (200) - **id** (string) - Team unique identifier. - **name** (string) - Team display name. ### Response Example { "id": "team_123", "name": "My Development Team" } ``` -------------------------------- ### GET /ping Source: https://docs.lettermint.co/guides/send-email-with-nodejs Check the API status and verify authentication. ```APIDOC ## GET /ping ### Description This endpoint can be used to check the API status and verify authentication. It accepts both Team API tokens (via Bearer authentication) and Project tokens (via X-Lettermint-Token header). ### Method GET ### Endpoint /ping ### Response #### Success Response (200) - **status** (string) - The current status of the API #### Response Example { "status": "ok" } ``` -------------------------------- ### Install Lettermint Magento 2 Module Source: https://docs.lettermint.co/guides/send-email-with-magento Installs the official Lettermint Magento 2 module using Composer. After installation, Magento setup and cache commands must be run. ```bash composer require lettermint/lettermint-magento2 bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:clean ``` -------------------------------- ### GET /ping Source: https://docs.lettermint.co/guides/send-email-with-laravel Check API status and verify authentication. ```APIDOC ## GET /ping ### Description This endpoint can be used to check the API status and verify authentication. It accepts both Team API tokens (via Bearer authentication) and Project tokens (via X-Lettermint-Token header). ### Method GET ### Endpoint /ping ### Response #### Success Response (200) - **status** (string) - Current status of the API #### Response Example { "status": "ok" } ``` -------------------------------- ### Initialize Lettermint Client and Send Basic Email (PHP) Source: https://docs.lettermint.co/guides/send-email-with-php Demonstrates initializing the Lettermint client with an API key and sending a simple text email. Requires the SDK to be installed via Composer and autoloaded. ```php email ->from('John Doe ') ->to('recipient@example.com') ->subject('Hello from Lettermint!') ->text('Hello! This is a test email.') ->send(); echo "Email sent with ID: " . $response->id; ``` -------------------------------- ### Magento 2 Setup and Cache Commands (Shell) Source: https://docs.lettermint.co/guides/send-email-with-magento This snippet demonstrates common Magento 2 command-line interface (CLI) commands used for upgrading the application, compiling dependency injection, and clearing the cache. These commands are essential for applying changes and ensuring the application runs smoothly after modifications. ```shellscript bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:clean ``` -------------------------------- ### Initialize Lettermint Client Source: https://docs.lettermint.co/guides/send-email-with-nodejs Example of how to import and initialize the Lettermint client in a TypeScript environment using an API token. ```typescript import { Lettermint } from "lettermint"; const client = new Lettermint("YOUR_API_TOKEN"); ``` -------------------------------- ### GET /team Source: https://docs.lettermint.co/guides/send-email-with-laravel Retrieves basic team information and configuration details. ```APIDOC ## GET /team ### Description Returns basic team information with optional includes for related resources. ### Method GET ### Endpoint /team ### Response #### Success Response (200) - **id** (string) - Team identifier. - **name** (string) - Team name. ### Response Example { "id": "team_123", "name": "My Development Team" } ``` -------------------------------- ### GET /api-reference/team/generic/ping-the-api Source: https://docs.lettermint.co/guides/send-email-with-laravel A simple health check endpoint to verify API connectivity. ```APIDOC ## GET /api-reference/team/generic/ping-the-api ### Description Checks if the API is operational. ### Method GET ### Endpoint /api-reference/team/generic/ping-the-api ### Response #### Success Response (200) - **status** (string) - Returns 'pong' #### Response Example { "status": "pong" } ``` -------------------------------- ### Testing SMTP Configuration with Shell Script Source: https://docs.lettermint.co/guides/send-email-with-smtp Provides a shell script example for testing SMTP configuration. This script demonstrates how to send a test email using common SMTP parameters. ```shellscript printf 'Subject: Test email from %s\n\nThis is a test email sent from the command line.\n' "$(hostname)" | msmtp --debug --account=default "recipient@example.com" ``` -------------------------------- ### GET /api-reference/team/domain/list-all-domains-for-the-team Source: https://docs.lettermint.co/guides/send-email-with-laravel Retrieves a list of all domains associated with the current team account. ```APIDOC ## GET /api-reference/team/domain/list-all-domains-for-the-team ### Description Fetches all domains configured for the authenticated team. ### Method GET ### Endpoint /api-reference/team/domain/list-all-domains-for-the-team ### Response #### Success Response (200) - **domains** (array) - List of domain objects #### Response Example { "domains": [ { "id": "dom_001", "name": "example.com", "verified": true } ] } ``` -------------------------------- ### Initialize and Send Email with Lettermint Source: https://docs.lettermint.co/guides/send-email-with-java Demonstrates how to initialize the Lettermint client with an API key and send a basic email message. ```java import co.lettermint.Lettermint; Lettermint lettermint = new Lettermint("your-api-key"); SendEmailResponse response = lettermint.email() .from("John Doe ") .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()); ``` -------------------------------- ### Send First Email with Lettermint in Java Source: https://docs.lettermint.co/guides/send-email-with-java Demonstrates how to send your first email using the initialized Lettermint client. This example includes setting the sender's address. Further customization for recipients and content would follow. ```java SendEmailResponse response = lettermint.email() .from("John Doe ") .to("Jane Doe ") .subject("Hello from Lettermint") .text("This is a test email.") .send(); ``` -------------------------------- ### GET /webhooks/{webhookId}/deliveries Source: https://docs.lettermint.co/guides/send-email-with-laravel Retrieves a paginated list of delivery attempts for a specific webhook. ```APIDOC ## GET /webhooks/{webhookId}/deliveries ### Description Returns a paginated list of delivery attempts for a specific webhook. ### Method GET ### Endpoint /webhooks/{webhookId}/deliveries ### Parameters #### Path Parameters - **webhookId** (string) - Required - The unique identifier of the webhook. ``` -------------------------------- ### GET /webhooks/{webhookId} Source: https://docs.lettermint.co/guides/send-email-with-laravel Retrieves full information for a specific webhook, including recent delivery status. ```APIDOC ## GET /webhooks/{webhookId} ### Description Returns full webhook information including recent deliveries. ### Method GET ### Endpoint /webhooks/{webhookId} ### Parameters #### Path Parameters - **webhookId** (string) - Required - The unique identifier of the webhook. ### Response #### Success Response (200) - **webhook** (object) - Webhook configuration details and recent delivery logs. ``` -------------------------------- ### GET /stats Source: https://docs.lettermint.co/guides/send-email-with-laravel Retrieves aggregate message statistics for the team or a specific project within a 90-day range. ```APIDOC ## GET /stats ### Description Returns aggregate message statistics for the specified date range. Provide a project_id to get per-project stats with transactional/broadcast breakdown. Without project_id, returns team-wide totals. ### Method GET ### Endpoint /stats ### Parameters #### Query Parameters - **project_id** (string) - Optional - The ID of the project to filter stats. - **start_date** (string) - Required - Start of the date range (max 90 days). - **end_date** (string) - Required - End of the date range. ### Response #### Success Response (200) - **stats** (object) - Aggregate statistics data. ### Response Example { "stats": { "total_sent": 1500, "delivered": 1450 } } ``` -------------------------------- ### Register Event Listeners in Laravel Source: https://docs.lettermint.co/guides/send-email-with-laravel Example of how to import Lettermint event classes and register them within the Laravel EventServiceProvider. ```php use Lettermint\Laravel\Events\MessageDelivered; use Lettermint\Laravel\Events\MessageHardBounced; protected $listen = [ ``` -------------------------------- ### SMTP Configuration Guide Source: https://docs.lettermint.co/guides/send-email-with-smtp Instructions for enabling SMTP and the required connection parameters for your email client or application. ```APIDOC ## SMTP Configuration ### Description This section outlines how to enable SMTP for your project via the Lettermint dashboard and provides the standard configuration settings required for integration. ### Enabling SMTP 1. Navigate to the [Projects dashboard](https://dash.lettermint.co/projects). 2. Locate the SMTP settings for your specific project. 3. Enable the SMTP option. ### Configuration Settings Use the following values to configure your application or email client: | Setting | Value | | :--- | :--- | | **Host** | `smtp.lettermint.co` | | **Port** | [Refer to your dashboard for specific port details] | ### Additional Information For more details on how SMTP works, please refer to our [‘What is SMTP’ article](https://lettermint.co/knowledge-base/definitions/what-is-smtp). ``` -------------------------------- ### Send First Email with Lettermint (TypeScript) Source: https://docs.lettermint.co/guides/send-email-with-nodejs Sends your first email using the initialized Lettermint client. This example shows the basic structure for sending an email. Further customization options are available in the Lettermint documentation. ```typescript const response = await lettermint.send({ to: "recipient@example.com", from: "sender@example.com", subject: "Hello from Lettermint!", body: "This is the body of your first email." }); ``` -------------------------------- ### POST /projects Source: https://docs.lettermint.co/guides/send-email-with-smtp Creates a new project for the team. ```APIDOC ## POST /projects ### Description Creates a new project for the team. ### Method POST ### Endpoint /projects ### Request Body - **name** (string) - Required - The name of the project. ``` -------------------------------- ### GET /webhooks/{webhookId}/deliveries/{deliveryId} Source: https://docs.lettermint.co/guides/send-email-with-laravel Retrieves detailed information about a specific delivery attempt, including payload and response data. ```APIDOC ## GET /webhooks/{webhookId}/deliveries/{deliveryId} ### Description Returns full details of a single delivery attempt including payload and response data. ### Method GET ### Endpoint /webhooks/{webhookId}/deliveries/{deliveryId} ### Parameters #### Path Parameters - **webhookId** (string) - Required - The unique identifier of the webhook. - **deliveryId** (string) - Required - The unique identifier of the delivery attempt. ``` -------------------------------- ### Implement Custom Idempotency Key Source: https://docs.lettermint.co/guides/send-email-with-laravel Example showing how to override the default idempotency key in a Laravel Mailable class using the Headers object. ```php use Illuminate\Mail\Mailables\Headers; public function headers() { // Custom implementation logic here } ``` -------------------------------- ### Listening to Lettermint Events in Laravel (PHP) Source: https://docs.lettermint.co/guides/send-email-with-laravel Demonstrates how to configure event listeners in Laravel's EventServiceProvider to react to specific Lettermint events. This example shows how to listen for 'MessageDelivered' and 'MessageHardBounced' events. ```php use Lettermint\Laravel\Events\MessageDelivered; use Lettermint\Laravel\Events\MessageHardBounced; protected $listen = [ MessageDelivered::class => [ // Listener for MessageDelivered event ], MessageHardBounced::class => [ // Listener for MessageHardBounced event ], ]; ``` -------------------------------- ### Configure Email Routing Source: https://docs.lettermint.co/guides/send-email-with-nodejs Shows how to initialize an email request using the Lettermint client. This snippet demonstrates the basic syntax for awaiting a response from the email service. ```typescript const response = await lettermint.email ``` -------------------------------- ### GET /webhooks/{webhookId}/deliveries/{deliveryId} Source: https://docs.lettermint.co/api-reference/introduction Get details of a specific delivery. ```APIDOC ## GET /webhooks/{webhookId}/deliveries/{deliveryId} ### Description Returns full details of a single delivery attempt including payload and response data. ### Method GET ### Endpoint /webhooks/{webhookId}/deliveries/{deliveryId} ``` -------------------------------- ### JavaScript Component Rendering Example Source: https://docs.lettermint.co/guides/send-email-with-nodejs This JavaScript snippet showcases a pattern for rendering components, likely within a framework like React or a similar JSX-based library. It uses `_jsx` and `_jsxs` for creating elements and `_components` for accessing predefined components like `span`. The code illustrates how to structure UI elements with specific styles and children, including dynamic content. ```javascript function _createMdxContent(props) { const _components = { a: "a", code: "code", p: "p", pre: "pre", span: "span", ..._provideComponents(), ...props.components }; return _jsxs(_Fragment, { children: [ _jsx(_components.span, { style: { color: "#0A3069", "--shiki-dark": "#569CD6" }, children: "}" }), _jsx(_components.span, { style: { color: "#0A3069", "--shiki-dark": "#CE9178" }, children: "`" }), _jsx(_components.span, { style: { color: "#1F2328", "--shiki-dark": "#D4D4D4" }, children: ");" }) ] }); } ``` -------------------------------- ### Install Lettermint Nuxt Module via NPM Source: https://lettermint.co/changelog/lettermint-module-nuxt-now-available Installs the Lettermint Nuxt module using NPM. After installation, you need to manually add 'nuxt-lettermint' to the modules array in your Nuxt configuration. ```bash npm install nuxt-lettermint ``` -------------------------------- ### Send an email using the Lettermint Java SDK Source: https://lettermint.co/changelog/java-sdk-now-available Demonstrates how to initialize the Lettermint client and send a basic HTML email. The process requires an API token and utilizes a fluent builder pattern to define sender, recipient, subject, and content. ```java import co.lettermint.Lettermint; Lettermint lettermint = new Lettermint("your-api-token"); SendEmailResponse response = lettermint.email() .from("sender@example.com") .to("recipient@example.com") .subject("Hello from Lettermint") .html("

Hello World!

") .send(); ``` -------------------------------- ### Send Email with Laravel Mail Facade Source: https://docs.lettermint.co/guides/send-email-with-laravel Demonstrates the use of the Laravel Mail facade to dispatch a welcome email using the Lettermint driver. ```php use App\Mail\WelcomeEmail; ``` -------------------------------- ### MDX Component Rendering for Laravel Guide Source: https://docs.lettermint.co/guides/send-email-with-laravel A compiled JavaScript snippet representing the MDX content for the Laravel integration guide. It defines the structure for rendering the documentation page, including the introduction and component mapping. ```javascript "use strict"; const {jsx: _jsx} = arguments[0]; const {useMDXComponents: _provideComponents} = arguments[0]; function _createMdxContent(props) { const _components = { p: "p", ..._provideComponents(), ...props.components }; return _jsx(_components.p, { children: "Integrate Lettermint with Laravel using our official mail driver. Drop-in replacement with tags, metadata, and webhook support." }); } function MDXContent(props = {}) { const {wrapper: MDXLayout} = { ..._provideComponents(), ...props.components }; return MDXLayout ? _jsx(MDXLayout, { ...props, children: _jsx(_createMdxContent, { ...props }) }) : _createMdxContent(props); } return { default: MDXContent }; ``` -------------------------------- ### GET /v1/stats Source: https://lettermint.co/changelog/email-statistics-now-available-via-the-stats-api Retrieves email statistics for a specified time period. Can be filtered by project_id to get project-level data. ```APIDOC ## GET /v1/stats ### Description Retrieve email statistics including sent, delivered, bounces, opens, clicks, and spam complaints. Data can be retrieved for the entire team or filtered by a specific project. ### Method GET ### Endpoint https://api.lettermint.co/v1/stats ### Parameters #### Query Parameters - **from** (string) - Required - Start date in YYYY-MM-DD format. - **to** (string) - Required - End date in YYYY-MM-DD format (max 90 days range). - **project_id** (string) - Optional - The unique identifier for a specific project to filter statistics. ### Request Example GET https://api.lettermint.co/v1/stats?from=2026-03-01&to=2026-03-28 ### Response #### Success Response (200) - **totals** (object) - Aggregated statistics for the requested period. - **daily** (array) - List of daily breakdown objects. #### Response Example { "from": "2026-03-01", "to": "2026-03-28", "totals": { "sent": 4821, "delivered": 4743, "hard_bounced": 12, "spam_complaints": 2, "opened": 1893, "clicked": 412 }, "daily": [ { "date": "2026-03-01", "sent": 178, "delivered": 175 } ] } ``` -------------------------------- ### Install Lettermint via Composer Source: https://docs.lettermint.co/guides/send-email-with-magento This command installs the Lettermint Magento 2 package into your project using the Composer dependency manager. ```shellscript composer require lettermint/lettermint-magento2 ```