email not being blocked

Hello I am trying to block a certain email for testing and i am still recieving it.
export default {
  async email(message, env, ctx) {
    const block = ["emailhere@gmail.com"]
    if (block.indexOf(message.headers.get("from")) == -1) {
      console.log("done")
      await message.forward("emailhere@proton.me");
      console.log("done yes")
    } else {
      console.log("blocked")
      message.setReject("Address is blocked");
      console.log("blocked yes")
    }
  }
}
image.png
Was this page helpful?