Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.get('/contactus',function(req,res) {
- var otp = req.query.otp;
- var email = req.query.email;
- var transporter = nodemailer.createTransport({
- host: 'smtp.gmail.com',
- port: '465',
- service: 'Gmail',
- auth: {
- user : 'your@email.com',
- pass : 'your_gmail_password'
- }
- });
- var mailOptions = {
- from: 'example@mail.com', // sender email
- to: email, // receivers email
- subject: 'help OTP verification', // Subject line
- text: "your verification OTP is " + otp, // plaintext body
- html: '<h2>your varifaction OTP is ' + otp + '</h2>' // html body
- };
- // send mail with defined transport object
- transporter.sendMail(mailOptions, function(error, info){
- if(error){
- console.log(error);
- }
- console.log('Email sent: ');
- });
- });
Add Comment
Please, Sign In to add comment