[英]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.