简体   繁体   English

Nodemailer:未捕获类型错误:Class 扩展值未定义不是构造函数或 null

[英]Nodemailer: Uncaught TypeError: Class extends value undefined is not a constructor or null

Im trying to use nodemailer to send an email from a contact form.我试图使用 nodemailer 从联系表中发送 email。 Below is all my code relating to nodemailer aswell as a screenshot of the error I get.以下是我与 nodemailer 相关的所有代码以及我得到的错误的屏幕截图。 我收到的错误

import nodemailer from 'nodemailer';

let transporter = nodemailer.createTransport({
        host: 'smtppro.zoho.com',
        port: 465,
        secure: true,
        auth: {
          user: '',
          pass: '',
        },
      });

      const date = new Date(Date.now());
      let contact = await transporter.sendMail({
        from: `"${this.data.name}" <${this.data.email}>`,
        to: this.data.staff,
        subject: `Contact Page Submission: ${this.data.subject}`,
        html: `
        <h1>New Contact Form Submission</h1>
    <span><b>From:</b> ${this.data.name} - ${this.data.email}</span><br>
    <span><b>Subject:</b> ${this.data.subject}</span><br>
    <span><b>To:</b> ${this.data.staff}</span><br>
    <span><b>Sent At:</b> ${date.toUTCString()}</span><br><br>
    <span><b>Message:</b></span>
    <p>${this.data.message}</p>
        `,
      });

When I try to load the page it throws the exception.当我尝试加载页面时,它会引发异常。 When I remove the import statement it loads just like normal.当我删除导入语句时,它就像正常加载一样。 This is all contained inside of a Vue.JS project.这都包含在 Vue.JS 项目中。 I have the latest version of nodemailer installed.我安装了最新版本的 nodemailer。

nodemailer runs only in Node. nodemailer仅在 Node 中运行。 The screenshot shows you're trying to use it from the browser, which won't work -- @tony19屏幕截图显示您正在尝试从浏览器中使用它,但它不起作用 -- @tony19

暂无
暂无

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

相关问题 如何解决 Uncaught TypeError: Class extends value undefined is not a constructor or null? - How to solve Uncaught TypeError: Class extends value undefined is not a constructor or null? TypeError: Class extends value undefined is not a constructor 或 null - TypeError: Class extends value undefined is not a constructor or null 'Uncaught TypeError: Class extends value undefined is not a constructor or null' 尝试加载外部 TypeScript 组件时 - 'Uncaught TypeError: Class extends value undefined is not a constructor or null' when trying to load external TypeScript component 未捕获的类型错误:类扩展值 #<Object> 不是构造函数或 null - Uncaught TypeError: Class extends value #<Object> is not a constructor or null React Class 中的“TypeError: Class extends value undefined is not a constructor or null”问题 - Issue with “TypeError: Class extends value undefined is not a constructor or null” in React Class 反应TypeError:类扩展未定义的值不是构造函数或null - React TypeError: Class extends value undefined is not a constructor or null Reactjs TypeError:类扩展值未定义不是构造函数或空值 - Reactjs TypeError: Class extends value undefined is not a constructor or null TypeError:类扩展未定义的值不是构造函数或为null(反应流星数据) - TypeError: Class extends value undefined is not a constructor or null (React Meteor Data) TypeError: Class extends value undefined is not a constructor 或 null - Node.js - TypeError: Class extends value undefined is not a constructor or null - Node.js REACT TypeError: Class extends value undefined is not a constructor or null - REACT TypeError: Class extends value undefined is not a constructor or null
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM