https://github.com/wk989898/mail
send and receive mail
https://github.com/wk989898/mail
email imap mail-client node smtp
Last synced: 30 days ago
JSON representation
send and receive mail
- Host: GitHub
- URL: https://github.com/wk989898/mail
- Owner: wk989898
- License: mit
- Created: 2020-05-24T04:27:37.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-05-01T04:16:31.000Z (about 4 years ago)
- Last Synced: 2025-10-30T01:39:22.324Z (8 months ago)
- Topics: email, imap, mail-client, node, smtp
- Language: JavaScript
- Size: 130 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# node-mail-client
[](https://travis-ci.com/wk989898/mail)

## Intro
An email client for receiving and sending emails
Based IMAP and SMTP
## Installation
``` js
npm install node-mail-client
```
## Usage
```js
// checkAuth will be called automatically and it will check email account authenticity
const mailClient=require('node-mail-client')
let mail=new mailClient({
user:`*@gmail.com`, // your address
pass:`***`, // your password
imap:['imap.*.com',993], // [host,port,tls]
smtp:['smtp.*.com',587], // [host,port,secure]
name:'Jack' // your name when send
})
// receive
mail.receive(null).then(result=>{
// do something
}).catch(err=>{
console.log(err)
})
// send
mail.send({ to, subject, text, html }).then(info=>{})
.catch(console.error)
// skip checkAuth check
mail.check=1 // 0: init 1:pass 2:fail
```
## API
```js
receive:
//@param: {string | (total:number)=>string | null} setNum
//string alike '1:10' or '1:*'
//'total' is the total number of box messages
receive('1:*').then()
receive(total=>`1:${total-10}`).then()
receive(null).then()
send:
/*
* @param:Object
* {
* to: "any@163.com", // list of receivers
* subject: "Hello", // Subject line
* text: "Hello world? text", // plain text body
* html: "Hello world?", // html body
* }
*/
```
### Here is an [example](./example/main.js)
## Documention
you could find specify about API
[send](https://nodemailer.com/about/)
[receive](https://github.com/mscdex/node-imap)
## Credits
[node-imap](https://github.com/mscdex/node-imap)
[Nodemailer](https://github.com/nodemailer/nodemailer)