E-mail routing with worker only on subdomain

Hello, After searching for a bit i found that to make this possible i needed to create a different zone for the subdomain following the documentation i couldn't figure it out so i decided to try something else. We currently have our mailing in gmail and would like to keep it that way, so for gmail we are using the root of the domain: roy@example.com. We have a SAAS tool that currently send mails using {company}@example.com. Since it needs to be on a subdomain to do the seperate routing I added the MX and TXT records manually in cloudflare's DNS on mailing.example.com. It seems that it's now beeing captured by the routing and send to the worker but when trying to send an E-mail to the subdomain demo@mailing.example.com i get the following message back: 521 5.3.0 Upstream error, please check https://developers.cloudflare.com/email-routing/postmaster for possible reasons why. lqY8HOe6NBOb Looking at the URL given by the error I can't really figure out what is happening. In the router i created a very short piece of code that simple allows the "to" to go only to 1 domain as a test.
export default {
async email(message, env, ctx) {
if (message.headers.get("to") == "demo@mailing.example.com") {
await message.forward("info@example2.com");
} else {
message.setReject("Unknown address");
}
}
}
export default {
async email(message, env, ctx) {
if (message.headers.get("to") == "demo@mailing.example.com") {
await message.forward("info@example2.com");
} else {
message.setReject("Unknown address");
}
}
}
What am i doing wrong?
1 Reply
Roy
Roy10mo ago
Great! Is there a way to do it like that? I read something about Enterprise accounts beeing able to make a different zone for the subdomains. Hmm okay, we are currently on a Pro subscription. The Enterprise subscription has a "Custom" price. Does that mean that it's just really expensive or does it mean that it i only need this feature extra that we wil have to pay for this extra feature? Ok, i know enough.
Want results from more Discord servers?
Add your server
More Posts