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
ajgeiss0702
ajgeiss070213mo ago
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?
Cyb3r-Jak3
Cyb3r-Jak313mo ago
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
ajgeiss0702
ajgeiss070213mo ago
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
Chaika
Chaika13mo ago
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
ajgeiss0702
ajgeiss070213mo ago
aha! thank you
Chaika
Chaika13mo ago
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
ajgeiss0702
ajgeiss070213mo ago
cool, thank you again. Weird that the thing in the trigger tab is just a dead end
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View