Installation
Add the Mailing module and an e-mail provider to an AntelopeJS DMS project.
The Mailing module runs inside a project that loads @antelopejs/dms, a database module and a module that implements @antelopejs/interface-email.
Requirements
The compatibility block of the module README lists the @antelopejs/* ranges each Mailing release supports. The project needs:
- A DMS backend in a release that implements the
@antelopejs/interface-dmsrange of that block. - The
@antelopejs/dms-frontendrenderer in the range ofengines["@antelopejs/dms-frontend"]infrontend-vue/package.json. Theajs dmsCLI refuses to build the module with a renderer outside that range. - A database module that enforces unique indexes, such as
@antelopejs/mongodbor@antelopejs/postgres. The template slug is a unique index. - An
@antelopejs/interface-emailimplementation, in the range of that block.
If your DMS backend is older than the range the compatibility block lists, stay on the Mailing release that supports it until you upgrade the backend, the interface and the renderer together. See DMS installation for the toolchain, and Troubleshooting for dependency and frontend integration errors.
Add it to a project
Add the module
ajs project modules add @antelopejs/dms-mailing
Add an e-mail provider
The module hands every e-mail to the project's @antelopejs/interface-email implementation. To use nodemailer, add it:
ajs project modules add @antelopejs/nodemailer
Then configure both modules in antelope.config.ts:
import { defineConfig } from "@antelopejs/interface-core/config";
export default defineConfig({
name: "my-project",
modules: {
"dms-mailing": {
source: { type: "package", package: "@antelopejs/dms-mailing", version: "^0.11.0" },
config: {},
},
nodemailer: {
source: { type: "package", package: "@antelopejs/nodemailer", version: ">=0.0.6 <1.0.0" },
config: {
host: "smtp.example.com",
port: 587,
auth: { user: "apikey", pass: process.env.SMTP_PASSWORD },
defaults: { from: "[email protected]" },
},
},
// dms, api, mongodb, auth-jwt, file-storage-local, ...
},
});
In development, use config: { ethereal: true } to send to a throwaway Ethereal inbox.
With ethereal: true, @antelopejs/nodemailer creates its Ethereal account over the internet while the project starts. Offline, that request fails and nodemailer's construct() throws. AntelopeJS then stops the whole project before Mailing runs, so Mailing cannot step in. To work offline, point nodemailer at a local SMTP server instead, such as Mailpit, MailHog or the playground's SMTP_PORT, with { host: "127.0.0.1", port: 1025, secure: false }.
Set the public origin
The webhook URL and the logo in e-mails use the DMS clientBaseUrl, the public origin of the dashboard. Set it in the dms module's config before a real provider has to reach the webhook.
Open the module
Restart the backend and the frontend. The module appears under Modules › Mailing, at /modules/mailing/overview. Until a provider is connected and a template is published, the overview shows a setup checklist instead of its figures.
The pages render on the server. The overview's figures, the template gallery and the settings arrive with the page. Drawers, dialogs, the editor and the preview frames read their data when they open.
Create your first template from a starter. Order confirmation, Shipping update, Password reset and Invoice available come with English and French content, declared variables and test data.
Try it in the playground
Run these commands from the repository root:
pnpm install
pnpm --dir packages/interface-dms-mailing build
cd packages/dms-mailing
pnpm --dir playground install --ignore-workspace
pnpm dev # backend on http://localhost:5010
pnpm frontend:dev # dashboard on http://localhost:3001, in a second terminal
The playground uses MongoDB at mongodb://localhost:27017 (set MONGO_URL to change it). It sends to Ethereal, or to a local SMTP server when SMTP_PORT is set.