NodeMailer 登录无效 [英] NodeMailer Invalid Login

查看:45
本文介绍了NodeMailer 登录无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 node.js 编程的新手.我正在使用 nodemailer 模块发送电子邮件.

I am new to node.js programming .I am using nodemailer module for sending emails.

const nodemailer = require ('nodemailer'),
credentials=require('./credentials.js');
var mailTransport=nodemailer.createTransport({
    service:'Gmail',
    auth: {
        user : credentials.gmail.user,
        pass : credentials.gmail.password,
    }
});
function sendMail(mail_id){
    mailTransport.sendMail({
        from: ' "my name" <myname@gmail.com>',
        to : mail_id,   //user@gmail.com
        subject : 'Hello',
        text: "Hello How do u do ?",
    },function(err,info){
        if(err){
            console.log('Unable to send the mail :'+err.message);
        }
        else{
            console.log('Message response : '+info.response);
        }
    });
}
exports.sendMail=sendMail;

这是我向不同用户发送电子邮件的程序.但我得到 Invalid Login .我不知道为什么会这样.我是 node.js 和服务器端脚本的新手.
我正在使用我的 gmail 用户名和密码作为凭据.
请帮帮我.

This is my program for sending emails to different users. But I am getting Invalid Login . I don't have any idea why this is coming . I am new to node.js and server side scripting.
I am using my gmail username and password for credentials.
Please help me.

推荐答案

您是否仔细检查了您的登录凭据?您是否还仔细检查了您的发件人"地址以匹配您的电子邮件?

Did you double-check your login credentials? Also did you double-check your "from" adress to match your email?

我在 3 周前使用 nodemailer 进行了一些测试,并使用了 github 页面上给出的 gmail 示例,它就像一个魅力:

I used the nodemailer for some tests 3 weeks ago with the gmail example given on the github page and it worked like a charm:

https://github.com/andris9/Nodemailer

无效登录表示输入错误/错误的凭据.

Invalid login indicates mistyped/wrong credentials.

这篇关于NodeMailer 登录无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆