Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thinkjs/think-email
Send email module for thinkjs3
https://github.com/thinkjs/think-email
email mail thinkjs3
Last synced: about 1 month ago
JSON representation
Send email module for thinkjs3
- Host: GitHub
- URL: https://github.com/thinkjs/think-email
- Owner: thinkjs
- License: mit
- Created: 2017-07-23T09:44:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-01T00:21:52.000Z (over 3 years ago)
- Last Synced: 2024-12-06T03:14:19.945Z (about 2 months ago)
- Topics: email, mail, thinkjs3
- Language: JavaScript
- Size: 9.77 KB
- Stars: 2
- Watchers: 13
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- think-awesome - think-email
README
# think-email
# think-email
[![npm](https://img.shields.io/npm/v/think-email.svg?style=flat-square)](https://www.npmjs.com/package/think-email)Email extend for ThinkJS 3.x based on [nodemailer](https://github.com/nodemailer/nodemailer).
## Install
```
npm install think-email
```
## How to useSet the extend in `src/config/extend.js`
```js
const email = require('think-email');module.exports = [
];
```And then the `controller`, `context`, `think` will have the method `sendEmail`. For
example in `controller` you can use like this:```js
this.sendEmail(transport, options).then(info => {
console.log(info);
}, err => {
console.log(err);
});
```#### transport like:
```js
{
service: '126',
auth: {
user: '[email protected]', // your account
pass: '******' // authorization code, not the email password
}
}
```#### options like:
```js
{
from: '[email protected]', // sender address
to: '[email protected],[email protected]', // list of receivers
cc: '[email protected]', // cc list of receivers
bcc: '[email protected]', // bcc list of receivers
subject: 'this is subject', // subject line
html: 'this is HTML content ', // html content
attachments:[
{
filename : 'attachment1',
path: './package.json'
},{
filename: 'attachment2',
content: '123123'
},{
filename: 'attachment3',
path: 'http://p5.qhimg.com/t012e4e6855de50213e.jpg',
cid: '00000001'
}
]
}
```More config options, you can see at [nodemailer doc](https://nodemailer.com/about/).