首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在MongoDB领域上运行nodemailer?nodemailer未能在MongoDB领域执行

如何在MongoDB领域上运行nodemailer?nodemailer未能在MongoDB领域执行
EN

Stack Overflow用户
提问于 2022-01-13 12:19:08
回答 1查看 135关注 0票数 3

如何在MongoDB领域上运行nodemailer?nodemailer未能在MongoDB领域执行

代码:

代码语言:javascript
复制
    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;">&copy; 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)中的一个函数

代码语言:javascript
复制
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)中的函数

代码语言:javascript
复制
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)

但这是我系统的工作..。

EN

回答 1

Stack Overflow用户

发布于 2022-01-13 16:04:48

您将需要将nodemailer添加为依赖项

Functions屏幕上,您将看到一个dependencies选项卡。单击它并按照说明添加nodemailer作为依赖项。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70696512

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档