Learn how to send an email using Vue Email and MailerSend Node.js SDK.

1. Install dependencies

Get the MailerSend Node.js SDK.

pnpm add mailersend

2. Create an email using Vue

Start by building your email template in a .vue file.

<script lang="ts" setup>
defineProps<{ url: string }>()

  <e-html lang="en">
    <e-button :href="url">
      View on GitHub

Step 3: Convert to HTML and send email

Import the email template you just built, convert into a HTML string, and use the Nodemailer SDK to send it.

// server/api/
import { EmailParams, MailerSend, Recipient, Sender } from 'mailersend'
import { useCompiler } from '#vue-email'

const mailerSend = new MailerSend({
  apiKey: process.env.MAILERSEND_API_KEY || '',

const sentFrom = new Sender('', 'Your name')
const recipients = [
  new Recipient('', 'Your Client')

export default defineEventHandler(async (event) => {
  const template = await useCompiler('welcome.vue', {
    props: {
      url: '',

  const options = new EmailParams()
    .setSubject('This is a Subject')

  return { message: 'Email sent' }