Skip to main content
Before continuing, make sure you’ve completed the SDK setup and requirements.

Overview

This guide walks you through how to send a transactional email using the Nuntly TypeScript SDK.

Send a HTML email

const { data, error } = await nuntly.emails.send({
  from: '[email protected]',
  subject: 'Verify Your Email Address',
  to: '[email protected]',
  html: `
    <h1>Welcome 🎉</h1>
    <p>Thank you for signing up! Please verify your email address..</p>`,
});

if (error) {
  return console.error('Error sending email:', error);
}
console.log(`Email sent ${data.id} 🎉`);

Send a Text email

const { data, error } = await nuntly.emails.send({
  from: '[email protected]',
  subject: 'Verify Your Email Address',
  to: '[email protected]',
  text: 'Thank you for signing up! Please verify your email address.',
});

if (error) {
  return console.error('Error sending email:', error);
}
console.log(`Email sent ${data.id} 🎉`);

Send both HTML and Text

const { data, error } = await nuntly.emails.send({
  from: '[email protected]',
  subject: 'Verify Your Email Address',
  to: '[email protected]',
  html: `
    <h1>Welcome 🎉</h1>
    <p>Thank you for signing up! Please verify your email address...</p>
  `,
  text: 'Thank you for signing up! Please verify your email address...',
});

if (error) {
  return console.error('Error sending email:', error);
}
console.log(`Email sent ${data.id} 🎉`);