Importing Email Templates to Send From NextJS API Route

Jacob Neterer
3 min readMay 10, 2021

If you’re having trouble importing or reading files from a NextJS API route, you’re not alone. I recently ran into this issue when trying to send self-managed email templates from a NextJS API route and I want to share the solution with you!

The Problem

In my case I was using Mailgun to send notification and transactional emails but I didn’t want my email templates to live in Mailgun. I wanted version control for my email templates and a better editing experience without having to use Mailgun or another…

--

--

Jacob Neterer

Lead software engineer specializing in web and mobile development. Always learning new things. “There is no growth in the comfort zone…”