Skip to content

Creating Mails ​

Basic Mail Structure ​

Every mail definition requires:

  • to - Recipient email address(es)
  • subject - Email subject line
  • One of: text, html, markdown, or render for the email body
ts
import { defineMail } from '@holo-js/mail'

const invoicePaidMail = defineMail({
  to: '[email protected]',
  subject: 'Invoice Paid',
  markdown: `# Invoice Paid\n\nYour invoice has been successfully paid.`
})

Address Formats ​

Addresses can be specified in multiple formats:

ts
const simpleRecipient = '[email protected]'
const namedRecipient = { email: '[email protected]', name: 'User Name' }
const multipleRecipients = [
  '[email protected]',
  { email: '[email protected]', name: 'User Two' },
]

CC and BCC ​

You can also specify CC and BCC recipients:

ts
{
  to: '[email protected]',
  cc: '[email protected]',
  bcc: '[email protected]',
  subject: 'Notification',
  markdown: 'Please review the attached document.'
}

From and Reply-To ​

You can override the default from and reply-to addresses:

ts
{
  to: '[email protected]',
  from: '[email protected]',
  replyTo: '[email protected]',
  subject: 'Support Request',
  markdown: 'How can we help you today?'
}

Holo owns backend runtime concerns. The host framework owns SSR and routing.