Skip to content

Commit 743b764

Browse files
authored
[Email Routing] Added reference to runtime api (#22206)
1 parent 50dd43d commit 743b764

File tree

1 file changed

+13
-12
lines changed
  • src/content/docs/email-routing/email-workers

1 file changed

+13
-12
lines changed

src/content/docs/email-routing/email-workers/index.mdx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: Email Workers
33
pcx_content_type: concept
44
sidebar:
55
order: 4
6-
76
---
87

98
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:
1615

1716
```js
1817
export default {
19-
async email(message, env, ctx) {
20-
const allowList = ["[email protected]", "[email protected]"];
21-
if (allowList.indexOf(message.from) == -1) {
22-
message.setReject("Address not allowed");
23-
} else {
24-
await message.forward("inbox@corp");
25-
}
26-
}
27-
}
18+
async email(message, env, ctx) {
19+
const allowList = ["[email protected]", "[email protected]"];
20+
if (allowList.indexOf(message.from) == -1) {
21+
message.setReject("Address not allowed");
22+
} else {
23+
await message.forward("inbox@corp");
24+
}
25+
},
26+
};
2827
```
2928

3029
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
4140

4241
For example, say that you create an allowlist Email Worker and bind it to a `[email protected]` 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.
4342

44-
## Limits
43+
## Resources
4544

46-
If you encounter any allocation errors while using Email Workers, refer to [Limits](/email-routing/limits/#email-workers-size-limits) for more information.
45+
- [Limits](/email-routing/limits/#email-workers-size-limits)
46+
- [Runtime API](/email-routing/email-workers/runtime-api/)
47+
- [Local development](/email-routing/email-workers/local-development/)

0 commit comments

Comments
 (0)