Coder Social home page Coder Social logo

mail's Introduction

node-mail-client

Build Status npm

Intro

a email client to receive and send mail
base IMAP and SMTP

Installation

npm install node-mail-client

Usage

// these methods all returned promise
// checkAuth will auto invoke and it will check smtp auth
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)

// pass checkAuth check
mail.check=1  // 0: init  1:pass  2:fail
// send or receive

API

receive:
//@param: {string | (total:number)=>string | null} setNum
//string alike '1:10' or '1:*' 
//total is box messages total  
receive('1:*').then()
receive(total=>`1:${total-10}`).then()
receive(null).then()

send:
/*
* @param:Object
*  {
*     to: "[email protected]", // list of receivers
*     subject: "Hello", // Subject line
*     text: "Hello world? text", // plain text body
*     html: "<b>Hello world?</b>", // html body
*  }
*/

Here is an example

Documention

you could find specify about API
send
receive

Credits

node-imap
Nodemailer

mail's People

Contributors

wk989898 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.