Email Workers example does not work

I created a new email route worker in the dashboard and tried to use the example found at https://developers.cloudflare.com/email-routing/email-workers/reply-email-workers/ When trying to save and deploy, workers cannot find the „mimetext“ package. Does anyone have experience with email workers and know how to fix it? Thanks
Reply to emails from Workers · Cloudflare Email Routing docs
You can reply to incoming emails with another new message and implement smart auto-responders programmatically, adding any content and context in the …
2 Replies
DaniFoldi
DaniFoldi7mo ago
Hi! If you're using Quick Edit (or the Workers Playground), you'll have to include any external dependencies yourself. Rather unfortunately, it still doesn't support downloading & bundling external packages, so you'd have to do it manually. Modules starting with cloudflare: are internal, that's why cloudflare:email worked. Checking mimetext on npm it looks like it depends on other packages, which would be a nightmare to all copy manually - I recommend downloading the worker (npx wrangler init <name> --from-dash), adding mimetext as a dependency (npm install mimetext) and deploying via wrangler (npx wrangler deploy) - wrangler can do bundling of installed dependencies via esbuild, so that way you can use mimetext in your Worker. Hope this helps MeowHeartCloudflare
Play
Play7mo ago
Oh that makes a lot of sense, I assumed workers just pulls the dependencies by itself. Thanks a lot for your help, I’ll use the wrangler cli PepeHappy