1.0.0 • Published 9 years ago
smpt-mail v1.0.0
smpt-mail
Send email use smpt transport and support ejs render html
Install
npm install smpt-mailUsage
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
| param | type | description |
|---|---|---|
| smtpHost | string | your smtp server host |
| smtpUser | string | your smtp server email address |
| smtpPass | string | your smtp server email password |
| from | string | the e-mail address of the sender |
| to | array | comma separated list or an array of recipients e-mail addresses |
| cc | array | comma separated list or an array of recipients e-mail addresses |
| subject | string | email subject |
| htmlStr | string | email content string that will be rendered by ejs |
| htmlContext | object | ejs render context |
1.0.0
9 years ago