LettermintLettermint
  • Knowledge base
  • Community
  • Changelog
  • Support
  • Documentation
  • Sending API
  • Team API
Getting started
Guides
    Node.jsPHPPythonGoLaravelMagento 2WordPressNuxtJava
    SMTP
Platform
Resources
Guides

Magento 2

The official Lettermint Magento 2 module routes your store's email through Lettermint. Once you add your API token, every transactional message Magento already sends, such as order confirmations, shipping notifications, invoices, and password resets, is delivered through Lettermint with no template or code changes.

Lettermint runs entirely inside the EU and processes mail in line with GDPR, so your shop's customer data stays in Europe. Combined with high deliverability, that makes the module a strong fit for EU stores that need order and account emails to reach the inbox reliably.

Requirements

Before you start you need:

  • A Magento 2.4 store (Magento Open Source or Adobe Commerce) running on PHP 8.2 or newer
  • Command-line access to run Composer and bin/magento
  • A Lettermint account with a verified sending domain
  • A Project API token from your project settings

If your domain is not verified yet, follow the domain setup guide first so your store's email reaches the inbox instead of the spam folder.

1. Installation

Install the package via Composer:

TerminalCode
composer require lettermint/lettermint-magento2

After installation, run the Magento setup commands:

TerminalCode
bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:clean

2. Configuration

Make sure you have a Project API token ready, which you can create in your project settings.

Finding the Settings

Navigate to Stores → Settings → Configuration. Then look for Lettermint in the sidebar.

Magento 2 admin settings for the Lettermint module

General Settings

  1. Set Enable Lettermint Email to Yes
  2. Enter your project's Project API token in the API Token field
  3. Save the configuration

Route Configuration (Optional)

Configure which routes handle different email types:

  • Transactional Email Route: Used for system emails (password resets, order confirmations, invoices, track & trace updates)
  • Newsletter/Marketing Route: Used for newsletter emails sent via Marketing → Newsletter Queue

The defaults work for most setups. Only configure custom routes if you need to separate email traffic for analytics or deliverability purposes.

3. Sending Emails

Automatic Transactional Emails

Once configured, all Magento transactional emails automatically route through Lettermint:

  • Order confirmations
  • Shipping notifications
  • Password reset emails
  • Customer account emails
  • Invoice and credit memo emails

No code changes required - just configure and you're ready.

Testing Your Setup

Verify the integration works by triggering a test email:

  1. Go to Marketing → Communications → Email Templates
  2. Create or edit a template
  3. Click Preview Template and send a test email

Or trigger a password reset from the customer login page to test transactional emails.

Programmatic Emails

Send emails programmatically using Magento's transport builder:

Code
<?php namespace YourVendor\YourModule\Controller; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\Mail\Template\TransportBuilder; use Magento\Store\Model\StoreManagerInterface; class SendEmail extends Action { public function __construct( Context $context, private TransportBuilder $transportBuilder, private StoreManagerInterface $storeManager ) { parent::__construct($context); } public function execute() { $storeId = $this->storeManager->getStore()->getId(); $transport = $this->transportBuilder ->setTemplateIdentifier('your_email_template') ->setTemplateOptions([ 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId, ]) ->setTemplateVars([ 'customer_name' => 'John Doe', 'order_id' => '100000123', ]) ->setFromByScope('general') ->addTo('customer@example.com', 'John Doe') ->getTransport(); $transport->sendMessage(); } }

Adding Custom Headers

Add Lettermint headers for metadata and tags using a plugin:

Code
<?php namespace YourVendor\YourModule\Plugin; use Magento\Framework\Mail\TransportInterface; class TransportPlugin { public function beforeSendMessage(TransportInterface $transport) { $message = $transport->getMessage(); // Add metadata $message->getHeaders()->addHeaderLine( 'X-LM-Metadata-order_id', '100000123' ); // Add a tag $message->getHeaders()->addHeaderLine( 'X-LM-Tag', 'order-confirmation' ); // Specify a route $message->getHeaders()->addHeaderLine( 'X-Lettermint-Route', 'transactional' ); } }

Register the plugin in etc/di.xml:

XMLCode
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Framework\Mail\TransportInterface"> <plugin name="lettermint_transport_headers" type="YourVendor\YourModule\Plugin\TransportPlugin"/> </type> </config>

Metadata is included in webhook payloads but not added to the actual email headers. Use it for tracking and analytics purposes.

Keep deliverability high

Order confirmations and shipping updates only help when they reach the inbox. Verify your sending domain and publish the DNS records Lettermint provides:

  • Verify your sending domain with DKIM
  • Configure SPF so receivers trust your store's mail

Send from an address on your verified domain, such as orders@yourstore.com, rather than a generic free mailbox, so your store builds its own sending reputation.

Track delivery, opens, and bounces

To see what happens to your store's email after it leaves Magento, use Lettermint's platform features alongside the module:

  • Email tracking records opens and clicks, with bot filtering so your metrics stay accurate.
  • Webhooks push delivery, bounce, and complaint events to your systems in real time, so you can flag failed order emails or suppress bad addresses.
  • Test addresses let you trigger a hard or soft bounce on demand while you build and verify your webhook handler.

Use the X-LM-Metadata-order_id header shown above to attach the order number to each message, so every delivery or bounce event maps straight back to the order in Magento.

4. Troubleshooting

Emails Not Sending

  1. Verify Enable Lettermint Email is set to Yes
  2. Check your Project API token is correct
  3. Review logs in var/log/system.log
  4. Ensure the module is enabled: bin/magento module:status Lettermint_Email

Clear Cache After Changes

After configuration changes:

TerminalCode
bin/magento cache:clean config

FAQ

Does the module work with Magento Open Source and Adobe Commerce?

Yes. The module targets Magento 2.4 and installs on both Magento Open Source and Adobe Commerce, since both are built on the same magento/framework.

Do I need to change my email templates or code?

No. Once you enable the module and enter your API token, Magento's existing transactional emails, including order confirmations, invoices, and shipping notifications, route through Lettermint automatically. Custom code is only needed if you want to add metadata, tags, or a specific route to programmatic emails.

Is Lettermint email GDPR compliant and EU-hosted?

Yes. Lettermint runs exclusively on European infrastructure and processes email in line with GDPR, so your store's transactional mail and customer data stay inside the EU.

Can I send newsletters and transactional email through different routes?

Yes. In the module settings you can set a separate route for newsletter and marketing email (sent via Magento's Newsletter Queue) and for transactional email, so you can keep the two streams apart for analytics and deliverability.

How do I track bounces for order emails?

Enable tracking on your route and subscribe to webhooks to receive delivery and bounce events. Attach the order ID as metadata, as shown in the custom headers example, so each event maps back to the order. Use the test addresses to simulate bounces while you build your handler.

Next Steps

Tags

Organize and filter emails with tags.

Tracking

Track opens, clicks, and deliverability.

Webhooks

Receive real-time delivery notifications.

SMTP Alternative

Send via SMTP instead of the API.

GitHub Repository

Find the complete source code, report issues, or contribute on GitHub.

Last modified on July 21, 2026
LaravelWordPress
On this page
  • Requirements
  • 1. Installation
  • 2. Configuration
    • Finding the Settings
    • General Settings
    • Route Configuration (Optional)
  • 3. Sending Emails
    • Automatic Transactional Emails
    • Testing Your Setup
    • Programmatic Emails
    • Adding Custom Headers
  • Keep deliverability high
  • Track delivery, opens, and bounces
  • 4. Troubleshooting
    • Emails Not Sending
    • Clear Cache After Changes
  • FAQ
  • Next Steps
PHP
PHP