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}
update_alias_display_name(id, display_name) PATCH /api/aliases/{id}/display-name
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.2.tar.gz (5.3 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.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: emailalias-1.0.2.tar.gz
  • Upload date:
  • Size: 5.3 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.2.tar.gz
Algorithm Hash digest
SHA256 0d6d13351ec059709daaa3f9bd233de7c973069425abc888467315577d8f8218
MD5 a42d16bfb8e614ff345ff902b9f36a3a
BLAKE2b-256 82e89c8dcff52c94fdab91476cf32da8439f46011b748d243d19ead497c62b48

See more details on using hashes here.

Provenance

The following attestation bundles were made for emailalias-1.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: emailalias-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92dffe2faaaa1b0f8d8b6e7287dd3a7679f2de087e92af83de294036cf7e8f06
MD5 c22a9a6d8aa9e304818c6f47cd61c31d
BLAKE2b-256 ef244877fba00ef6d78b84efd863508386dc23eb4036619cb5f0142e336a7a2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for emailalias-1.0.2-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