diff --git a/src/content/docs/email-routing/email-workers/index.mdx b/src/content/docs/email-routing/email-workers/index.mdx index 5a91e756edd9da..cebceeefd9dae1 100644 --- a/src/content/docs/email-routing/email-workers/index.mdx +++ b/src/content/docs/email-routing/email-workers/index.mdx @@ -3,7 +3,6 @@ title: Email Workers pcx_content_type: concept sidebar: order: 4 - --- With Email Workers you can leverage the power of Cloudflare Workers to implement any logic you need to process your emails and create complex rules. These rules determine what happens when you receive an email. @@ -16,15 +15,15 @@ The following is an example of an allowlist Email Worker: ```js export default { - async email(message, env, ctx) { - const allowList = ["friend@example.com", "coworker@example.com"]; - if (allowList.indexOf(message.from) == -1) { - message.setReject("Address not allowed"); - } else { - await message.forward("inbox@corp"); - } - } -} + async email(message, env, ctx) { + const allowList = ["friend@example.com", "coworker@example.com"]; + if (allowList.indexOf(message.from) == -1) { + message.setReject("Address not allowed"); + } else { + await message.forward("inbox@corp"); + } + }, +}; ``` Refer to the [Workers Languages](/workers/languages/) for more information regarding the languages you can use with Workers. @@ -41,6 +40,8 @@ The route, or email address, bound to the Worker forwards emails to your Email W For example, say that you create an allowlist Email Worker and bind it to a `hello@my-company.com` route. This route will be the email address you share with the world, to make sure that only email addresses on your allowlist are forwarded to your destination address. All other emails will be dropped. -## Limits +## Resources -If you encounter any allocation errors while using Email Workers, refer to [Limits](/email-routing/limits/#email-workers-size-limits) for more information. +- [Limits](/email-routing/limits/#email-workers-size-limits) +- [Runtime API](/email-routing/email-workers/runtime-api/) +- [Local development](/email-routing/email-workers/local-development/)