@lucidcms/plugin-nodemailer
v1.1.4
Published
The official Nodemailer plugin for Lucid CMS
Maintainers
Readme
Lucid CMS - Nodemailer Plugin
The official Nodemailer plugin for Lucid
The Lucid CMS Nodemailer plugin registers the email strategy config and uses Nodemailer to send emails. This plugin is ideal if you want to use your own SMTP server or email service provider that's compatible with Nodemailer.
Installation
npm install @lucidcms/plugin-nodemailerSetup
To use the Nodemailer plugin, you need to add it to your Lucid CMS config file. You'll need to provide the from email configuration and a Nodemailer transporter instance.
import { configureLucid } from "@lucidcms/core";
import { node } from "@lucidcms/runtime-node";
import { nodemailerPlugin } from "@lucidcms/plugin-nodemailer";
import { sqlite } from "@lucidcms/db-sqlite";
export default configureLucid({
runtime: node,
db: sqlite,
config: () => ({
plugins: [
nodemailerPlugin({
transporter,
}),
],
}),
});Configuration
This plugin offers the following configuration options to control email sending behavior.
| Property | Type | Description |
|----------|------|-------------|
| transporter | Transporter | A configured Nodemailer transporter instance |
| remoteAttachments | { maxBytes?: number; timeoutMs?: number } | Optional remote attachment handling config |
transporter
This should be a configured Nodemailer transporter instance. You can create this using any of the transport methods supported by Nodemailer, such as SMTP, Gmail, or other email service providers.
remoteAttachments
When an email includes URL-based attachments, this plugin fetches those remote files itself, checks the resolved addresses and redirects, enforces timeout and size limits, and passes the downloaded bytes to Nodemailer as content.
You can configure the maximum remote attachment size and request timeout:
LucidNodemailer({
transporter,
remoteAttachments: {
maxBytes: 10 * 1024 * 1024,
timeoutMs: 15_000,
},
});maxBytes defaults to 10 * 1024 * 1024 and timeoutMs defaults to 15_000.
