emailjs-gmail

1.0.1 • Public • Published

A wrapper for emailjs

Install

$ npm install --save emailjs-gmail

Initialize

// initialize to create the `send` function
const { send } = require('emailjs-gmail')(process.env.GMAIL_USERNAME, process.env.GMAIL_PASSWORD);

Note: Less secure app access must be enabled for the Gmail account sending mail.

Examples

Simple

  // send a message to an email (async)
  send('5555555555@txt.att.net', 'Aloha!');

Callback

  // send a message to an email (async)
  send('5555555555@txt.att.net', 'Aloha!', function myCallback(err, message) {
    console.log('message sent');
  });

Promise

  // send a message to an email (async)
  send('5555555555@txt.att.net', 'Aloha!').then(() => {
    console.log('message sent');
  });

Async/Await

(async () => {
  // send a message to an email (async)
  await send('5555555555@txt.att.net', 'Aloha!');
})(); 

Package Sidebar

Install

npm i emailjs-gmail

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

2.64 kB

Total Files

3

Last publish

Collaborators

  • zvakanaka