@antelopejs/interface-email
v0.2.0
Published
AntelopeJS interface for sending email: single, batch and template messages with attachments
Downloads
20,087
Readme
@antelopejs/interface-email
The AntelopeJS contract for sending email: one API for single, batch and template messages, whatever provider delivers them.
Part of AntelopeJS. Used by AntelopeJS DMS, the open-source back office for your PostgreSQL, MongoDB or RethinkDB database.
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-emailThen add an implementation to the project:
ajs project modules add @antelopejs/nodemailerQuick 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