PyResend 📧
A lightweight, zero-dependency Python SDK for the Resend Email API.
⚡ Features
- 🚀 Zero External Dependencies: Built entirely on standard Python library (
urllib,json,base64). - 🛡️ Cloudflare Bot Protection Bypass: Automatic custom
User-Agenthandling preventing Cloudflare 1010 blocks. - ✉️ Full Email API Support: Send HTML/Text emails, attachments, CC, BCC, tags, and scheduled emails.
- 📎 Automatic Attachment Base64 Encoding: Automatically reads file paths or raw bytes and encodes them to base64.
- 🌐 Domains & API Keys API: Manage domains and API keys via Python methods.
- 💻 Built-in CLI Tool: Send emails directly from terminal.
📦 Installation
Option 1: Via PyPI
pip install pyresend
Option 2: Directly from GitHub
pip install git+https://github.com/nguyenquocanhz/pyresend.git
🚀 Quick Start Examples
1. Send HTML Email
from pyresend import Resend
# Pass your API key or set RESEND_API_KEY environment variable
resend = Resend(api_key="re_JQ6uJLyg_5oUMtDYUn31v7sTPU2gHSNxi")
r = resend.send_email(
from_email="Acme <onboarding@resend.dev>",
to="delivered@resend.dev",
subject="Hello World from PyResend!",
html="<h1>It works!</h1><p>Sent using PyResend SDK.</p>"
)
print("Email sent successfully! ID:", r["id"])
2. Send Marketing Email with Templates
pyresend comes with built-in, responsive HTML email marketing templates (welcome, promotional, newsletter):
from pyresend import Resend, templates
resend = Resend(api_key="re_JQ6uJLyg_5oUMtDYUn31v7sTPU2gHSNxi")
# 1. Promotional Email with Discount Code
promo_html = templates.promotional(
title="Siêu Ưu Đãi Mùa Hè 2026",
discount_code="SUMMER2026",
discount_text="Giảm ngay 30% cho đơn hàng đầu tiên",
description="Nhận ưu đãi độc quyền từ hệ thống dịch vụ của chúng tôi.",
button_text="Mua Ngay Với Mã Giảm Giá",
button_url="https://resend.com",
brand_name="MyBrand"
)
resend.send_email(
from_email="Acme <onboarding@resend.dev>",
to="delivered@resend.dev",
subject="🎁 Siêu Ưu Đãi: Mã Giảm Giá SUMMER2026!",
html=promo_html
)
# 2. Welcome Email for New Users
welcome_html = templates.welcome(
name="Nguyễn Văn A",
title="Chào mừng bạn đến với hệ thống!",
button_text="Truy cập Trang cá nhân",
button_url="https://resend.com",
brand_name="MyBrand"
)
3. CLI Usage
pyresend send \
--api-key "re_JQ6uJLyg_5oUMtDYUn31v7sTPU2gHSNxi" \
--from "Acme <onboarding@resend.dev>" \
--to "delivered@resend.dev" \
--subject "Test from CLI" \
--html "<h1>Hello from PyResend CLI!</h1>"
📄 License
Distributed under the MIT License. See LICENSE for details.
Metadata
Release files for pyresend 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyresend-1.1.0.tar.gz | 10.6 kB | Without provenance | Details for pyresend-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyresend-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyresend-1.1.0-py3-none-any.whl |
Total release size: 21.3 kB
Release files / pyresend-1.1.0.tar.gz
| Download URL | pyresend-1.1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbc2bfe1bdeda6b4923da10a2b334409c586c16b68acc707fedcc9ffb5883317
|
|
BLAKE2b-256 checksum How to use checksums |
b1cf21d85c04003d6011ebe22dd4ea48eeea958dcb6b494b0944d2837a80ce2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / pyresend-1.1.0-py3-none-any.whl
| Download URL | pyresend-1.1.0-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
624786889208428890853425c7fe9b6c648e72d4f63b02b6ca995cd95475f2ee
|
|
BLAKE2b-256 checksum How to use checksums |
4866656b7b7b9e793cec3d08939dd77e4bca2b2e23068e2fa8829aa0f35e9035
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Security for pyresend 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.