Skip to main content

The official Python SDK for Orevail — the stateless transactional and temporary email network.

Project description

Orevail Python SDK

The official, zero-dependency Python library for interacting with the Orevail Developer Mail Network.

Orevail is a developer-first transactional and temporary email network. By designing routes on high-reputation domains and validating them with 2048-bit DKIM keys, Orevail allows you to test inbound mail parsing loops, run transactional flows, and mock sandbox accounts easily without getting flagged by spam-reputation checkers.


Key Features

  • Zero Dependencies: Built entirely on top of Python's standard urllib module. No need to install requests or other third-party dependencies.
  • Type-Hinted: Fully typed for modern Python editors (VS Code, PyCharm).
  • Resilient: Clean mapping of API error payloads to custom, descriptive exceptions (OrevailAuthError, OrevailAPIError).
  • Compatible: Tested and supported across all active Python versions (>= 3.7).

Installation

Install the package via pip:

pip install orevail

Quickstart Guide

1. Instant Mailbox Allocation

Create a virtual sandbox address on-the-fly. The API key is returned exactly once in this payload.

from orevail import Orevail

# Create a virtual user mailbox dynamically
reg_info = Orevail.create_user("test-runner@orevail.com")

print(f"Allocated Email: {reg_info['email']}")
print(f"Sandbox API Key: {reg_info['api_key']}")

2. Initializing the Authenticated Client

Once you have your sandbox API key, initialize the authenticated client:

from orevail import Orevail

client = Orevail(api_key="your_orevail_api_key_here")

3. Send Outbound Transactional Emails

Enqueue emails into Orevail's outbox. Outbound emails are cryptographically signed with DKIM on-the-fly and routed instantly.

# Send a transactional email
receipt = client.send_email(
    sender="test-runner@orevail.com",
    recipient="customer@example.com",
    subject="Your Verification Token",
    text="Your security token is: 884712",
    html="<p>Your security token is: <strong>884712</strong></p>"
)

print(f"Outbox Job Queued. Job ID: {receipt['jobId']}")

4. Fetch and Parse Inbox Mails

Check the sandbox mailbox to parse incoming emails (e.g. testing outbound alerts, registration loops, or parse triggers).

# Poll the incoming mail stream
inbox = client.get_emails("test-runner@orevail.com", direction="incoming", limit=10)

print(f"Retrieved {inbox['count']} messages:")
for mail in inbox["emails"]:
    print("-" * 40)
    print(f"From: {mail['sender']}")
    print(f"Subject: {mail['subject']}")
    print(f"Body: {mail['body_text']}")
    
    # Check for attachments
    if mail.get("attachments"):
        print(f"Attachments: {[att['filename'] for att in mail['attachments']]}")

5. Download Email Attachments

Fetch raw binary content files associated with an incoming email:

# If an attachment exists, download its raw content
attachment_bytes = client.download_attachment(attachment_id=12)

with open("downloaded_invoice.pdf", "wb") as f:
    f.write(attachment_bytes)

Exception Handling

Orevail wraps exceptions cleanly to help you debug quickly:

from orevail import Orevail, OrevailAuthError, OrevailAPIError, OrevailError

try:
    client = Orevail(api_key="invalid_key")
    client.get_emails("test-runner@orevail.com")
except OrevailAuthError as e:
    print(f"Credentials Rejected: {e}")
except OrevailAPIError as e:
    print(f"API Error [{e.status_code}]: {e}")
except OrevailError as e:
    print(f"General SDK failure: {e}")

License

MIT License. Created by the Orevail Core Team.

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

orevail-1.0.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orevail-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file orevail-1.0.0.tar.gz.

File metadata

  • Download URL: orevail-1.0.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for orevail-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2d97f68a452e4c8f6eed6a57bae4a911ef8af11ab865b9fa96b1a08d484ef5e8
MD5 b4f37f4a577edbbd12c9a55f89190c7a
BLAKE2b-256 56e269f9bf5766715e6d5fde3be3c3cc0478ec05341e65914babd0fcb5772ebe

See more details on using hashes here.

File details

Details for the file orevail-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: orevail-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for orevail-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74d34734fc2a5d891bbbfb132ecb55a651b4ee91cc3387eccdc993a5d70efcea
MD5 82533d54a88c93844d2c3fc0162ea205
BLAKE2b-256 0da81670170377ad3ca617b644239929055fb2448e3cc07d21a8a9f8133785f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page