Sending custom HTML emails
You can send custom HTML emails via the Sidemail API. To send HTML emails you'll need to specify the html
parameter.
- You can use all UTF-8 characters inside inside the
html
parameter. - An email open tracking pixel is automatically inserted at the end of the email
<body>
. You can disable open tracking by setting parameterisOpenTracked
tofalse
.
Example
const configureSidemail = require("sidemail");
const sidemail = configureSidemail({ apiKey: "replace-with-your-api-key" });
const response = await sidemail.sendEmail({
toAddress: "user@example.com",
fromAddress: "you@example.com",
fromName: "Your app",
subject: "Testing HTML only custom emails :)",
html: "<html><body><h1>Hello world! 🖐</h1><body></html>",
});
You can also send custom email with both the HTML and plain-text version.
Here's an example:
const configureSidemail = require("sidemail");
const sidemail = configureSidemail({ apiKey: "replace-with-your-api-key" });
const response = await sidemail.sendEmail({
toAddress: "user@example.com",
fromAddress: "you@example.com",
fromName: "Your app",
subject: "Testing HTML and plain-text custom emails :)",
html: "<html><body><h1>Hello world! 🖐</h1><body></html>",
text: "Hello world! 🖐",
});