Send Email
Start sending emails through the Dhesend Email API.
import Dhesend from 'dhesend';
const dhesend = new Dhesend('dhe_fdd03c4eb1'); // Replace with your actual API key
(async function () {
const { data, error } = await dhesend.emails.send({
from: "Dhesend <example@domain.com>",
to: ['example@dhesend.com'],
subject: 'Welcome to Dhesend',
htmlBody: '<strong>Have a nice day!</strong>',
});
if (error) {
console.error('Failed to send email:', error);
};
console.log('Email sent successfully:', data);
})();{
"id": "759cd214-98db-40c1-9df4-66d818a51c3a"
}Body parameters
Sender email address. To include a friendly name, use the formatYour Name <sender@domain.com>
Recipient email address. Send as an array of strings. Max 50.
Email subject.
bccarray
Bcc recipient email address. Send as an array of strings.
ccarray
Cc recipient email address. Send as an array of strings.
reply_toarray
Reply-to email address. Send as an array of strings.
text_bodystring
The plain text version of the message.
html_bodystring
The HTML version of the message.
attachmentsarray
Email attachments are limited to a maximum of25 MB per email.You can attach JavaScript File-like objects or use the list format provided below.
Hide properties
urlstring
Url of the attachment
filenamestring
The file name for the attachment. If not provided, it will be derived from the "url" property.
content_typestring
The content type for the attachment. If not provided, it will be derived from the "url".
tagsarray
Custom data passed in key/value pairs.
Hide properties
Name of the email tag.
Must contain only ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-).
Length must not exceed 256 characters.`
Value of the email tag.
Must contain only ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-).
Length must not exceed 256 characters.`