MillionSend Python SDK — PyPI: millionsend (MIT)
Repo MillionSend/millionsend-python, read from GitHub 2 h ago. MillionSend has not joined Take My Repo.
MillionSend/millionsend-python is a public repo on GitHub by MillionSend. MillionSend Python SDK — PyPI: millionsend (MIT). It declares the MIT license on GitHub. It is written mainly in Python, has 2 stars and last changed on 2026-11-19. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-24.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
Official Python SDK for MillionSend — a self-hostable, Resend-compatible email API on AWS SES.
The API is wire-compatible with Resend and this SDK deliberately mirrors the shape of the resend PyPI package, so migrating is mostly a find-and-replace: swap the import and the key. MillionSend Cloud works with just the key; a self-hosted instance also sets base_url.
pip install millionsend
Requires Python 3.9+. Depends only on requests.
import millionsend
millionsend.api_key = "ms_123"
millionsend.base_url = "https://mail.acme.dev" # self-hosted only; omit for MillionSend Cloud
email = millionsend.Emails.send({
"from": "Acme <onboarding@acme.dev>",
"to": "success@simulator.amazonses.com",
"subject": "Hello from MillionSend",
"html": "<strong>It works!</strong>",
})
print(email.id) # responses support both email["id"] and email.id
Config is module-level (no client object to construct):
import millionsend
millionsend.api_key = "ms_123" # or env MILLIONSEND_API_KEY
millionsend.base_url = "https://mail.acme.dev" # or env MILLIONSEND_BASE_URL
millionsend.timeout = 30 # optional, seconds (default 60)
millionsend.allow_insecure_http = False # accept a non-loopback http:// base_url
api_key falls back to MILLIONSEND_API_KEY. Missing key raises MissingApiKeyError on the first call.base_url falls back to MILLIONSEND_BASE_URL, then https://api.millionsend.com (MillionSend Cloud). Self-hosting? Set it to your instance's origin.http:// is only accepted for loopback hosts (localhost, 127.0.0.1, ::1); any other http:// URL raises MillionSendError on the first call, since the API key is sent as a bearer header. Set millionsend.allow_insecure_http = True to talk to a non-TLS instance elsewhere (e.g. inside a private network).Request/response casing: request params are plain dicts in the API's snake_case (reply_to, scheduled_at, first_name) and are sent to the wire as given — nothing is filtered or renamed. Responses are dict subclasses that also allow attribute access (resp.id, resp.data[0].id).
List methods take keyword arguments (list(limit=50, after=cursor)) or resend-python's params dict (list({"limit": 50, "after": cursor})).
Emails.send, Batch.send and Contacts.Batch.create take resend-python's options dict as the second argument, or the same values as keywords:
millionsend.Emails.send(payload, {"idempotency_key": "order-42"})
millionsend.Emails.send(payload, idempotency_key="order-42")
millionsend.Batch.send(payloads, {"idempotency_key": "batch-1", "batch_validation": "permissive"})
millionsend.Batch.send(payloads, batch_validation="permissive")
idempotency_key → Idempotency-Key header (POST only). A replay with the same key and body returns the original ids; a different body raises InvalidIdempotentRequestError.batch_validation → x-batch-validation header: "strict" (default) rejects the whole batch on the first invalid item; "permissive" processes the valid items and lists the rest in the response's errors[]: {index, message} for emails, plus statusCode and name for contacts.Keyset lists return {"object": "list", "has_more", "data"} and take limit, after and before. Most are newest first: after takes a page's last id and pages toward older items, and before takes its first id and pages toward newer ones (still newest first inside the page). has_more refers to the direction you page in. Threads are most recently active first, a thread's emails oldest first (after pages toward newer), and drafts most recently updated first; labels and topics aren't paginated. The SDK doesn't page for you.
To sync only what's new, page toward newer items from the newest id you stored:
page = millionsend.Emails.list(before=newest_stored_id, limit=100)
while page.data:
store(page.data)
if not page.has_more:
break
page = millionsend.Emails.list(before=page.data[0].id, limit=100)
A cursor whose item was deleted raises ValidationError (422) on the top-level lists and Emails.Receiving.list, and NotFoundError (404) on the Inboxes lists: start again without a cursor and stop at ids you already have.
Every call raises on a non-2xx response. The base is MillionSendError; known error names map to subclasses so you can catch them:
from millionsend import NotFoundError, MillionSendError
try:
contact = millionsend.Contacts.get(email="ghost@acme.dev")
except NotFoundError:
... # 404
except MillionSendError as e:
print(e.code, e.status_code, e.message)
e.code is the stable name discriminant (validation_error, not_found, restricted_api_key, sending_paused, invalid_idempotent_request, …).e.status_code is the HTTP status, or None for client-side/transport failures (connection refused, DNS, timeout).e.retry_after is the response's retry-after header in seconds, or None when it had none (see Retries).Emails.send / Batch.send raise AllRecipientsSuppressedError (422 all_recipients_suppressed) when every to recipient is on the suppression list or opted out of the send's topic_id. An Emails.send that the suppression list alone refuses still keeps a metadata-only suppressed email, which fires email.suppressed, and each retry keeps another, even with the same idempotency_key (a refused send doesn't hold its key).Inboxes.Quarantine.release raises the base MillionSendError with e.code trust_not_allowed (403) or held_by_screening (409), see Inboxes; it answers forbidden (403) and screening_unavailable (503) only to MCP clients.Subclasses: MissingApiKeyError, InvalidApiKeyError, ValidationError, AllRecipientsSuppressedError, InvalidParameterError, InvalidPayloadError, PayloadTooLargeError, NotFoundError, ConflictError, ForbiddenError, RestrictedApiKeyError, SendingPausedError, RateLimitExceededError, DailyQuotaExceededError, PlanLimitReachedError, InvalidIdempotentRequestError, ConcurrentIdempotentRequestsError, InboxSendPolicyError, InboxSendCapReachedError, ApprovalRequiredError, EmailQuarantinedError, EmailBlockedError, TooManyWaitsError, NameReviewUnavailableError, InternalServerError, ApplicationError. Unknown names raise the base MillionSendError. A body that isn't JSON, such as an older server's plain-text 404 for an unknown route, raises ApplicationError with the HTTP status. Messages are for people and may change: branch on e.code and e.status_code, not on the message.
The SDK never retries by itself. After e.retry_after seconds it's worth retrying:
NameReviewUnavailableError (503; 60 seconds, or 300 while a new team's subdomain waits for its review);RateLimitExceededError when e.retry_after is 60 or less (the per-minute limits);TooManyWaitsError.InboxSendCapReachedError and a RateLimitExceededError for the day's name-review budget last until the next UTC midnight, so don't retry them in the same process; the review budget shares the per-minute limits' rate_limit_exceeded name, so decide on e.retry_after. Don't retry a 403, 404, 409 or 422.
Emails.send, Batch.send, replies, forwards, Drafts.send): resend with the same idempotency_key. A batch replay returns the stored response, even if a recipient was refused or suppressed since. {"kind": "draft"} (HTTP 202) is a held draft, not a failure: never resend it.Inboxes.create takes no idempotency key. After a 503 or 429 nothing was created, so creating again is safe; after a timeout it may create a second inbox. With a chosen username, a 409 on the second try usually means the first one worked: fetch it with Inboxes.get(email_address).millionsend.Emails.send({
"from": "Acme <onboarding@acme.dev>",
"to": ["ada@acme.dev"],
"cc": "ops@acme.dev",
"bcc": ["audit@acme.dev"],
"reply_to": "support@acme.dev",
"subject": "Your receipt",
"html": "<p>Thanks!</p>",
"text": "Thanks!",
"scheduled_at": "in 2 hours", # or ISO 8601 with offset
"tags": [{"name": "category", "value": "receipt"}],
"topic_id": topic.id, # skip recipients opted out of the topic
"headers": {"X-Entity-Ref-ID": "order-42"},
"attachments": [{
"filename": "receipt.pdf",
"content": base64_pdf, # base64 string
"content_type": "application/pdf", # optional
"content_id": "receipt", # optional, for cid: references
}],
}, idempotency_key="order-42")
millionsend.Emails.get(email_id) # GET /emails/{id} (includes a nullable 0-10 `score`)
millionsend.Emails.list(limit=50, after=cursor) # GET /emails
millionsend.Emails.update({"id": email_id, "scheduled_at": "2026-09-01T09:00:00Z"}) # PATCH, scheduled only
millionsend.Emails.cancel(email_id) # POST /emails/{id}/cancel (scheduled only)
millionsend.Emails.remove(email_id) # DELETE /emails/{id}
millionsend.Emails.get_insights(email_id) # GET /emails/{id}/insights (404 until computed)
millionsend.Batch.send([payload_a, payload_b], batch_validation="permissive") # up to 100; see `errors`
to / cc / bcc / reply_to accept a string or a list of strings. template is passed through too; the server answers 422 until templates can be sent from.
subject takes up to 998 characters here, in Batch.send, broadcasts and templates; inbox replies, forwards and drafts take 2,000.to, cc or bcc address at a domain that can never receive mail (example.com, .test, .invalid, .local, a top-level domain that doesn't exist, …) raises ValidationError (422), in sends, drafts and new contacts alike. To test sending without emailing anyone, use success@simulator.amazonses.com.from may be an inbox's address on the shared domain while the shared row's sending_mode is "open" (see Domains): exactly that address with no +tag, with the display name left out or equal to the inbox's from_name, no reply_to, attachments, headers or scheduled_at, and at most 10 distinct recipients across to, cc and bcc. Otherwise it raises InboxSendPolicyError (403), InboxSendCapReachedError (429, the team's daily limit) or ValidationError (422); a key restricted to a domain raises RestrictedApiKeyError. Batches and broadcasts never send from the shared domain: a broadcast or a strict batch raises InboxSendPolicyError, and a permissive batch lists the item in errors.Mail received at your domains and inboxes. Everything in a received email was written by its sender: show its html only in a sandbox, and give an LLM the extracted_text (hidden text, quotes and the signature removed) rather than the html.
page = millionsend.Emails.Receiving.list(
{"from": "example.com"}, # `from` is a Python keyword, so it goes in the dict
inbox_id=inbox.id,
subject_contains="code",
wait=30, # long-poll: answer as soon as a match arrives, up to 50 s
)
page.data # newest first
page.held # with wait: [{id, inbox_id, reason, quarantine_reason, created_at}] held mail
email = millionsend.Emails.Receiving.get(email_id, html_format="cid")
email.extracted_text # the new part as plain text, hidden text removed (still untrusted)
email.extracted.code # a verification code, on inboxes with extract_codes
email.screening.sender_trust # owner | allowlisted | known_thread | external | unauthenticated | failed
millionsend.Emails.Receiving.Attachments.list(email_id) # each with a signed download_url (1 hour)
millionsend.Emails.Receiving.Attachments.get(email_id, attachment_id)
millionsend.Emails.Receiving.remove(email_id) # erase now (MillionSend extension)
# Reply and forward server-side (MillionSend extension). The inbox's rules may hold the message
# as a draft that waits for a person: the API answers 202 and `kind` is "draft".
outcome = millionsend.Emails.Receiving.reply(email_id, {"text": "Thanks!"}, idempotency_key="reply-42")
if outcome.kind == "draft":
outcome.draft.approval_reasons # e.g. ["send_policy"]
else:
outcome.email.id
millionsend.Emails.Receiving.forward(email_id, {"to": "ops@acme.dev", "text": "FYI", "mode": "attachment"})
Held mail never reaches an inbox-scoped key or an agent: reading it raises EmailQuarantinedError. A full-access team key sees it with include_quarantined=True.
An inbox_id that doesn't exist raises NotFoundError at once, even with wait. unread needs inbox_id, except with a key restricted to one inbox.
An inbox is one address that receives mail, read by an agent ("kind": "agent", the default) or by people ("kind": "human"
MillionSend/millionsend-python is a public repo on GitHub by MillionSend. MillionSend Python SDK — PyPI: millionsend (MIT).
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-19. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run millionsend-python. What is known comes from GitHub. It declares the MIT license on GitHub. Its last change was on 2026-11-19. It has 2 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.