Skip to main content

Official Python client for the EmailAlias API.

Project description

emailalias-python

Official Python client for the EmailAlias.io REST API.

API access is a Premium feature. Generate a key from Settings → API Keys in the web dashboard.

Install

pip install emailalias

Or from source:

pip install git+https://github.com/emailalias/emailalias-python.git

Quick start

from emailalias import Client

client = Client(api_key="ea_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")

# Create an alias
alias = client.create_alias(alias_type="random", label="Shopping")
print(alias["alias_email"])   # e.g. "x7k9m@email91.com"

# List aliases
for a in client.list_aliases():
    print(a["alias_email"], "→", a["destination_email"])

# Forward to a verified additional destination
alias = client.create_alias(
    alias_type="custom",
    custom_code="work-signup",
    label="Work",
    destination_email="work@mycompany.com",  # must be verified on your account first
)

# Send email from an alias
client.send_email(
    alias_id=alias["id"],
    to_email="recipient@example.com",
    subject="Hello",
    body="Sent from my alias.",
)

# Disable an alias
client.update_alias(alias_id=alias["id"], active=False)

Error handling

from emailalias import Client, AuthenticationError, RateLimitError

client = Client(api_key="ea_live_xxx")
try:
    client.list_aliases()
except AuthenticationError:
    # Invalid key, or account is no longer Premium
    ...
except RateLimitError:
    # Respect X-RateLimit-Reset and retry
    ...

Configuration

client = Client(
    api_key="ea_live_xxx",
    base_url="https://emailalias.io",  # override for staging/self-host
    timeout=30.0,
)

Available methods

Method Endpoint
list_aliases() GET /api/aliases
create_alias(...) POST /api/aliases
update_alias(id, active=, label=) PATCH /api/aliases/{id}
delete_alias(id) DELETE /api/aliases/{id}
list_available_domains() GET /api/aliases/domains
list_destinations() GET /api/destinations
add_destination(email) POST /api/destinations
resend_destination_verification(id) POST /api/destinations/{id}/resend
delete_destination(id) DELETE /api/destinations/{id}
send_email(alias_id, to_email, subject, body, html_body=) POST /api/send-email
list_domains() GET /api/domains
add_domain(name) POST /api/domains
verify_domain(id) POST /api/domains/{id}/verify
delete_domain(id) DELETE /api/domains/{id}
get_dashboard_stats() GET /api/analytics/dashboard
list_logs(page=, per_page=) GET /api/analytics/logs
list_exposure_events(page=, per_page=) GET /api/analytics/exposure

Full API reference: https://emailalias.io/documentation

License

MIT

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

emailalias-1.0.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

emailalias-1.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file emailalias-1.0.1.tar.gz.

File metadata

  • Download URL: emailalias-1.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for emailalias-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8bb40bad64f06737bd7f13a2b119848b052680a9aeaac2f130cfb49d5ae09a06
MD5 80732892efbca2f9892744e4707e258b
BLAKE2b-256 41439952823e0a3d61d81bc7f4eb3e6737b8a21204520009043e7d667326cdb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for emailalias-1.0.1.tar.gz:

Publisher: publish.yml on emailalias/emailalias-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file emailalias-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: emailalias-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for emailalias-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3844aca6994e5496e4ce970327892f1a61570ab7aae66bc54e05086188a708ba
MD5 dfd1a272f15125c4ea1242ec5c9ceca2
BLAKE2b-256 75ca6c217b82d109a5189172f8e2ca48887575554f1bd1d71513a2d413bc74a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for emailalias-1.0.1-py3-none-any.whl:

Publisher: publish.yml on emailalias/emailalias-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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