@antelopejs/nodemailer

中文文档
0.0.8发布于 2026/11/04Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 3947

SMTP email module for AntelopeJS, implementing the Email interface with Nodemailer

原始使用文档
文档目录8 节
  1. Interfaces
  2. Install
  3. Configuration
  4. Quick start
  5. Documentation
  6. Compatibility
  7. Contributing
  8. License

@antelopejs/nodemailer

npm License Discord Documentation

The AntelopeJS Nodemailer module sends the email interface's messages over SMTP with Nodemailer.

Interfaces

InterfaceDocumentation
@antelopejs/interface-emailEmail

The module implements Send, SendBatch, SendTemplate, and GetCapabilities. It supports inline templates, attachments, replyTo, and priorities. It does not support provider-hosted templates, so SendTemplate with a template ID returns a NOT_SUPPORTED error.

Install

ajs project modules add @antelopejs/nodemailer

The module ships no default configuration. Add a config block before you start the project.

Configuration

import { defineConfig } from "@antelopejs/interface-core/config";

export default defineConfig({
  name: "my-project",
  modules: {
    nodemailer: {
      source: {
        type: "package",
        package: "@antelopejs/nodemailer",
        version: "^0.0.7",
      },
      config: {
        host: "smtp.example.com",
        port: 587,
        secure: false,
        auth: { user: "smtp-user", pass: "smtp-password" },
        defaults: { from: "[email protected]" },
      },
    },
  },
  envOverrides: {
    SMTP_PASSWORD: "modules.nodemailer.config.auth.pass",
  },
});
KeyDescription
hostSMTP host. Required unless ethereal is true.
portSMTP port, as a number. Required unless ethereal is true.
secureUse TLS from the start of the connection. Defaults to true on port 465 and false otherwise.
requireTLSRequire STARTTLS. Defaults to true when auth is set and secure resolves to false. Set to false to allow clear-text authentication.
authOptional SMTP credentials, { user, pass }. Both must be non-empty when set.
defaults.fromSender used when a message has no from.
etherealSet to true in development to send through a temporary Ethereal account instead.

With ethereal: true, the module ignores the other keys, creates an account at startup, logs its address and uses it as the default sender. Each sent message logs a preview URL where you can read it.

Quick start

In the module that sends email, add the interface:

pnpm add @antelopejs/interface-email
import { Send } from "@antelopejs/interface-email";

const result = await Send({
  to: "[email protected]",
  subject: "Welcome",
  text: "Your account is ready.",
  html: "<p>Your account is ready.</p>",
});

result.success tells you whether the SMTP server accepted the message. On a failure, result.error holds the error code and message.

Documentation

  • Email: the @antelopejs/interface-email contract this module implements.
  • Configuration: module sources, config blocks, and config variables in antelope.config.ts.

Compatibility

PackageSupportedTested with
@antelopejs/interface-core>=0.2.4 <1.0.00.2.4
@antelopejs/interface-email>=0.1.0 <0.2.00.1.0

Contributing

Use the Node.js version in .nvmrc and the pnpm version in the packageManager field of package.json:

pnpm install
pnpm dev            # run the playground/ project with an Ethereal account
pnpm lint
pnpm format:check
pnpm knip
pnpm test           # build, then ajs module test

Read the contribution guidelines before opening a pull request.

License

Apache-2.0

版本与发布记录

@antelopejs/nodemailer 共发布 7 个版本,首次发布于 2026/03/24;过去 12 个月发布了 7 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.8latest2026/11/041 天前
0.0.72026/11/024 天前
0.0.62026/10/1720 天前
0.0.52026/09/161 个月前
0.0.42026/08/212 个月前
0.0.32026/06/164 个月前

关于 @antelopejs/nodemailer 的常见问题

@antelopejs/nodemailer 是什么?

SMTP email module for AntelopeJS, implementing the Email interface with Nodemailer

如何安装 @antelopejs/nodemailer?

在项目目录运行 npm install @antelopejs/nodemailer,或使用 pnpm add / yarn add / bun add。

@antelopejs/nodemailer 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@antelopejs/nodemailer 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@antelopejs/nodemailer 可以商用吗?

@antelopejs/nodemailer 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@antelopejs/nodemailer 的下载量有多少?

根据 npm 官方下载统计,@antelopejs/nodemailer 在 2026/10/06 – 2026/11/04 这 30 天内被下载 3,947 次,日均约 132 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@antelopejs/nodemailer 还在维护吗?

最新版本 0.0.8 发布于 2026/11/04(1 天前);至今共发布 7 个版本,其中过去 12 个月发布了 7 个;首次发布于 2026/03/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。