Skip to content

Instantly share code, notes, and snippets.

@sam-heller
Last active July 30, 2023 06:19
Show Gist options
  • Save sam-heller/a6569c68acc89611da28580445bf983b to your computer and use it in GitHub Desktop.
Save sam-heller/a6569c68acc89611da28580445bf983b to your computer and use it in GitHub Desktop.
Split forward for Cloudflare email worker
export default {
async email(message, env, ctx) {
const forwardList = ["one@one.com", "two@two.com"];
if (forwardList.indexOf(message.headers.get("from")) != -1) {
await message.forward("three@three.com")
}
await message.forward("four@four.com");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment