Guest User

Untitled

a guest
Apr 13th, 2018
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. app.get('/contactus',function(req,res) {
  2. var otp = req.query.otp;
  3. var email = req.query.email;
  4. var transporter = nodemailer.createTransport({
  5. host: 'smtp.gmail.com',
  6. port: '465',
  7. service: 'Gmail',
  8. auth: {
  9. user : 'your@email.com',
  10. pass : 'your_gmail_password'
  11. }
  12. });
  13.  
  14. var mailOptions = {
  15. from: 'example@mail.com', // sender email
  16. to: email, // receivers email
  17. subject: 'help OTP verification', // Subject line
  18. text: "your verification OTP is " + otp, // plaintext body
  19. html: '<h2>your varifaction OTP is ' + otp + '</h2>' // html body
  20. };
  21. // send mail with defined transport object
  22. transporter.sendMail(mailOptions, function(error, info){
  23. if(error){
  24. console.log(error);
  25. }
  26. console.log('Email sent: ');
  27. });
  28. });
Add Comment
Please, Sign In to add comment