emailjs-gmail
v1.0.1
Published
Send mail from a gmail account
Maintainers
Readme
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('[email protected]', 'Aloha!');Callback
// send a message to an email (async)
send('[email protected]', 'Aloha!', function myCallback(err, message) {
console.log('message sent');
});Promise
// send a message to an email (async)
send('[email protected]', 'Aloha!').then(() => {
console.log('message sent');
});Async/Await
(async () => {
// send a message to an email (async)
await send('[email protected]', 'Aloha!');
})(); 