I am trying to use an email worker to forward from 1 email address to a few gmail accounts. Below is what I have and when I test it in the code editor it works; however, when I send from a real email account (after deploying) the delivery fails in my CF activity log and I get the following message returned to the sending account.
Email Message:
The response from the remote server was:
521 5.3.0 Upstream error, please check {link here} for possible reasons why.
Code:
export default {
async email(message, env, ctx) {
const allowList = ["[email protected]"];
if (allowList.indexOf(message.headers.get("to")) == 0) {
await message.forward("[email protected]");
await message.forward("[email protected]");
await message.forward("[email protected]");
}
}
}