redirect all mail from *@sagbot.com to contact@sagbot.com without creating a loop

Is there a way to redirect all mails coming from *@sagbot.com to contact@sagbot.com without creating a loop? like this?

export default {
  async email(message, env, ctx) {
    if (message.to != "contact@sagbot.com") {
      message.forward("contact@sagbot.com")
    } else {
      // send the email, normally
    }
  }
}
Was this page helpful?