Guest User

Untitled

a guest
Dec 11th, 2017
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. D:Full StackNodeNodeLoginJWTfunctionspassword.js:58
  2. 'This token is valid only within two minutes.'
  3. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4. SyntaxError: Unexpected string
  5. at createScript (vm.js:56:10)
  6. at Object.runInThisContext (vm.js:97:10)
  7. at Module._compile (module.js:542:28)
  8. at Object.Module._extensions..js (module.js:579:10)
  9. at Module.load (module.js:487:32)
  10. at tryModuleLoad (module.js:446:12)
  11. at Function.Module._load (module.js:438:3)
  12. at Module.require (module.js:497:17)
  13. at require (internal/module.js:20:19)
  14. at Object.<anonymous> (D:Full StackNodeNodeLoginJWTroutes.js:9:18)
  15. at Module._compile (module.js:570:32)
  16. at Object.Module._extensions..js (module.js:579:10)
  17. at Module.load (module.js:487:32)
  18. at tryModuleLoad (module.js:446:12)
  19. at Function.Module._load (module.js:438:3)
  20. at Module.require (module.js:497:17)
  21. [nodemon] app crashed - waiting for file changes before starting...
  22.  
  23. const transporter = nodeMailer.createTransport(`smtps://${config.email}:${config.password}@smtp.gmail.com`);
  24.  
  25. const mailOptions = {
  26. from: `"${conifg.name}" <${config.email}>`,
  27. to: email,
  28. subject: 'Reset Password',
  29. html: `Hello ${user.name}`,
  30.  
  31. 'Your account password token is ${random}'
  32. 'This token is valid only within two minutes.'
  33.  
  34. 'Thanks,'
  35. 'Team. '
  36. };
  37.  
  38. return transporter.sendMail(mailOptions);
  39.  
  40. const mailOptions = {
  41. from: `"${conifg.name}" <${config.email}>`,
  42. to: email,
  43. subject: 'Reset Password',
  44. html: `Hello ${user.name}, // the tick should not come here
  45.  
  46. 'Your account password token is ${random}'
  47. 'This token is valid only within two minutes.'
  48.  
  49. 'Thanks,'
  50. 'Team. '` // the tick should come here
  51. };
  52.  
  53. var express = require('express');
  54. var router = express.Router();
  55. var nodemailer = require('nodemailer');
  56.  
  57. router.post('/', handleSendEmail); // handle the route at yourdomain.com/sayHello
  58.  
  59. function handleSendEmail(req, res) {
  60. // Not the movie transporter!
  61. var transporter = nodemailer.createTransport({
  62. service: 'Gmail',
  63. auth: {
  64. user: '', // Your email id
  65. pass: ‘’// Your password
  66. }
  67. });
  68. var text = 'Hello from nn' + req.body.user_name;
  69. var mailOptions = {
  70. from: 'sender@gmail.com', // sender address
  71. to: 'receiver@gmail.com', // list of receivers
  72. subject: 'Appointment Email Example', // Subject line
  73. text: text,
  74. html: '<!DOCTYPE html>'+
  75. '<html><head><title>Appointment</title>'+
  76. '</head><body><div>'+
  77. '<img src="http://evokebeautysalon1.herokuapp.com/main/img/logo.png" alt="" width="160">'+
  78. '<p>Thank you for your appointment.</p>'+
  79. '<p>Here is summery:</p>'+
  80. '<p>Name: James Falcon</p>'+
  81. '<p>Date: Feb 2, 2017</p>'+
  82. '<p>Package: Hair Cut </p>'+
  83. '<p>Arrival time: 4:30 PM</p>'+
  84. '</div></body></html>'
  85. };
  86. transporter.sendMail(mailOptions, function(error, info){
  87. if(error){
  88. console.log(error);
  89. res.json({yo: 'error'});
  90. }else{
  91. console.log('Message sent: ' + info.response);
  92. res.json({yo: info.response});
  93. };
  94. });
  95. }
  96.  
  97. module.exports = router;
Add Comment
Please, Sign In to add comment