Skip to content

Commit e6be21a

Browse files
committed
chore: update readme
1 parent 6487f11 commit e6be21a

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,44 @@ params: resend.Emails.SendParams = {
5555
email: resend.Email = resend.Emails.send(params)
5656
print(email)
5757
```
58+
59+
## Async Support
60+
61+
The SDK supports async operations for improved performance in async applications. To use async features, you need to install the async dependencies:
62+
63+
```bash
64+
pip install resend[async]
65+
```
66+
67+
### Async Example
68+
69+
```py
70+
import asyncio
71+
import os
72+
import resend
73+
74+
resend.api_key = "re_yourkey"
75+
# Set up async HTTP client
76+
resend.default_http_client = resend.HTTPXClient()
77+
78+
async def main():
79+
params: resend.Emails.SendParams = {
80+
"from": "onboarding@resend.dev",
81+
"to": ["delivered@resend.dev"],
82+
"subject": "hi",
83+
"html": "<strong>hello, world!</strong>",
84+
"reply_to": "to@gmail.com",
85+
"bcc": "bcc@resend.dev",
86+
"cc": ["cc@resend.dev"],
87+
"tags": [
88+
{"name": "tag1", "value": "tagvalue1"},
89+
{"name": "tag2", "value": "tagvalue2"},
90+
],
91+
}
92+
93+
email: resend.Email = await resend.Emails.send_async(params)
94+
print(email)
95+
96+
if __name__ == "__main__":
97+
asyncio.run(main())
98+
```

0 commit comments

Comments
 (0)