Get the API key from the Unsend dashboard and initialize the SDK
Copy
import { Unsend } from "unsend";const unsend = new Unsend("us_12345");
If you are running a self-hosted version of Unsend, pass the base URL as the
second argument:
Copy
const unsend = new Unsend("us_12345", "https://my-unsend-instance.com");
3
Send Email
Copy
unsend.emails.send({ to: "[email protected]", from: "[email protected]", subject: "Unsend email", html: "<p>Unsend is the best open source product to send emails</p>", text: "Unsend is the best open source product to send emails",});