Skip to content

Python Client

The official Python SDK for VaultSandbox Gateway. It handles quantum-safe encryption automatically, letting you focus on testing email workflows.

  • Automatic Encryption: ML-KEM-768 key encapsulation + AES-256-GCM encryption handled transparently
  • Real-Time Delivery: SSE-based email delivery with smart polling fallback
  • Email Authentication: Built-in SPF/DKIM/DMARC validation helpers
  • Full Email Access: Decrypted content, headers, links, and attachments
  • Type Hints: Full type annotations with py.typed marker for IDE support
  • Python 3.10+
  • VaultSandbox Gateway server
  • Valid API key

The SDK connects to a VaultSandbox Gateway - a receive-only SMTP server you self-host. It handles email reception, authentication validation, and encryption. You can run one with Docker in minutes.

See Gateway Overview or jump to Quick Start to deploy one.

import asyncio
from vaultsandbox import VaultSandboxClient
async def main():
async with VaultSandboxClient(
base_url="https://gateway.example.com",
api_key="your-api-key",
) as client:
# Create inbox (keypair generated automatically)
inbox = await client.create_inbox()
# Send email to inbox.email_address from your application...
# Wait for email
email = await inbox.wait_for_email()
print(f"Subject: {email.subject}")
print(f"Text: {email.text}")
# Cleanup
await inbox.delete()
asyncio.run(main())