嘿,我正在使用 nodemailer 和 send-in-blue 从我的 next.js 应用程序发送邮件。
当我在 netlify 上托管该网站为客户演示时,一切都很顺利。电子邮件发送没有错误,但是当我在 digitalocean 液滴上托管该站点时,它开始抛出以下错误:
Error: Invalid login: 530 Invalid username or password
at SMTPConnection._formatError (/app/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/app/node_modules/nodemailer/lib/smtp-connection/index.js:1536:34)
at SMTPConnection.<anonymous> (/app/node_modules/nodemailer/lib/smtp-connection/index.js:540:26)
at SMTPConnection._processResponse (/app/node_modules/nodemailer/lib/smtp-connection/index.js:947:20)
at SMTPConnection._onData (/app/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData (/app/node_modules/nodemailer/lib/smtp-connection/index.js:189:44)
at TLSSocket.emit (node:events:394:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10) {
code: 'EAUTH',
response: '530 Invalid username or password',
responseCode: 530,
command: 'AUTH PLAIN'
}
这是我写的代码:
const transporter = nodemailer.createTransport({
service: "SendinBlue",
auth: {
user: process.env.SEND_IN_BLUE_USER,
pass: process.env.SEND_IN_BLUE_PASS,
},
});
const transporterRes = await transporter.sendMail({
to: stringifiedEmails,
from: email,
subject: "test",
html,
});
是的,环境变量工作得很好。
谁能解释发生了什么?提前致谢。