A lightweight, zero-dependency Python SDK for the Resend Email API (https://resend.com)
Project description
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 Email with Attachments
from pyresend import Resend
resend = Resend(api_key="re_JQ6uJLyg_5oUMtDYUn31v7sTPU2gHSNxi")
resend.send_email(
from_email="Acme <onboarding@resend.dev>",
to="delivered@resend.dev",
subject="Monthly Invoice",
html="<p>Please find your invoice attached.</p>",
attachments=[
{
"filename": "invoice.pdf",
"path": "./files/invoice.pdf" # Automatically encodes to Base64
}
]
)
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyresend-1.0.0.tar.gz
(7.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyresend-1.0.0.tar.gz.
File metadata
- Download URL: pyresend-1.0.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ae47569b495805fb77d0f4815aaa9763a2184f629b305d514b49ec1ae476b9b
|
|
| MD5 |
bcc25e401aea224dff77bd9c61fdb7cf
|
|
| BLAKE2b-256 |
4a9b5d16657ef4198479fcab241c58b031bc8746df999aa30bddf15da57409c5
|
File details
Details for the file pyresend-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyresend-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5feb0d4802942a9722a229fe1e079f8ffdd68dcabca7038d7e1835a132600353
|
|
| MD5 |
fdd13a1df546c81f8bc7c1ed75e6fc4b
|
|
| BLAKE2b-256 |
c15eeb006f45237b8a855f6905202a756034bbe44ea1678eb9a119dd500ebc6e
|