NodeMailer Invalid Login(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 登录无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:NodeMailer 登录无效
- Flexslider 箭头未正确显示 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 失败的 Canvas 360 jquery 插件 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
