nodeEmailer从MySQL数据库发送包含信息的电子邮件

nodeEmailer从MySQL数据库发送包含信息的电子邮件,mysql,nodemailer,Mysql,Nodemailer,我正在尝试用NodeEmailer恢复密码。基本上,用户将在HTML表单中输入电子邮件地址,然后使用NodeEmailer发送电子邮件。该电子邮件将包含来自MySQL数据库的密码。我的问题是,密码显示为“未定义” 电子邮件中的密码输出显示“未定义”。我一直在尝试不同的事情,但都没有用。有人能帮我解释一下我做错了什么吗?为帐户做一个console.log,看看结果是否返回try results[0]。密码,request.password不正确,因为密码在db查询结果中,而不是api请求中。另外,

我正在尝试用NodeEmailer恢复密码。基本上,用户将在HTML表单中输入电子邮件地址,然后使用NodeEmailer发送电子邮件。该电子邮件将包含来自MySQL数据库的密码。我的问题是,密码显示为“未定义”


电子邮件中的密码输出显示“未定义”。我一直在尝试不同的事情,但都没有用。有人能帮我解释一下我做错了什么吗?

为帐户做一个console.log,看看结果是否返回try results[0]。密码,request.password不正确,因为密码在db查询结果中,而不是api请求中。另外,在数据库中以明文形式存储密码也是一个非常糟糕的过程,使用散列。account=JSON.parse(JSON.stringify(results[0]),那么account.password也应该可以工作。
app.post('/Forgot_Password_V1', function(request, response) {
    var connection = request.app.get('pool'); 
    connection.query('SELECT password FROM accounts WHERE email = ?', [request.body.email], function(error, results, fields) {  
https://myaccount.google.com/lesssecureapps?pli=1
    { account: results[0] };

        var transporter = nodemailer.createTransport({
            service: 'Gmail',
            auth: {
                user: 'user',
                pass: 'password'
            }
        });

            //send to the email entered in the form input
            var mailOptions = {     
                from: 'email',
                to: request.body.email,
                subject: 'Password Request',
                text: 'You have requested to recover the password of your account.\n\n' +

                request.password + // I tried this
                account.password + // I also tried this
                '\n End.\n'
            };