openmail-sdk
v1.1.0
Published
Official OpenMail Node.js SDK (TypeScript)
Maintainers
Readme
OpenMail Node SDK (TypeScript)
Official TypeScript SDK for OpenMail.
Install
npm install openmail-sdkQuick Start
import { OpenMailClient } from "openmail-sdk";
const client = new OpenMailClient({
apiKey: "your_api_key",
tokenUrl: "https://openmail.openproject.co.zw/r/your_token"
});
const response = await client.sendEmail({
toEmail: "[email protected]",
subject: "Hello from OpenMail",
type: "html",
body: "<h1>Hello</h1><p>Welcome.</p>"
});
console.log(response);Bulk Emails
You can send bulk emails in a single request. The SDK normalizes inputs (supporting either to or toEmail, and body or html/text structures).
const emails = [
{
toEmail: "[email protected]",
subject: "Hello User 1",
html: "<h1>Welcome</h1><p>This is HTML content.</p>"
},
{
to: "[email protected]",
subject: "Hello User 2",
text: "This is plain text content."
}
];
// Can be an array of emails, or an object structured as { emails: [...] }
const response = await client.sendBulkEmails(emails);
console.log(response);API
new OpenMailClient({ apiKey, tokenUrl, timeoutMs? })sendEmail({ toEmail, subject, type, body, metadata? })sendBulkEmails(emails)health()
