LettermintLettermint
  • Knowledge base
  • Community
  • Changelog
  • Support
  • Documentation
  • Sending API
  • Team API
  • MCP server
Get started
Send email
    Send with
      SDKs
      Frameworks
        LaravelSymfonyNuxtMagento 2WordPress
    SMTP
    Email activitySchedulingTest emailsTLSIdempotencySuppressionsTagsInline imagesData retentionSending limits
    Tracking
Receive email
Manage
Resources
Frameworks

Nuxt

Use the official Lettermint Nuxt module from Vue components or Nitro server routes. Client sends use a generated server route, so the Project API token stays on the server. See Integrations for other packages.

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
export default defineNuxtConfig({ modules: ['nuxt-lettermint'] })

2. Configuration

Set your Project API token in .env. The Nuxt module reads it from NUXT_LETTERMINT_API_KEY.

Code
NUXT_LETTERMINT_API_KEY=your-lettermint-project-token

Or configure directly in nuxt.config.ts:

Code
export default defineNuxtConfig({ modules: ['nuxt-lettermint'], lettermint: { apiKey: 'your-lettermint-project-token', autoEndpoint: true // Creates /api/lettermint/send (default: true) } })

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
<script setup lang="ts"> const { send, sending, error } = useLettermint() async function sendWelcomeEmail() { await send({ from: 'John Doe <john@yourdomain.com>', to: 'recipient@example.com', subject: 'Hello from Lettermint', text: 'This is a test email sent using the Lettermint Nuxt module.' }) } </script> <template> <button @click="sendWelcomeEmail" :disabled="sending"> {{ sending ? 'Sending...' : 'Send Email' }} </button> <p v-if="error">{{ error }}</p> </template>

Server-side API routes

Send emails from Nitro server routes:

Code
import { sendEmail } from '#imports' export default defineEventHandler(async () => { return await sendEmail({ from: 'John Doe <john@yourdomain.com>', to: 'recipient@example.com', subject: 'Welcome to our platform', html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>', tags: ['welcome'] }) })

Fluent API

Build emails with a chainable API from server code:

Code
import { useLettermint } from '#imports' export default defineEventHandler(async () => { const lettermint = useLettermint() return await lettermint.email .from('John Doe <john@yourdomain.com>') .to('recipient@example.com') .subject('Hello from Lettermint') .html('<h1>Hello!</h1>') .tag('welcome') .send() })

4. Email features

HTML and text content

Code
await send({ 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.' })

Multiple recipients

Code
await send({ from: 'John Doe <john@yourdomain.com>', to: ['user1@example.com', 'user2@example.com'], cc: 'manager@yourdomain.com', bcc: 'archive@yourdomain.com', subject: 'Monthly Newsletter', html: '<h1>This Month\'s Updates</h1>' })

Reply-To and custom headers

Code
await send({ from: 'support@yourdomain.com', to: 'customer@example.com', replyTo: 'help@yourdomain.com', subject: 'Support Ticket #12345', headers: { 'X-Priority': '1', 'X-Ticket-ID': '12345' }, html: '<p>Your support ticket has been updated.</p>' })

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
await send({ from: 'notifications@yourdomain.com', to: 'user@example.com', subject: 'Order Confirmation', metadata: { orderId: 'ORD-12345', customerId: 'CUST-678' }, html: '<p>Your order has been confirmed.</p>' })

Metadata is included in webhook payloads but not sent to recipients.

Tags

Categorize emails for filtering and analytics:

These SDK examples use the existing singular tag. It has no deprecation date. Use the raw HTTP API to send structured tags until this SDK has a multi-tag method. See Tags documentation.

Attachments

5. Custom endpoint

By default, the module creates an endpoint at /api/lettermint/send. Disable it for custom implementations:

Code
export default defineNuxtConfig({ modules: ['nuxt-lettermint'], lettermint: { autoEndpoint: false } })

Create your own endpoint with validation:

Code
import { sendEmail } from '#imports' export default defineEventHandler(async (event) => { const body = await readBody(event) // Add your validation logic if (!body.email || !body.message) { throw createError({ statusCode: 400, message: 'Missing required fields' }) } return await sendEmail({ from: 'contact@yourdomain.com', to: 'support@yourdomain.com', subject: `Contact form: ${body.subject}`, html: `<p>From: ${body.email}</p><p>${body.message}</p>`, tags: ['contact-form'] }) })

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 delivery events through webhooks.

SMTP Alternative

Send via SMTP instead of the API.

GitHub Repository

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

SymfonyMagento 2
On this page
  • Requirements
  • 1. Installation
  • 2. Configuration
  • 3. Send your first email
    • Client-side composable
    • Server-side API routes
    • Fluent API
  • 4. Email features
    • HTML and text content
    • Multiple recipients
    • Reply-To and custom headers
    • Metadata
    • Tags
    • Attachments
  • 5. Custom endpoint
  • Track delivery, opens, and bounces
  • FAQ
  • Next steps
npx nuxi module add lettermint
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript
await send({ from: 'alerts@yourdomain.com', to: 'admin@example.com', subject: 'System Alert', tags: ['system-alerts'], html: '<p>Critical system alert detected.</p>' })
<script setup lang="ts"> const { send } = useLettermint() async function sendWithAttachment(file: File) { const reader = new FileReader() reader.onload = async () => { const base64 = reader.result?.toString().split(',')[1] await send({ from: 'invoices@yourdomain.com', to: 'customer@example.com', subject: 'Your Invoice', html: '<p>Please find your invoice attached.</p>', attachments: [{ filename: file.name, content: base64 }] }) } reader.readAsDataURL(file) } </script>
TypeScript
TypeScript