Node.js
Introduction
Learn how to send your first email using the Dhesend Node.js SDK.
Prerequisites
To get the most out of this guide, you’ll need to:
2. Send email
Quickly send an email by using the html parameter.
1import Dhesend from 'dhesend';
2
3const dhesend = new Dhesend('dhe_fdd03c4eb1'); // Replace with your actual API key
4
5(async function () {
6 const { data, error } = await dhesend.emails.send({
7 from: "Dhesend <example@domain.com>",
8 to: ['example@dhesend.com'],
9 subject: 'Welcome to Dhesend',
10 htmlBody: '<strong>Have a nice day!</strong>',
11 });
12
13 if (error) {
14 console.error('Failed to send email:', error);
15 };
16
17 console.log('Email sent successfully:', data);
18})();On this page