@antelopejs/interface-email
The AntelopeJS contract for sending email: one API for single, batch and template messages, whatever provider delivers them.
What it offers
Sendsends one message with text or HTML, recipients, threading headers and attachments.SendBatchsends several messages in one call, with shared defaults.SendTemplaterenders a provider template or an inline template with variables.GetCapabilitiesreports what the provider supports, such as scheduling or tracking.SendandSendTemplatereturn a status, an optional provider message ID, and optional error details.SendBatchreturns totals and one result per message.GetCapabilitiesreturns provider features and limits, not delivery results.
Implementations
| Module | Notes |
|---|---|
@antelopejs/nodemailer | SMTP through Nodemailer |
@antelopejs/brevo | Brevo HTTP API |
Install
Add the interface to the module that sends email:
pnpm add @antelopejs/interface-email
Then add an implementation to the project:
ajs project modules add @antelopejs/nodemailer
Quick start
import { Send } from "@antelopejs/interface-email";
export async function sendWelcome(address: string) {
const response = await Send({
to: address,
subject: "Welcome aboard",
html: "<p>Thanks for joining.</p>",
text: "Thanks for joining.",
});
if (!response.success) {
throw new Error(response.error?.message);
}
return response.messageId;
}
Documentation
Compatibility
| Package | Supported | Tested with |
|---|---|---|
@antelopejs/interface-core | >=0.2.4 <1.0.0 | 0.2.4 |
The table repeats the peer range in package.json. The package declares no
@antelopejs/core peer range, so check the requirements of the implementing module too.
Contributing
Read CONTRIBUTING.md before you open a pull request. The local checks are:
pnpm install
pnpm lint
pnpm build