Skip to main content

missioninbox

Official MissionInbox SDK for Python.

Install

pip install missioninbox

Requires Python 3.9 or newer.

Send a transactional email

import os
from missioninbox import MissionInbox

mi = MissionInbox(
    api_key=os.environ["MI_API_KEY"],
    base_url=os.environ["MI_API_URL"],  # provided by MissionInbox for your environment
)

result = mi.emails.send(
    from_="notifications@yourdomain.com",
    to="user@example.com",
    subject="Welcome",
    html="<p>Hi 👋</p>",
)

print("sent", result["id"])

from_ has a trailing underscore because from is a reserved keyword in Python. It maps to from on the wire.

The from_ address must be a registered sending identifier. Register one first:

mi.sending_identifiers.create(
    email_address="notifications@yourdomain.com",
    display_name="Acme Notifications",
)

Resources

The client exposes eight top-level resources:

Resource Purpose
mi.emails Send, look up status, fetch details, search
mi.email_queue Inspect / retry / cancel queued messages
mi.domains Register domains, verify DNS, push records, delete
mi.domains.redirects Set up URL redirects on a domain
mi.sending_identifiers Manage approved From: addresses
mi.projects Group domains into projects
mi.analytics Send activity overview and time-series graphs
mi.tasks Poll background tasks (bulk operations)
mi.health Unauthenticated liveness ping

Configuration

Argument Type Default Description
api_key str Required. Your MissionInbox product API key.
base_url str Required. The API URL for your environment.
timeout float 30.0 Per-request timeout in seconds.
max_retries int 2 Retries on 429 and 5xx (exponential backoff, honours Retry-After).
http_client httpx.Client new client Optional override for advanced transport control.

Errors

Every failure raises a subclass of MissionInboxError. Catch the specific class you care about:

from missioninbox import (
    AuthenticationError,
    UnregisteredSenderError,
    UnverifiedDomainError,
    SendLimitExceededError,
)

try:
    mi.emails.send(from_="...", to="...", subject="...", text="...")
except AuthenticationError:
    ...  # 401 — API key missing or invalid
except UnregisteredSenderError:
    ...  # 403 — `from` hasn't been registered
except UnverifiedDomainError:
    ...  # 403 — domain DNS not verified
except SendLimitExceededError:
    ...  # 403 — plan cap reached

Full hierarchy:

  • MissionInboxError — base
    • AuthenticationError (401)
    • PermissionError (403)
      • UnregisteredSenderError, UnverifiedDomainError, SubscriptionInactiveError, SendLimitExceededError, DomainBlacklistedError
    • ValidationError (400)
    • NotFoundError (404)
    • ConflictError (409)
    • SendError (422)
    • RateLimitError (429)
    • ServerError (5xx)
    • NetworkError (transport failure)

Bulk operations and tasks

Bulk endpoints dispatch a background task and return {"taskId": ..., "message": ...} immediately. Use tasks.wait_for() to block until the task finishes:

response = mi.domains.bulk_create(domains=[
    {"domainName": "acme.com"},
    {"domainName": "shop.acme.com"},
])

done = mi.tasks.wait_for(
    response["taskId"],
    poll_interval=3.0,
    timeout=5 * 60,
    on_progress=lambda t: print(f"{t['progress']}%"),
)

print(done["status"], done.get("result"))

Working with domains

domain = mi.domains.create(domain_name="acme.com")

verification = mi.domains.verify("acme.com")
if verification["fullyVerified"]:
    print("ready to send")

# If a DNS manager is connected:
mi.domains.push_dns("acme.com")

Analytics

overview = mi.analytics.get_overview()
print(overview["currentMonth"]["emailsSent"])

graph = mi.analytics.get_activity_graph(
    granularity="daily",
    start_date="2026-08-01T00:00:00Z",
    end_date="2026-08-31T23:59:59Z",
    counters=["outgoing", "bounces"],
)

Context manager

The client owns its underlying httpx.Client. Use it as a context manager to close it cleanly:

with MissionInbox(api_key=..., base_url=...) as mi:
    mi.emails.send(from_=..., to=..., subject=..., text=...)

Or call mi.close() explicitly.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

missioninbox-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

missioninbox-0.1.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file missioninbox-0.1.0.tar.gz.

File metadata

  • Download URL: missioninbox-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for missioninbox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 43194529bf09efa2b8cd3bcd78d635b0f956a3d031bb3a70627814798ab35adf
MD5 18f77507f0a6583555f49c3afe4a2c01
BLAKE2b-256 bba8d1341727fd8e1bbf391e148c0b2db5c3eef710b0a85a7eed7e386d80fb04

See more details on using hashes here.

Provenance

The following attestation bundles were made for missioninbox-0.1.0.tar.gz:

Publisher: python-publish.yml on MissionInbox/sdk

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

File details

Details for the file missioninbox-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: missioninbox-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for missioninbox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7646a97cccd3106b5170e8dc0b76683b14a35a97de031db97be0b765360a0af1
MD5 b243d75e9bcd59b9072b74a1bbd8868f
BLAKE2b-256 cd9c8fc257017d00a6d6b44d36d0d4a313e60fb9a073d9b5d20bfb06bfe64176

See more details on using hashes here.

Provenance

The following attestation bundles were made for missioninbox-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on MissionInbox/sdk

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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page