think-mailer
Thinkjs mailer adapter
Development based on nodemailer
Install
yarn add think-mailer --save#npm install think-mailer --save #cnpm install think-mailer --save
Config
ThinkJSProjectRoot/src/config/adapter.js
exportsmailer = type: 'mailer' mailer: host: 'smtp.xxx.com' port: 465 secure: true auth: user: 'xxx@xxx.com' // your account pass: 'JfoBrEMBYkzhvzRB' // authorization code, not the email password tls: rejectUnauthorized: false ;
ThinkJSProjectRoot/src/config/extend.js
const view = ;const cache = ;const session = ;const mongo = ;const email = ; moduleexports = view cache session ;
Send Mail
ThinkJSProjectRoot/src/controller/xxx.js
const Base = ; moduleexports = { const ctx = this const mailer = ctx return mailer };