How do i do this?

So for a special purpose i am trying to forward all emails to 5 seperate emails, how do i do this? email workers btw this is my current code and it obviously doesnt work export default { async email(message, env, ctx) { const allowList = [""]; if (allowList.indexOf(message.headers.get("from")) == -1) { await message.forward("[email protected]"); await message.forward("[email protected]"); await message.forward("[email protected]"); await message.forward("[email protected]"); await message.forward("[email protected]"); } else { } } }
9 Replies
Chaika
Chaika16mo ago
You can do that, calling .forward multiple times, as long as all the destinations are verified. Keep in mind the format of the email header, it's the same thing you'd see in your email client as the visible name and in a specific format (RFC5322.FROM): https://www.xeams.com/difference-envelope-header.htm ex: Jack Smith <[email protected]> message.from has the envelope from, which is just the email
CreatorBoiX
CreatorBoiXOP16mo ago
so its mandatory to verify it before i run this code?
Chaika
Chaika16mo ago
All emails you forward to have to be verified destination addresses yes
CreatorBoiX
CreatorBoiXOP16mo ago
because it gives this
No description
CreatorBoiX
CreatorBoiXOP16mo ago
is that part of the verification?
Chaika
Chaika16mo ago
that wouldn't be the error you would get frrom that I don't think, sounds more like you didn't add a route to go to the worker
CreatorBoiX
CreatorBoiXOP16mo ago
it would be a error like this?
No description
Chaika
Chaika16mo ago
that would be more like it yea, and you can tail your worker (Logs -> Start log stream-> send email) to get the exact error
CreatorBoiX
CreatorBoiXOP16mo ago
No description
Want results from more Discord servers?
Add your server