Git Product home page Git Product logo

mail-bot's Introduction

Mail-bot

Usage

import mailer from '../../server/core/mailer';

Init

mailer.init({

	sender: 'Test Bot <[email protected]>',
	driver: 'gmail',
	interval: 2000,
	attachLimit: {

		txt: 1000,
		jpeg: 20000000

	}

});

Possible options values:

  • sender (Required) String - set field 'from' for sended emails
  • driver (Required) String - name of email driver
  • interval (Required) String - set interval time for sync with email service for parse list of mails
  • attachLimit (Required) Object - set allowed types and their max size

Start server

Start server and watch for new emails.

let timerId = mailer.start();

Stop server

Stop server and unwatch for new emails.

mailer.stop(timerId);

Listen for new messages

mailer.on('message', (mail) => {

	console.log(mail);

});

Send email

mailer.send(
  {
    subject: 'some subject',
    message: 'some message',
    to: ['[email protected]'],
    attachments:
    [{

        name: 'picture.jpeg',
        attach: 'https://static.pexels.com/photos/96918/pexels-photo-96918.jpeg',
        type: 'url'
        
    }],
    date: Date.now()

	});

Possible options values:

  • subject (Required) String - email subject
  • message (Required) String - email message
  • to (Required) String or Array - email recipient or list of recipients
  • attachments (Optional) Array - email attachments
  • date (Required) Date(UTC) - date for delayed sending email
  • sender (Optional) String - update field 'from' for sended emails

sendMailAfter

Add your count to type that you want to set.

date: mailer.setSendedData({ seconds: dateNow.getSeconds() + 7 })

Possible param values:

  • year
  • month
  • date
  • hours
  • minutes
  • seconds

mail-bot's People

Watchers

James Cloos avatar Pavel Naumenko 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.