gpt4 book ai didi

javascript - nodemailer和node中的密码问题

转载 作者:搜寻专家 更新时间:2023-11-01 00:32:05 25 4
gpt4 key购买 nike

我在 gmail 中使用 nodemailer,我需要以某种方式包含我的密码。问题是我的密码同时包含单引号和双引号。例如我的“烦人的”密码。

我试图转义其中任何一个引号,但 Google 拒绝了我的密码。“我的\”烦人的密码“

'my'annoying\'password'

我可以正常登录,但我不能在我的脚本中使用它。

这是创建邮件程序对象的代码。

var mailer = email.createTransport({
service : "gmail",
auth : {
user : "myemail@gmail.com",

// neither of these work
password : "my\"annoying'password",
// password : 'my"annoying\'password',
}
});

这可能吗,还是我必须更改密码?

更新

我得到的错误是:

[Error: Invalid login]
code: 'EAUTH',
response: '535-5.7.8 Username and Password not accepted.

最佳答案

对不起。我真傻。

var mailer = email.createTransport({
service : "gmail",
auth : {
user : "myemail@gmail.com",

// neither of these work
pass : "my\"annoying'password",
// pass : 'my"annoying\'password',
}
});

不是

var mailer = email.createTransport({
service : "gmail",
auth : {
user : "myemail@gmail.com",

// neither of these work
password : "my\"annoying'password",
// password : 'my"annoying\'password',
}
});

注意 password: 更改为 pass:

关于javascript - nodemailer和node中的密码问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27843258/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com