Nuxt
The official Lettermint Nuxt module adds type-safe email sending to any Nuxt app. It works in two places: a useLettermint composable for your Vue components, and a sendEmail helper plus a fluent builder for Nitro server routes. When you send from the client, the module posts to an API route it generates for you, so your Project API token stays on the server and is never exposed to the browser.
Every message is delivered through Lettermint's European infrastructure, which runs entirely inside the EU and processes mail in line with GDPR. That makes the module a good fit for transactional email from a Nuxt front end or backend, such as order confirmations, password resets, and account notifications.
Requirements
Before you start you need:
- A Nuxt 3 or Nuxt 4 project running on Node.js 18 or newer
- 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 mail reaches the inbox instead of the spam folder.
1. Installation
Add the module to nuxt.config.ts:
Code
2. Configuration
Set your Project API token in .env. The Nuxt module reads it from NUXT_LETTERMINT_API_KEY.
Code
Or configure directly in nuxt.config.ts:
Code
Never commit Project API tokens to version control. Use environment variables in production.
3. Send Your First Email
The module gives you three ways to send, so you can pick the one that fits where your code runs.
Client-Side (Composable)
Use the useLettermint composable in Vue components. The composable posts to the module's server endpoint, which holds your token, so nothing sensitive reaches the browser:
Code
Server-Side (API Routes)
Send emails from Nitro server routes:
Code
Fluent API
Build emails with a chainable API from server code:
Code
4. Email Features
HTML and Text Content
Code
Multiple Recipients
Code
Reply-To and Custom Headers
Code
Metadata
Attach data such as an order or customer ID for tracking and webhook payloads. This is what lets you map a later delivery or bounce event back to the right record in your app:
Code
Metadata is included in webhook payloads but not sent to recipients.
Tags
Categorize emails for filtering and analytics:
One tag per message. The object API uses tags array, the fluent API uses .tag() method.
See Tags documentation for more details.
Attachments
5. Custom Endpoint
By default, the module creates an endpoint at /api/lettermint/send. Disable it for custom implementations:
Code
Create your own endpoint with validation:
Code
Track delivery, opens, and bounces
Sending is only half of a transactional setup. To see what happens after a message leaves your Nuxt app, combine the module with Lettermint's platform features:
- Email tracking records opens and clicks, with bot filtering so your metrics stay accurate.
- Webhooks push delivery, bounce, and complaint events to your server in real time, so you can update order records or suppress bad addresses.
- Test addresses let you trigger a hard or soft bounce on demand while you build and verify your webhook handler.
The metadata you attach to a send is included in those webhook payloads, so an orderId or customerId maps each event straight back to the right record in your database.
FAQ
Does the module work with Nuxt 3 and Nuxt 4?
Yes. The module is built on @nuxt/kit and runs on both Nuxt 3 and Nuxt 4. The quickest way to add it is npx nuxi module add lettermint, which installs the package and registers it in nuxt.config.ts for you.
Can I send email directly from the browser?
The useLettermint composable runs in your components, but it does not talk to Lettermint directly. It posts to a server route the module generates (/api/lettermint/send), and that route holds your Project API token. Your token is never shipped to the browser. Set autoEndpoint: false if you want to build your own route with custom validation.
Is Lettermint email GDPR compliant and EU-hosted?
Yes. Lettermint runs exclusively on European infrastructure and processes email in line with GDPR, so transactional mail from your Nuxt app is handled inside the EU.
How do I track opens, clicks, and bounces from a Nuxt app?
Enable tracking on your route and subscribe to webhooks to receive delivery, open, and bounce events. 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.