Advertisement
Guest User

Untitled

a guest
Apr 11th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. const nodemailer = require('nodemailer');
  2. const xoauth2 = require('xoauth2');
  3. var express = require('express');
  4.  
  5.  
  6. var smtpTransport = nodemailer.createTransport({
  7. service:"Gmail",
  8. host: 'smtp.gmail.com',
  9. auth:{
  10. XOAuth2: {
  11. user:'strictusdev@gmail.com',
  12. clientId: '127714859906-enpor8c7v4shq8khd8daa4uit44jdpgi.apps.googleusercontent.com',
  13. clientSecret: 'aFzrdnpv9NDFsJDhc9fddN2C',
  14. access_token: "ya29.GluaBdwouirfAJZldzWtILf012qxwOI1XBaiyssu6RKx9zYx_7v3PRuaPetP4KBjbTzSi5uIbxINERYSu02gTl-CVscdbEFqZUsHRxm4Qy6ig12QMqL4XKpULPTg",
  15. // "token_type": "Bearer",
  16. // "expires_in": 3600,
  17. refresh_token: "1/ztehZKQZYvxKjlOu5UMep_U2VTCxyQyppbf9sWmmJC4"
  18.  
  19.  
  20. }
  21. }
  22. });
  23. var mailOptions = {
  24. from: 'strictusdev@gmail.com',
  25. to: 'strictusdev@gmail.com',
  26. subject: "Hello",
  27. generateTextFromHTML: true,
  28. html: "<b>Hello world</b>"
  29. };
  30.  
  31. smtpTransport.sendMail(mailOptions, function(error, response) {
  32. if (error) {
  33. console.log(error);
  34. } else {
  35. console.log(response);
  36. }
  37. smtpTransport.close();
  38. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement