无法使用node.js发送邮件

时间:2017-09-25 16:52:55

标签: node.js nodemailer

我无法使用nodejs程序发送邮件我使用了node-mailer和nodemailer smtp传输模块。这个程序在上周完美运行。但突然现在它无法运行。我试过但我找不到错误。任何人都帮助我.Thankyou。

var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');
var transporter = nodemailer.createTransport(smtpTransport({
    service: 'Gmail',
    host: 'smtp.gmail.com',
    port: 465,
    auth: {
        user: 'sampleprogrammers@gmail.com',
        pass: 'ashbdhbedbudu.'
    }
}));

transporter.sendMail({
    from: "sampleprogrammers@gmail.com",
    subject:" hello ji " ,
    text: "I would like to write dialogue",
    attachments:[
        {
            'filename':'link.txt',
            'path': 'E:/STUDIES/CORE SUBJECTS/link.txt'
        }
    ],
    to: "vikirockz456@gmail.com"
}, function(error, info) {
    if (error) {
        return console.log(error);
    }
    console.log('Message %s sent: %s', info.messageId, info.response);
    console.log("Mail sent successfully");
});

见下面的错误: Error image

1 个答案:

答案 0 :(得分:0)

您能否请完成这个问题:Nodemailer Error Can't Fix 也许您的节点版本在知情或不知情的情况下发生了变化。您的节点版本似乎与nodemailer不兼容。