resend

Resend Python SDK

58 个版本 Python >=3.7
Derich Pacheco <carlosderich@gmail.com>
安装
pip install resend
poetry add resend
pipenv install resend
conda install resend
描述

Resend Python SDK

Build codecov PyPI PyPI - Python Version


Installation

To install Resend Python SDK, simply execute the following command in a terminal:

pip install resend

Setup

First, you need to get an API key, which is available in the Resend Dashboard.

import resend
import os

resend.api_key = "re_yourkey"

Example

You can get an overview about all parameters in the Send Email API reference.

import os
import resend

resend.api_key = "re_yourkey"

params: resend.Emails.SendParams = {
    "from": "onboarding@resend.dev",
    "to": ["delivered@resend.dev"],
    "subject": "hi",
    "html": "<strong>hello, world!</strong>",
    "reply_to": "to@gmail.com",
    "bcc": "bcc@resend.dev",
    "cc": ["cc@resend.dev"],
    "tags": [
        {"name": "tag1", "value": "tagvalue1"},
        {"name": "tag2", "value": "tagvalue2"},
    ],
}

email: resend.Emails.SendResponse = resend.Emails.send(params)
print(email)

Async Support

The SDK supports async operations via httpx. Install the async extra:

pip install resend[async]

Once installed, async methods (suffixed with _async) work automatically — no extra setup needed:

import asyncio
import resend

resend.api_key = "re_yourkey"

async def main():
    params: resend.Emails.SendParams = {
        "from": "onboarding@resend.dev",
        "to": ["delivered@resend.dev"],
        "subject": "hi",
        "html": "<strong>hello, world!</strong>",
    }

    email: resend.Emails.SendResponse = await resend.Emails.send_async(params)
    print(email)

if __name__ == "__main__":
    asyncio.run(main())

Custom async client

To use a custom async HTTP client or configure options like timeouts, set resend.default_async_http_client:

import resend

resend.api_key = "re_yourkey"
resend.default_async_http_client = resend.HTTPXClient(timeout=60)
版本列表
2.32.2 2026-06-17
2.32.1 2026-06-17
2.32.0 2026-06-17
2.31.0 2026-06-17
2.30.1 2026-05-13
2.30.0 2026-05-04
2.29.0 2026-04-16
2.28.1 2026-04-15
2.28.0 2026-04-13
2.28.0a1 2026-04-11
2.27.0 2026-04-01
2.26.0 2026-03-20
2.25.0 2026-03-18
2.24.0 2026-03-16
2.23.0 2026-02-23
2.22.0 2026-02-16
2.21.0 2026-01-22
2.19.0 2025-10-31
2.18.0 2025-10-29
2.18.0a3 2025-10-29
2.18.0a2 2025-10-28
2.18.0a1 2025-10-26
2.17.0 2025-10-14
2.16.0 2025-10-08
2.15.0 2025-09-24
2.14.0 2025-09-20
2.13.1 2025-08-26
2.13.0 2025-08-13
2.12.0 2025-08-06
2.11.0 2025-07-10
2.10.0 2025-05-15
2.9.0 2025-05-06
2.8.0 2025-04-27
2.7.0 2025-03-25
2.6.0 2025-01-23
2.5.1 2024-12-17
2.4.0 2024-08-14
2.3.0 2024-07-24
2.2.0 2024-07-05
2.1.0 2024-06-10
2.0.0 2024-05-27
1.2.0 2024-05-24
1.1.0 2024-05-17
1.0.2 2024-05-14
1.0.1 2024-05-09
1.0.0 2024-05-09
0.8.0 2024-03-06
0.7.2 2024-01-18
0.7.1 2024-01-15
0.7.0 2024-01-10
0.6.0 2023-10-21
0.5.2 2023-07-25
0.5.1 2023-06-14
0.4.0 2023-05-20
0.3.0 2023-05-02
0.2.0 2023-04-26
0.1.1 2023-04-19
0.1.0 2023-01-17