Skip to content

Commit 3fb0a90

Browse files
committed
Merge branch 'celso/email-localdev' of github.com:cloudflare/cloudflare-docs into celso/email-localdev
2 parents c3bc5cc + 14621f6 commit 3fb0a90

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/content/docs/email-routing/email-workers/local-development.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ If you want to deploy your script you need to [enable Email Routing](/email-rout
3232

3333
:::
3434

35-
You can now test receiving, replying and sending emails in your local environment.
35+
You can now test receiving, replying, and sending emails in your local environment.
3636

37-
## Receiving an email
37+
## Receive an email
3838

39-
Consider this example Email Worker script that uses the opensource [postal-mime](https://www.npmjs.com/package/postal-mime) email parser:
39+
Consider this example Email Worker script that uses the open source [`postal-mime`](https://www.npmjs.com/package/postal-mime) email parser:
4040

4141
```ts
4242
import * as PostalMime from 'postal-mime';
@@ -54,7 +54,7 @@ export default {
5454
Now when you run `npx wrangler dev`, wrangler will expose a local `/cdn-cgi/handler/email` endpoint that you can `POST` email messages to and trigger your Worker's `email()` handler:
5555

5656
```bash
57-
curl -X POST 'http://localhost:8787/cdn-cgi/handler/email' \
57+
curl --request POST 'http://localhost:8787/cdn-cgi/handler/email' \
5858
--url-query '[email protected]' \
5959
--url-query '[email protected]' \
6060
--header 'Content-Type: application/json' \
@@ -105,9 +105,9 @@ This is what you get in the console:
105105
}
106106
```
107107

108-
## Sending an email
108+
## Send an email
109109

110-
Wrangler can also simulate sending emails locally. Consider this example Email Worker script that uses the [mimetext](https://www.npmjs.com/package/mimetext) npm package:
110+
Wrangler can also simulate sending emails locally. Consider this example Email Worker script that uses the [`mimetext`](https://www.npmjs.com/package/mimetext) npm package:
111111

112112
```ts
113113
import { EmailMessage } from "cloudflare:email";
@@ -133,7 +133,7 @@ export default {
133133

134134
Now when you run `npx wrangler dev`, go to http://localhost:8787/ to trigger the `fetch()` handler and send the email. You will see the follow message in your terminal:
135135

136-
```bash
136+
```txt
137137
⎔ Starting local server...
138138
[wrangler:inf] Ready on http://localhost:8787
139139
[wrangler:inf] GET / 200 OK (19ms)
@@ -156,7 +156,7 @@ Content-Transfer-Encoding: 7bit
156156
Congratulations, you just sent an email from a worker.
157157
```
158158

159-
## Replying to and forwarding messages
159+
## Reply to and forward messages
160160

161161
Likewise, [`EmailMessage`](/email-routing/email-workers/runtime-api/#emailmessage-definition)'s `forward()` and `reply()` methods are also simulated locally. Consider this Worker that receives an email, parses it, replies to the sender, and forwards the original message to one your verified recipient addresses:
162162

@@ -194,9 +194,9 @@ export default {
194194
};
195195
```
196196

197-
Run `npx wrangler dev` and use curl to POST the same message from the [Receiving an email](#receiving-an-email) example. Your terminal will show you where to find the replied message in your local disk and to whom the email was forwarded:
197+
Run `npx wrangler dev` and use curl to `POST` the same message from the [Receive an email](#receive-an-email) example. Your terminal will show you where to find the replied message in your local disk and to whom the email was forwarded:
198198

199-
```bash
199+
```txt
200200
⎔ Starting local server...
201201
[wrangler:inf] Ready on http://localhost:8787
202202
[wrangler:inf] Email handler replied to sender with the following message:

0 commit comments

Comments
 (0)