Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let nodemailer = require('nodemailer');
- let {google} = require('googleapis');
- const OAuth2 = google.auth.OAuth2;
- const oauth2Client = new OAuth2(
- "566999579455-g6aqvufekk2fu80c91c99s0lrfn08ce0.apps.googleusercontent.com", // ClientID
- "TeDBOaL_UisYwH2eDCXzfmIo", // Client Secret
- "https://developers.google.com/oauthplayground" // Redirect URL
- );
- oauth2Client.setCredentials({
- refresh_token: "1/T8ZdGK1NUpmV91cHe7h3EEnLCgC6VBoPv2KebDka0tQ"
- });
- async function token(){
- return await oauth2Client.getAccessToken();
- };
- const smtpTransport = nodemailer.createTransport({
- service: "gmail",
- auth: {
- type: "OAuth2",
- user: "smartcityinab@gmail.com",
- clientId: "566999579455-g6aqvufekk2fu80c91c99s0lrfn08ce0.apps.googleusercontent.com",
- clientSecret: "TeDBOaL_UisYwH2eDCXzfmIo",
- refreshToken: "1/T8ZdGK1NUpmV91cHe7h3EEnLCgC6VBoPv2KebDka0tQ",
- headers: token()
- }
- });
- const mailOptions = {
- from: 'eliasxx@gmail.com', // sender address
- to: 'elias.tardon.munoz@gmail.com', // list of receivers
- subject: 'Subject of your email', // Subject line
- html: '<p>Your html here</p>'// plain text body
- };
- module.exports ={
- smtpTransport,
- mailOptions
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement