Skip to main content
Send emails to multiple recipients using arrays for the to, cc, and bcc fields.

Multiple recipients

You can specify multiple recipients by passing an array of email addresses:
import { sendEmail } from '#imports'

export default defineEventHandler(async () => {
  const result = await sendEmail({
    from: '[email protected]',
    to: ['[email protected]', '[email protected]'],
    subject: 'Test Multiple Recipients',
    text: 'Testing multiple recipients'
  })

  return { success: true, result }
})

CC and BCC recipients

Include CC (carbon copy) and BCC (blind carbon copy) recipients:
import { sendEmail } from '#imports'

export default defineEventHandler(async () => {
  const result = await sendEmail({
    from: '[email protected]',
    to: ['[email protected]', '[email protected]'],
    cc: ['[email protected]', '[email protected]'],
    bcc: '[email protected]',
    subject: 'Test Multiple Recipients',
    text: 'Testing multiple recipients'
  })

  return { success: true, result }
})
You can use either a single email string or an array of email strings for to, cc, and bcc fields.

Reply-To configuration

Set custom reply-to addresses for your emails:
import { sendEmail } from '#imports'

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

  return { success: true, result }
})

Next steps

Attachments

Add file attachments to your emails

Tags and metadata

Organize and track emails with tags and metadata

Build docs developers (and LLMs) love