Skip to main content
Send a basic email with minimal configuration using the Nuxt Lettermint module.

Client-side example

Use the useLettermint() composable to send emails from your Vue components:
<script setup>
const { send, sending, error } = useLettermint()

await send({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Hello!',
  html: '<h1>Hello World</h1>'
})
</script>

Server-side example

Send emails directly from your server routes using the sendEmail function:
// server/api/send.post.ts
import { sendEmail } from '#imports'

export default defineEventHandler(async () => {
  try {
    const result = await sendEmail({
      from: '[email protected]',
      to: '[email protected]',
      subject: 'Test Email',
      html: '<h1>Hello from sendEmail function</h1>',
      tags: ['test']
    })

    return {
      success: true,
      result
    }
  }
  catch (error) {
    return {
      success: false,
      error: (error as Error).message
    }
  }
})
The sendEmail function is available server-side only. For client-side email sending, use the useLettermint() composable.

Response format

Both client and server methods return a response with the following structure:
{
  message_id: string
  status: 'pending' | 'sent' | 'failed'
}

Next steps

Multiple recipients

Learn how to send emails to multiple recipients with CC and BCC

Attachments

Add file attachments to your emails

Build docs developers (and LLMs) love