ahmdtalat
ahmdtalat

Reputation: 189

Nodemailer with Next.js

Hello I'm using nodemailer with next, I'm trying to include an image in the email but keep getting this error

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

any idea how can I successfully include image in one the Next /api routes?

Upvotes: 1

Views: 497

Answers (1)

Ashok
Ashok

Reputation: 3611

You're trying to find the image directory from the root of the project instead that use like this

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

Upvotes: 3

Related Questions