简体   繁体   English

535 身份验证失败 - Twilio SendGrid SMTP 中继 NodeJS

[英]535 Authentication Failed - Twilio SendGrid SMTP Relay NodeJS

I have a verified mail with Twilio SendGrid.我有一封带有 Twilio SendGrid 的经过验证的邮件。 I'm following the SMTP Relay stat up guide here .我在这里关注 SMTP 继电器统计指南。 I can't get it to send email using their SMTP Relay and NodeMailer.我无法使用他们的 SMTP 中继和 NodeMailer 发送 email。 I need to know what I'm doing wrong?我需要知道我做错了什么?

In the example, they create an API Key and a password for you:在示例中,他们为您创建了 API 密钥和密码: 在此处输入图像描述

I'm using nodemailer here:我在这里使用 nodemailer:

//smtp
smtpTransport = nodemailer.createTransport(smtpTransport({
host: "smtp.sendgrid.net",
//secure: true,
port: 587,
auth: {
user: sendgrid_api_key, // generated ethereal user
pass: sendgrid_pass, // generated ethereal password
},
}));

When I run this I get error in the console:当我运行它时,我在控制台中收到错误:

Error: Invalid login: 535 Authentication failed: Bad username / password at SMTPConnection._formatError错误:无效登录:535 身份验证失败:SMTPConnection._formatError 处的用户名/密码错误

When using SMTP to send emails with SendGrid, the username you should use is the string apikey .当使用 SMTP 通过 SendGrid 发送电子邮件时,您应该使用的用户名是字符串apikey Then the password should be your actual API key that has permission to send emails.那么密码应该是您的实际 API 密钥,该密钥有权发送电子邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM