Skip to main content

API client for creating temporary email addresses to use in your E2E tests with Playwright, Cypress, and other frameworks.

Project description

Tigrmail Logo

Website | API Docs | Demo

Tigrmail SDK

Tigrmail SDK is a Python library for automating email verification workflows. It allows you to generate temporary inboxes and poll for email messages with customizable filters. This library is ideal for testing email-based features or automating email verification processes.

If you are working in a different programming language, you can still access all features by integrating directly with our API.

Features

  • Generate temporary inboxes.
  • Poll for the next email message with advanced filtering options (e.g., by subject, sender email, or domain).
  • Built-in error handling for API interactions.
  • Automatic retry logic for HTTP requests.

Installation

pip install tigrmail

Usage

Importing the Library

from tigrmail import Tigrmail, TigrmailError

Creating an Instance

To use the library, retrieve your API token from our console and create a Tigrmail instance using that token:

tigrmail = Tigrmail(token="your-api-token")

Generating a Temporary Inbox

email_address = tigrmail.create_email_address()
print(email_address)  # <random-email-address>@den.tigrmail.com

Polling for the Next Email Message

You can poll for the next email message using filters:

message = tigrmail.poll_next_message(
    inbox=email_address,
    subject={"contains": "Verification"},
    from_={"email": "noreply@example.com"},
)

print(f"Received email: {message['subject']}")

Playwright Integration Example

For a complete example of using Tigrmail SDK with Playwright for automated email verification testing, check out our Playwright Email Verification Example.

Context Manager Usage

The library supports Python's context manager protocol for automatic resource cleanup:

from tigrmail import Tigrmail, TigrmailError

try:
    with Tigrmail(token="your-api-token") as tigrmail:
        inbox = tigrmail.create_email_address()
        message = tigrmail.poll_next_message(
            inbox=inbox,
            subject={"contains": "Verification"},
            from_={"email": "noreply@example.com"},
        )
        print(message["subject"])
except TigrmailError as error:
    print(f"Error: {error.general_message}")

API Reference

Tigrmail.create_email_address() -> str

Generates a temporary email address.

Tigrmail.poll_next_message(inbox, subject=None, from_=None) -> dict

Polls for the next email message with optional filters:

  • inbox (str): The email address to poll for messages
  • subject (dict, optional): Filter by subject line
    • {"contains": str} - Subject contains the specified string
    • {"equals": str} - Subject exactly matches the specified string
  • from_ (dict, optional): Filter by sender
    • {"email": str} - From a specific email address
    • {"domain": str} - From any address at the specified domain

Returns an EmailMessage dictionary with message details.

Error Handling

The library raises TigrmailError for API-related issues. You can catch and handle these errors as follows:

try:
    inbox = tigrmail.create_email_address()
except TigrmailError as error:
    print(f"Error: {error.general_message}")
except Exception as error:
    print(f"Unexpected error: {error}")

Technical Details

  • Base URL: https://api.tigrmail.com
  • Timeout: 180s
  • Retries: 3 (exponential backoff) on all HTTP/transport errors
  • Uses httpx under the hood with simple retry logic

License

This project is licensed under the MIT License.

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

tigrmail-0.4.1.tar.gz (45.5 kB view details)

Uploaded Source

Built Distribution

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

tigrmail-0.4.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file tigrmail-0.4.1.tar.gz.

File metadata

  • Download URL: tigrmail-0.4.1.tar.gz
  • Upload date:
  • Size: 45.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for tigrmail-0.4.1.tar.gz
Algorithm Hash digest
SHA256 e13b20c920a2a40f43cd3802ea32334eb30c6f492a09064c2a4f6eed8556e825
MD5 13f96d24d8dbd7bbcafb30253fb9307d
BLAKE2b-256 d4bf94f63e474f194f11f731ceb5975a5ad6b03c9f3c375b9432d39278e2a3a4

See more details on using hashes here.

File details

Details for the file tigrmail-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: tigrmail-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for tigrmail-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 663fb3617d67d63c49894aa3b67b41273f0ef964052d5219745605476b8be6c8
MD5 fac7e8d2ed10f5016c5b6c1f3bfec7a7
BLAKE2b-256 4ebecf8b822fe5c1779dda76bead12cc926ed7f52261469b9fe29b699d8d2ad4

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