1.0.0 • Published 7 years ago

smpt-mail v1.0.0

Weekly downloads
7
License
ISC
Repository
github
Last release
7 years ago

smpt-mail

build status

Send email use smpt transport and support ejs render html

Install

npm install smpt-mail

Usage

const email  = require("smpt-mail");

const config = {
  smtpHost: 'smtp.exmail.qq.com',
  smtpUser: 'shiqiang.tang@jiukangyun.com',
  smtpPass: process.env.NODE_SMTP_PASS,
  from: 'shiqiang.tang@jiukangyun.com',
  to: ['i@tsq.me'],
  subject: 'hello world',
  htmlStr: '<p>hello <a href="https://github.com"><%=user.name%></a></p>',
  htmlContext: {
    user: {
      name: 'tsq'
    }
  }
};

email(config, (err, result) => {
   console.log(err, result);
});

Config

paramtypedescription
smtpHoststringyour smtp server host
smtpUserstringyour smtp server email address
smtpPassstringyour smtp server email password
fromstringthe e-mail address of the sender
toarraycomma separated list or an array of recipients e-mail addresses
ccarraycomma separated list or an array of recipients e-mail addresses
subjectstringemail subject
htmlStrstringemail content string that will be rendered by ejs
htmlContextobjectejs render context
1.0.0

7 years ago