Socket
Socket
Sign inDemoInstall

email-node

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    email-node

email node package


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Install size
445 kB
Created
Weekly downloads
 

Readme

Source

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 文件中配置发件人模板,hostauth
  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);
})

Keywords

FAQs

Last updated on 26 May 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc