Python client for the ZeptoMail API
Project description
📧 ZeptoMail Python API
A Python client for interacting with the ZeptoMail API.
⚠️ DISCLAIMER: This is an unofficial SDK. Namilink Kft is not affiliated with ZeptoMail or Zoho Corporation. This package is maintained independently and is not endorsed by ZeptoMail.
⚡ Installation
pip install zeptomail-python-api
Or with uv:
uv pip install zeptomail-python-api
🚀 Usage
Basic Email Sending
from zeptomail import ZeptoMail
# Initialize the client
client = ZeptoMail("your-api-key-here")
# Create a recipient
recipient = client.add_recipient("recipient@example.com", "Recipient Name")
# Send a simple email
response = client.send_email(
from_address="sender@example.com",
from_name="Sender Name",
to=[recipient],
subject="Test Email from ZeptoMail Python API",
html_body="<h1>Hello World!</h1><p>This is a test email sent using the ZeptoMail Python API.</p>",
text_body="Hello World! This is a test email sent using the ZeptoMail Python API."
)
print(f"Response: {response}")
Sending Emails with Attachments
import base64
# Add an attachment from file content
with open("document.pdf", "rb") as f:
file_content = base64.b64encode(f.read()).decode('utf-8')
attachment = client.add_attachment_from_content(
content=file_content,
mime_type="application/pdf",
name="document.pdf"
)
# Or add an attachment from a ZeptoMail file cache key
cached_attachment = client.add_attachment_from_file_cache(
file_cache_key="your-file-cache-key",
name="cached-document.pdf"
)
# Send email with attachments
response = client.send_email(
from_address="sender@example.com",
from_name="Sender Name",
to=[recipient],
subject="Email with Attachments",
html_body="<p>Please find the attached documents.</p>",
attachments=[attachment, cached_attachment]
)
Sending Batch Emails with Personalization
# Create batch recipients with personalization
recipient1 = client.add_batch_recipient(
email="user1@example.com",
name="User One",
merge_info={"first_name": "User", "last_name": "One", "id": "12345"}
)
recipient2 = client.add_batch_recipient(
email="user2@example.com",
name="User Two",
merge_info={"first_name": "User", "last_name": "Two", "id": "67890"}
)
# Send batch email with personalization
response = client.send_batch_email(
from_address="sender@example.com",
from_name="Sender Name",
to=[recipient1, recipient2],
subject="Hello {{first_name}}!",
html_body="<p>Hi {{first_name}} {{last_name}},</p><p>Your ID is: {{id}}</p>",
text_body="Hi {{first_name}} {{last_name}}, Your ID is: {{id}}",
)
Adding Inline Images
# Add an inline image
with open("logo.png", "rb") as f:
image_content = base64.b64encode(f.read()).decode('utf-8')
inline_image = client.add_inline_image(
cid="logo", # This will be referenced in the HTML as <img src="cid:logo">
content=image_content,
mime_type="image/png"
)
# Send email with inline image
response = client.send_email(
from_address="sender@example.com",
from_name="Sender Name",
to=[recipient],
subject="Email with Inline Image",
html_body='<p>Here is our logo:</p><img src="cid:logo" alt="Logo">',
inline_images=[inline_image]
)
✨ Features
- 📨 Send single emails
- 📊 Send batch emails with personalization
- 📎 Add attachments and inline images
- 🖼️ Support for inline images with CID references
- 📈 Email tracking (opens and clicks)
- ⚙️ Customize MIME headers
- 🔍 Detailed error handling with solutions
🚧 Implementation Status
This library currently implements:
- ✅ Email Sending API
- ✅ Batch Email Sending API
- ✅ Attachments and Inline Images
- ✅ Personalization with merge fields
Not yet implemented:
- ❌ Templates API
- ❌ Template Management API
Contributions to implement these additional APIs are welcome!
📝 License
MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
🔒 Security
For security issues, please email security@zeptomail.eu instead of using the issue tracker.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 zeptomail_python_api-0.1.3.tar.gz.
File metadata
- Download URL: zeptomail_python_api-0.1.3.tar.gz
- Upload date:
- Size: 859.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9f4b8fd5018338a2bfff4cf1a357134d4c3a2e93b73444a6d0f333e65aa61bc
|
|
| MD5 |
70226ce75e7b740724a4401d4c02f5c6
|
|
| BLAKE2b-256 |
81b3dc2fcc8d39ba2b15019d38ed168b70af0bbca4db853267ee4d84b9006877
|
File details
Details for the file zeptomail_python_api-0.1.3-py3-none-any.whl.
File metadata
- Download URL: zeptomail_python_api-0.1.3-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
040c8b74a1fa883ea6794e8eb3700f5da3c066ee4843d9e80a5f954388d45013
|
|
| MD5 |
ace4401a4eb372af94ebe2f708c6ca6e
|
|
| BLAKE2b-256 |
e4f3455ef49489e747e1a9694e23cd23b24e9a4d1a694cbd2c29aea7c7609c6b
|