NodeJS(Nodemailer)的邮件发送问题

问题描述 投票:0回答:1

此相同代码正在与同一服务器上具有不同进程端口的另一个项目一起使用。但在新项目中,它拒绝为我工作。它也不产生任何网络流量。

无法通过应用程序发送邮件

var transport = nodemailer.createTransport({
            debug: true,
            host: "smtp.xxx.xxxxxx.com",
            port: 25,
            secure: false,
            tls: {
                rejectUnauthorized: false,
            }
        });
        transport.verify(function (error, success) {
            if (error) {
                console.log('====>' + error);
            } else if (success) {
                console.log("Server is ready to take our messages");
            }
        });

        const email = new Email({
            message: {
                from: '"R Systems." <[email protected]>'
            },
            transport,
            send: true,
        });

        email.send({
            message: {
                to: user.user_email,
                subject: 'Reset Password Successful',
            },

            template: templateDir,
            locals: {
                first_name: user.user_name,
                password: password
            },
        }).then(console.log).catch(console.error);
node.js smtp nodemailer
1个回答
-1
投票

在解决此问题时,我发现在nodeJ中有一个npm'opn',它仅具有读写权限。

发送邮件也需要执行权限。

您要做的就是将权限从rw更改为rwx。然后您将被排序。

[如果您使用WinSCP进行nodeJS应用程序部署,请转到node_module文件夹,找到'opn',右键单击属性,并更改npm(文件夹)的权限,然后重新编译Node Application。

像魅力一样工作。

© www.soinside.com 2019 - 2024. All rights reserved.