Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. // app.post('/send', (req, res) => {
  2. // const output = `
  3. // <p>You have a new contact request</p>
  4. // <h3>Contact Details</h3>
  5. // <ul>
  6. // <li>Name: ${req.body.Name}</li>
  7. // <li>Email: ${req.body.Email}</li>
  8. // </ul>
  9. // <h3>Message</h3>
  10. // <p> ${req.body.Message}</p>
  11. // `;
  12.  
  13. // let transporter = nodeMailer.createTransport({
  14. // host: 'smtp.gmail.com',
  15. // port: 465,
  16. // secure: true,
  17. // auth: {
  18. // user: 'henryzhengschool@gmail.com',
  19. // pass: 'dankmeme'
  20. // },
  21. // tls:{
  22. // rejectUnauthorized:false
  23. // }
  24. // });
  25.  
  26. // // this is where you define the actual email you're going to send.
  27. // // note that the to, subject, and text fields all work with an object called
  28. // // req.body. req is your request variable and the body object is
  29. // // the body of the POST request sent by the user. In the case where
  30. // // you have a contact form, all the contact information from the HTML form
  31. // // will be inside req.body.
  32. // // It is suggested you console.log(req.body) before proceeding to understand
  33. // // what is inside this object.
  34. // let mailOptions = {
  35. // from: '"Nodemailer Contact" <henryzhengschool@gmail.com>', // sender address
  36. // to: "henryzhengschool@gmail.com", // list of receivers
  37. // subject: 'Node Contact Request', // Subject line
  38. // text: req.body.body, // plain text body
  39. // html: output // html body
  40. // };
  41. // // Send your email and handle the error accordingly.
  42. // transporter.sendMail(mailOptions, (error, info) => {
  43. // if (error) {
  44. // return console.log(error);
  45. // }
  46. // console.log('Message %s sent: %s', info.messageId, info.response);
  47.  
  48. // res.render('contact', {msg:'Email has been sent'});
  49. // return "Success!"
  50. // });
  51. // });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement