# @antelopejs/nodemailer 中文文档

规范地址：https://npmcn.com/package/%40antelopejs/nodemailer/

版本：0\.0\.8
npm 元数据更新时间：2026-11-04T15:45:20.414Z
中文译文更新时间：2026-11-06T08:12:25.120Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40antelopejs/nodemailer
原文对照：https://npmcn.com/package/%40antelopejs/nodemailer/?lang=original
项目主页：https://github.com/AntelopeJS/interface-email/tree/main/docs
源码仓库：https://github.com/AntelopeJS/nodemailer

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：213 kB，99 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- 运行依赖：3 个
- 首次发布：2026-03-23T19:29:13.198Z
- 最新版本发布：2026-11-04T15:45:20.045Z
- 近 30 天下载量：3947（2026-10-06 至 2026-11-04，npm 官方下载统计）
- 已发布版本数：7（近 12 个月 7 个）

## 中文简介

AntelopeJS 的 SMTP 电子邮件模块, 执行与节点邮件器的电子邮件接口

## 安装

```sh
npm install @antelopejs/nodemailer
```

也可以使用：`pnpm add @antelopejs/nodemailer`、`yarn add @antelopejs/nodemailer`、`bun add @antelopejs/nodemailer`

## README

# `@antelopejs/nodemailer`

[![npm](https://img.shields.io/npm/v/@antelopejs/nodemailer?style=for-the-badge&labelColor=000000&color=000000)](https://www.npmjs.com/package/@antelopejs/nodemailer) [![License](https://img.shields.io/npm/l/@antelopejs/nodemailer?style=for-the-badge&labelColor=000000&color=000000)](https://npmcn.com/package/%40antelopejs/nodemailer/LICENSE) [![Discord](https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000)](https://discord.gg/g4pFt6eXqu) [![Documentation](https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000)](https://github.com/AntelopeJS/interface-email/tree/main/docs)

羚羊JS节点邮件模块通过SMTP发送电子邮件界面的信息 [节点](https://nodemailer.com/)。 。 。 .

## 接口

| 接口 | 文档 |
| --- | --- |
| [`@antelopejs/interface-email`](https://github.com/AntelopeJS/interface-email) | [电子邮件](https://github.com/AntelopeJS/interface-email/tree/main/docs) |

模块执行 `Send`, (中文(简体) ), `SendBatch`, (中文(简体) ), `SendTemplate`,以及 `GetCapabilities`它支持内置模板、附件, `replyTo`以及优先事项。 它不支持提供者托管的模板,所以 `SendTemplate` 带有模板 ID 返回 a `NOT_SUPPORTED` 错误.

## 安装

```bash
ajs project modules add @antelopejs/nodemailer
```

模块没有默认配置 。 添加一个 `config` 在项目开始前设置块.

## 配置

```typescript
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: "noreply@example.com" },
      },
    },
  },
  envOverrides: {
    SMTP_PASSWORD: "modules.nodemailer.config.auth.pass",
  },
});
```

| 密钥 | 说明 |
| --- | --- |
| `host` | SMTP主机. 要求,除非 `ethereal` 实值 `true`。 。 。 . |
| `port` | SMTP端口,作为数字. 要求,除非 `ethereal` 实值 `true`。 。 。 . |
| `secure` | 从连接开始使用 TLS 。 默认为 `true` 第465和465号港口 `false` 否则. |
| `requireTLS` | 需要STARTLS系统. 默认为 `true` 何时 `auth` 设置和 `secure` 决定: `false`设置为 `false` 以允许清晰文本认证. |
| `auth` | 可选 SMTP 证书, `{ user, pass }`。两者在设定时都必须是非空的. |
| `defaults.from` | 当信件没有时使用发送器 `from`。 。 。 . |
| `ethereal` | 设定为 `true` 开发中发送临时 [爱丽丝](https://ethereal.email/) 账户. |

与 `ethereal: true`,模块忽略了其他密钥,在启动时创建一个账户,登录其地址并将其作为默认发送者. 每个发送的信件都会在您可以读取的地方登录一个预览 URL.

## 快开始

在发送电子邮件的模块中,添加接口:

```bash
pnpm add @antelopejs/interface-email
```

```typescript
import { Send } from "@antelopejs/interface-email";

const result = await Send({
  to: "user@example.com",
  subject: "Welcome",
  text: "Your account is ready.",
  html: "<p>Your account is ready.</p>",
});
```

`result.success` 告诉您 SMTP 服务器是否接受信件 。 如果失败了, `result.error` 保存错误代码和消息.

## 文档

-   [电子邮件](https://github.com/AntelopeJS/interface-email/tree/main/docs)页:1 `@antelopejs/interface-email` 与本模块设备订约.
-   [配置](https://framework.antelopejs.com/docs/concepts/configuration): 模块来源, `config` 区块和配置变量 `antelope.config.ts`。 。 。 .

## 兼容性

| 软件包 | 支助 | 测试过 |
| --- | --- | --- |
| `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` | `0.2.4` |
| `@antelopejs/interface-email` | `>=0.1.0 <0.2.0` | `0.1.0` |

## 捐款

使用节点版本 `.nvmrc` 和 pnpm 版本在 `packageManager` 领域 `package.json`数字 :

```bash
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
```

读取 [捐款准则](https://npmcn.com/package/%40antelopejs/nodemailer/CONTRIBUTING.md) 在打开拉出请求之前.

## 许可证

[阿帕奇 - 2.0](https://npmcn.com/package/%40antelopejs/nodemailer/LICENSE)

## 常见问题

### @antelopejs/nodemailer 是什么？

AntelopeJS 的 SMTP 电子邮件模块, 执行与节点邮件器的电子邮件接口

### 如何安装 @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 和提交记录判断。

