© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•2y ago•
4 replies
stevenjr1988

Email worker, with fetch, sending to API

I am trying to set up a catch-all email, and send all incoming emails to a worker.
The work is to send the email to my API. the API will then handle the rest.
Right now, I am getting rejected emails that the address dose not exist.
While editing the worker, I noticed "Error: No fetch handler!"
export default {
  async email(message, env, ctx) {
    const response = await fetch('https://api.domain.tld', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({email:message}),
    });
    if (!response.ok) {}
    const data = await response.json();
  }
}
export default {
  async email(message, env, ctx) {
    const response = await fetch('https://api.domain.tld', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({email:message}),
    });
    if (!response.ok) {}
    const data = await response.json();
  }
}
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Worker to Worker fetch
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Worker uploaded via API: fetch vs service worker
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago
Caching worker responses in Tiered Caching with Fetch API, similar to Cache API.
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
11mo ago