# email-node

> email node package

Latest version **1.0.1** (published 2017-05-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install email-node
pnpm add email-node
yarn add email-node
bun add email-node
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-05-26 |
| First published | 2017-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+16 in 1 direct dependencies) |
| Install scripts | no |
| Author | soonfy |
| Maintainers | soonfy |
| Keywords | email, node |

## Links

- npm: https://www.npmjs.com/package/email-node
- Repository: https://github.com/soonfy/soonfy_email-node
- Homepage: https://github.com/soonfy/soonfy_email-node#readme
- Issues: https://github.com/soonfy/soonfy_email-node/issues
- npm.io page: https://npm.io/package/email-node

## Dependencies (1)

- [nodemailer](https://npm.io/package/nodemailer.md) ^4.0.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-05-26
- 1.0.0 — 2017-05-26

## README

# email-node

## 配置文件

### 邮件发送人配置
> 配置在 **./config/user.json** 文件中  
文件内容格式  
  ```
  {
    "host": host,
    "auth": {
      "user": address,
      "pass": pass
    }
  }
  ```

### 邮件模板配置
> 配置在 **./config/email.json** 文件中  
文件内容格式  
  ```
  {
    "from": from,
    "to": to,
    "subject": subject,
    "html": html
  }
  ```

## API 接口
异步发送，返回Promise对象。

### send(to)

### send(to, message)

### send(to, message, template)
> template - 内置模板：info, warn, error, user  

### send(to, message, template, filepath)
> filepath - 文件路径：文件夹路径, 文件名路径  

## 示例
1. 发件人邮箱要开启 **POP3/SMTP/IMAP** 服务，一般是在 邮箱设置 功能中，并且记录下邮箱的 **服务器SMTP地址host**，以备配置发件人模板  
2. 在 **./config/user.json** 文件中配置发件人模板，**host** 和 **auth**  
3. 在 **./config/email.json** 文件中配置邮件模板，**from, to, subject, html**  
4. 发送邮件  
  ```
  const emailSender = require('email-node');
  emailSender.send(to).then(data => {
    console.log(data);
  }).catch(error => {
    console.error(error);
  })
  ```

---
_Source: https://npm.io/package/email-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
