Email routing help
Hello,
I'm trying to create a worker that will recieve forwarded emails, extract some info from them, and contact my api using that info. I already have the code written to do that, however I am confused on how to get cloudflare to accept those emails and point them to the worker.
The documentation for email workers seems to be essentially non-existent. If anyone has any link to something I just couldn't find, please send that.
The "Using email triggers" button on the dashboard just goes to a page that talk about normal http routes (https://developers.cloudflare.com/workers/platform/triggers/routes/#matching-behavior). "mail" is not mentioned a single time on that page. How can I configure it? Do I just put an email in?
8 Replies
I just found https://developers.cloudflare.com/email-routing/email-workers/enable-email-workers/, but is this the only way to make email workers? I can't use wrangler?
If that is the only way, then how would I set secrets?
You can do it in wrangler. You add an email event handler https://developers.cloudflare.com/workers/runtime-apis/email-event/ I do believe you have to manually add the trigger from the dashboard though
Yeah, I've already done that, but the code is where the documentation seems to end
in the dashboard, clicking the add button just goes to zone select screen, then when i click the zone it just goes to the zone homepage
If you already have a worker, as long as it has an email trigger, you should be able to add a route for it under the Email Routing Routes Tab (Magic Link: https://dash.cloudflare.com/?to=/:account/:zone/email/routing/routes)
Create Address -> Send to worker -> select your worker
aha! thank you
I see what you were confused by now, the triggers tab in the worker for email triggers is pretty useless. I'm not sure what docs the "using email triggers" would even go to, perhaps something not created yet. And the "View Email Routing" button just kicks you back to your account overview
But yea, just adding the email worker route, and waiting for the overview tab to show "Routing Status: enabled" and not "Routing Status: syncing" (which can take a hot second), and you should be set
cool, thank you again. Weird that the thing in the trigger tab is just a dead end
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View