NodeMailer无效登录 [英] NodeMailer Invalid Login
问题描述
我是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;
这是我向不同用户发送电子邮件的程序。但我得到无效登录。我不知道为什么会这样。我是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屋!