Advertisement
Guest User

Untitled

a guest
Feb 10th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. var request = require('request');
  2. const nodemailer = require('nodemailer');
  3.  
  4.  
  5. request('https://temp-mail.org/fr/', function (error, response, body) {
  6. if (!error && response.statusCode == 200) {
  7. // Show the HTML for the Google homepage.
  8. var body = body.replace(/ /gm, '')
  9. var index = body.indexOf('value')
  10.  
  11. body = body.substr(index)
  12. index = body.indexOf('"')
  13. body = body.substr(index+1)
  14. index = body.indexOf('"')
  15. destinataire = body.substr(0, index)
  16. console.log(body)
  17.  
  18. let transporter = nodemailer.createTransport({
  19. service: 'gmail',
  20. auth: {
  21. user: 'crannser69@gmail.com',
  22. pass: 'marcrosspolpol'
  23. }
  24. });
  25.  
  26. // setup email data with unicode symbols
  27. let mailOptions = {
  28. from: 'hello worl', // sender address
  29. to: destinataire, // list of receivers
  30. subject: 'hello ', // Subject line
  31. text: 'hello world ?', // plain text body
  32. html: '<b>hello world ?</b>' // html body
  33. };
  34.  
  35. // send mail with defined transport object
  36. transporter.sendMail(mailOptions, (error, info) => {
  37. if (error) {
  38. return console.log(error);
  39. }
  40. console.log('Message %s sent: %s', info.messageId, info.response);
  41.  
  42. request('https://temp-mail.org/fr/', function (error, response, mailBody) {
  43. if (!error && response.statusCode == 200) {
  44.  
  45. var baseBody = mailBody;
  46.  
  47. // Show the HTML for the Google homepage.
  48. var mailBody = mailBody.replace(/ /gm, '')
  49.  
  50. index = mailBody.indexOf('value')
  51.  
  52. mailBody = mailBody.substr(index)
  53. index = mailBody.indexOf('"')
  54. mailBody = mailBody.substr(index+1)
  55. index = mailBody.indexOf('"')
  56. mailBody = mailBody.substr(0, index)
  57. console.log(mailBody)
  58.  
  59.  
  60. console.log('finie')
  61. var baseBody = baseBody.replace(/ /gm, '')
  62.  
  63.  
  64. index = baseBody.indexOf('hello')
  65.  
  66. baseBody = baseBody.substr(index)
  67. index = baseBody.indexOf('world')
  68. baseBody = baseBody.substr(0, index)
  69. console.log(baseBody)
  70. }
  71. });
  72. });
  73. }
  74. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement