System Information
-
Strapi 4.xx:
-
Window 11:
-
Postgres:
-
Node16.xx:
I am trying to load an HTML email template file, manipulate its contents, and send it out using SendGrid and strapi’s email plugin. But for some reason, the HTML file is be compiled (it’s not included in the dist
folder). I get ENOENT: no such file or directory,
If I move the HTML file intro dist
folder, it works fine.
This is the code sample
.

The HTML file is in the same directory.
I think you want to put the file in public folder since it’s HTML then require it from there,
1 Like
Thank you very much. This worked fine.
1 Like
Hi what was the url to access the file in your public folder? I am having issues coming up with the right url for the path.
const html_template = readFileSync(path.join(__dirname, '../../../../../public/templates/order_paid.html'), 'utf8');
Results in:
D:\\Devbox\\cbs\\ticketland-ts\\dist\\public\\templates\\order_paid.html'
In the dist folder i dont see any of the public files. So how are they accessible from the build?
1 Like
Hi, the solution you provided somehow doesn’t work for me. I’m using strapi 4.12.4 with typescript , however when running strapi develop
the dist folder generated but doesn’t include public folder at all, any idea what happen here?