【问题标题】:Nodemailer with Next.js带有 Next.js 的 Nodemailer
【发布时间】:2021-08-30 17:16:38
【问题描述】:

您好,我正在使用 nodemailer 和 next,我正在尝试在电子邮件中包含图像,但不断收到此错误

err: [Error: ENOENT: no such file or directory, open '/images/welcome.png'] {
    errno: -2,
    code: 'ESTREAM',
    syscall: 'open',
    path: '/images/welcome.png',
    command: 'API'
  }

知道如何在 Next /api 路由中成功包含图像吗?

【问题讨论】:

    标签: next.js nodemailer


    【解决方案1】:

    您正在尝试从项目的根目录中查找图像目录,而不是像这样使用

    path: path.join(process.cwd(), `../static/images/your_image.png`)
    

    【讨论】:

    猜你喜欢
    • 2018-04-03
    • 2018-01-04
    • 1970-01-01
    • 1970-01-01
    • 2018-01-28
    • 2013-11-21
    • 2021-04-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多