making a worker to foward a message sent from 1 email to multiple emails

Hello im currently trying to figgure out a way to make a worker forward and email that a email adress recived and foward that to multiple other emails As im not tha experienced with workers i wanted to ask here what i could use to make that happen
11 Replies
Chaika
Chaika2y ago
Sure, you can do this via email workers. If you just wanted a simple forward from one address to multiple: Add the addresses you want to use as destination addresses within email routing routes tab Create a new email worker from the Email Workers tab, select create your own, go to Quick Edit and replace with code like
export default {
async email(message, env, ctx) {
await message.forward("[email protected]");
await message.forward("[email protected]");
}
}
export default {
async email(message, env, ctx) {
await message.forward("[email protected]");
await message.forward("[email protected]");
}
}
Back in the Email Routing Routes tab, add a new custom address to send to that worker To test, send an email from an email address other then the two you are forwarding to (otherwise some providers like gmail will delete email they see as duplicates)
Nbc66
Nbc66OP2y ago
Ahh alright so that was the issues i was trying to send it from the email im actually forwarding to lol Thank you so much this helps a ton
Chaika
Chaika2y ago
ahh yea that can be confusing. Another potentially confusing thing is that currently Email Workers always show as "Dropped" in the email summary. If your worker errors out, it shows as "Delivery Failed".
Nbc66
Nbc66OP2y ago
ok im having issues with this rn
mx.cloudflare.net gave this error:
Upstream error, please check https://developers.cloudflare.com/email-routing/postmaster for possible reasons why. RA6qfUtAb6oU
mx.cloudflare.net gave this error:
Upstream error, please check https://developers.cloudflare.com/email-routing/postmaster for possible reasons why. RA6qfUtAb6oU
@chaika.me
Chaika
Chaika2y ago
Sounds like your worker is erroring out. Check your email summary tab to see if you have delivery failed, or tail your worker before you send an email. If I had to blindly guess, you probably are trying to forward to non-verified destinations, or some other runtime error
Nbc66
Nbc66OP2y ago
i'll take a look at it
Nbc66
Nbc66OP2y ago
looks like this is the main error
Chaika
Chaika2y ago
Well that's not the actual error, it's just saying something is wrong with your Worker In the dashboard, if you navigate to your Worker and then the "Logs" tab, start log stream, send an email, and you should see the actual error
Nbc66
Nbc66OP2y ago
Ok looks like i cant actually specify emails from cloudflaer itself but i have to use the verified email But i guess it works thank you for the help
Chaika
Chaika2y ago
Yea, you need to add each email you want to forward to as destination addresses in email routing and verify them
Nbc66
Nbc66OP2y ago
I mean as in i cant specify a routed email as in an example [email protected] that fowards to [email protected] I guess i can send another requst to my allredy routed email from the email i made on cloudflaer lol But hey it works thank you again for the help
Want results from more Discord servers?
Add your server