如何在MongoDB领域上运行nodemailer?nodemailer未能在MongoDB领域执行
代码:
const nodemailer = require("nodemailer");
exports = async function (changeEvent) {
try {
const transporter = nodemailer.createTransport({
service: "gmail",
auth: {
user: "somthing@gmail.com",
pass: "passw0rd",
},
});
let info = transporter.sendMail({
from: "something@gmail.com",
to: "wdcjdwzcvpbagtd@frederictonlawyer.com",
subject: "YesterDay Report Details!",
html: `
<div style=" text-align: center;" >
style=" width: 100%; height: 100px; margin-top: 10px;" />
<br />
<hr />
<br />
<p>
<span style=" color: rgb(99, 99, 99); font-weight: bold;">
adminMail </span>, hi there!
</p>
<br />
<p style="margin-top: 20px; color: gray;">
This link expire in 10 minutes</p>
<h5>Total Income Aomunt : </h5>
<h5>Avrage Income Aomunt : </h5>
<h5>Patientions Count : </h5>
<h5>Over-reported Disease : </h5>
<h5>Reported All Disease : </h5>
<p>Thanks and Regards</p>
<div style="margin-top: 50px;">© 2021 Apollo</div>
</div>
`,
});
if (info) {
console.log(info);
}
console.log(
`Successfully send daily report Mail to wdcjdwzcvpbagtd@frederictonlawyer.com :)`
);
} catch (err) {
console.error("Failed to run the function : ", err);
}
};产出:

运行于清华1月13日2022年17:33:04 GMT+0530 (印度标准时间)错误:未能执行“node_node/nodemailer/lib/nodemailer.js”的源代码: FunctionError:未能执行node_modules/nodemailer/lib/shared/index.js:41:80(63) FunctionError的源代码:未能执行'node_modules/nodemailer/lib/shared/index.js':TypeError的源代码:'networkInterfaces‘不是node_modules/nodemailer/lib/shared/index.js:41:80(63)中的一个函数
at require (native)
at node_modules/nodemailer/lib/mailer/index.js:37:22(39)
at require (native)
at node_modules/nodemailer/lib/nodemailer.js:13:22(13)运行于清华1月13日2022年17:33:17 GMT+0530 (印度标准时间)错误:未能执行“node_node/nodemailer/lib/nodemailer.js”的源代码: FunctionError:未能执行node_modules/nodemailer/lib/shared/index.js:41:80(63) FunctionError的源代码:未能执行'node_modules/nodemailer/lib/shared/index.js':TypeError的源代码:'networkInterfaces‘不是node_modules/nodemailer/lib/shared/index.js:41:80(63)中的函数
at require (native)
at node_modules/nodemailer/lib/mailer/index.js:37:22(39)
at require (native)
at node_modules/nodemailer/lib/nodemailer.js:13:22(13)但这是我系统的工作..。


发布于 2022-01-13 16:04:48
您将需要将nodemailer添加为依赖项
在Functions屏幕上,您将看到一个dependencies选项卡。单击它并按照说明添加nodemailer作为依赖项。

https://stackoverflow.com/questions/70696512
复制相似问题