@kznjunk/paperboy-gmail
v1.0.2
Published
Send emails a bit more easier
Downloads
3
Readme
Paperboy Gmail
How?
require('dotenv').config()
const gmailConfig = {
clientId: process.env.clientId,
clientSecret: process.env.clientSecret,
refreshToken: process.env.refreshToken
}
const { sendGmail } = require('@kznjunk/paperboy-email')(gmailConfig)
const fromEmail = '[email protected]'
const toEmail = '[email protected]'
const title = 'Hello..'
const body = '..there!'
const res = await sendGmail(fromEmail, toEmail, title, body)
console.log(res)
// {
// accepted: [ '[email protected]' ],
// rejected: [],
// envelopeTime: 192,
// messageTime: 470,
// messageSize: 352,
// response: '250 2.0.0 OK 16164...29 - gsmtp',
// envelope: { from: '[email protected]', to: [ '[email protected]' ] },
// messageId: '<[email protected]>'
// }
Note
- The config should be available over there: https://console.cloud.google.com/apis/credentials/oauthclient/{{appId}}?project={{projectName}}
- URI is
https://developers.google.com/oauthplayground
- About the refresh token: https://developers.google.com/oauthplayground/ (cf. https://stackoverflow.com/questions/24098461/nodemailer-gmail-what-exactly-is-a-refresh-token-and-how-do-i-get-one)