在express js中使用nodemailer时出错,如何解决?

时间:2018-02-05 11:58:07

标签: express nodemailer

错误我在快递js中使用nodemailer,如何解决?

app.post(' / feedback',function(req,res){         const transporter = nodemailer.createTransport({             服务:' Gmail',             auth:{                 用户:' kdsingh834@gmail.com',                 传递:''             }         });

    var mailOptions = {
        from: 'kd <kdsingh834@gmail.com>'
        to:  'kdsinghjob@gmail.com',
        subject: 'feedback submission',
        text: 'your submission with details..Name: '+req.body.name+'Email:'+req.body.email+ 'Message: '+req.body.message,
        html: '<p>your submission with details..</p><ul><li>Name: '+req.body.name+'</li><li>Email: '+req.body.email+'</li><li>Message: '+req.body.message+'</li></ul>'

    };

    transporter.sendMail(mailOptions, function(error, info){
        if(error){
            console.log(error);
            res.redirect('/');
        } else {
            console.log('Message sent: '+info.response);
            res.redirect('/');
        }

    });
});

error in nodemailer using express js, how to fix that error!! error occuring when starting the server

0 个答案:

没有答案