forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.64k stars 339 forks source link

absolute paths on WSL2 #430

Closed MidoloS closed 2 years ago

MidoloS commented 2 years ago

Is it possible to use absolute paths to access files from a WSL2 (Ubuntu) instance?

I can see that the absolute paths are based on starting with "/"

so i tried the following solution

return await sendMail({
    to: user.email,
    template: '/\\wsl$/Ubuntu/home/.../.../.../emails/users/welcome',
})

but it dropped the following error

image

{ 
     "Error": "ENOENT: no such file or directory, stat '/\wsl$/Ubuntu/home/.../.../.../emails/users/welcome/text.pug'",
     "errno": "-2",
     "code": "ENOENT",
     "syscall": "stat",
     "path":
      "/\\wsl$/Ubuntu/home/.../.../.../emails/users/welcome/text.pug"
}
niftylettuce commented 2 years ago

Not sure why you have \\, that's your issue it seems.