Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- D:Full StackNodeNodeLoginJWTfunctionspassword.js:58
- 'This token is valid only within two minutes.'
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- SyntaxError: Unexpected string
- at createScript (vm.js:56:10)
- at Object.runInThisContext (vm.js:97:10)
- at Module._compile (module.js:542:28)
- at Object.Module._extensions..js (module.js:579:10)
- at Module.load (module.js:487:32)
- at tryModuleLoad (module.js:446:12)
- at Function.Module._load (module.js:438:3)
- at Module.require (module.js:497:17)
- at require (internal/module.js:20:19)
- at Object.<anonymous> (D:Full StackNodeNodeLoginJWTroutes.js:9:18)
- at Module._compile (module.js:570:32)
- at Object.Module._extensions..js (module.js:579:10)
- at Module.load (module.js:487:32)
- at tryModuleLoad (module.js:446:12)
- at Function.Module._load (module.js:438:3)
- at Module.require (module.js:497:17)
- [nodemon] app crashed - waiting for file changes before starting...
- const transporter = nodeMailer.createTransport(`smtps://${config.email}:${config.password}@smtp.gmail.com`);
- const mailOptions = {
- from: `"${conifg.name}" <${config.email}>`,
- to: email,
- subject: 'Reset Password',
- html: `Hello ${user.name}`,
- 'Your account password token is ${random}'
- 'This token is valid only within two minutes.'
- 'Thanks,'
- 'Team. '
- };
- return transporter.sendMail(mailOptions);
- const mailOptions = {
- from: `"${conifg.name}" <${config.email}>`,
- to: email,
- subject: 'Reset Password',
- html: `Hello ${user.name}, // the tick should not come here
- 'Your account password token is ${random}'
- 'This token is valid only within two minutes.'
- 'Thanks,'
- 'Team. '` // the tick should come here
- };
- var express = require('express');
- var router = express.Router();
- var nodemailer = require('nodemailer');
- router.post('/', handleSendEmail); // handle the route at yourdomain.com/sayHello
- function handleSendEmail(req, res) {
- // Not the movie transporter!
- var transporter = nodemailer.createTransport({
- service: 'Gmail',
- auth: {
- user: '', // Your email id
- pass: ‘’// Your password
- }
- });
- var text = 'Hello from nn' + req.body.user_name;
- var mailOptions = {
- from: 'sender@gmail.com', // sender address
- to: 'receiver@gmail.com', // list of receivers
- subject: 'Appointment Email Example', // Subject line
- text: text,
- html: '<!DOCTYPE html>'+
- '<html><head><title>Appointment</title>'+
- '</head><body><div>'+
- '<img src="http://evokebeautysalon1.herokuapp.com/main/img/logo.png" alt="" width="160">'+
- '<p>Thank you for your appointment.</p>'+
- '<p>Here is summery:</p>'+
- '<p>Name: James Falcon</p>'+
- '<p>Date: Feb 2, 2017</p>'+
- '<p>Package: Hair Cut </p>'+
- '<p>Arrival time: 4:30 PM</p>'+
- '</div></body></html>'
- };
- transporter.sendMail(mailOptions, function(error, info){
- if(error){
- console.log(error);
- res.json({yo: 'error'});
- }else{
- console.log('Message sent: ' + info.response);
- res.json({yo: info.response});
- };
- });
- }
- module.exports = router;
Add Comment
Please, Sign In to add comment