api.mail

Overview

Mailboxes on a domain you attached: real addresses that receive, and send signed with that domain's own key.

5 methodsthe plan decides how manya host must be enabled first
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

CallDoes
create({ address, name })Creates a mailbox.
list()Every mailbox of the account.
get(id)One, by identifier or by address.
usage()What the plan allows, before you try.
remove(id)Deletes it.
contactsThe address book.

The order

const domain = await api.domains.get("example.com");
await domain.mail.enable();                       // 1. the host's records

const box = await api.mail.create({ address: "hello@example.com", name: "Hello" });
await box.send({ to: "someone@example.net", subject: "Hi", text: "…" });
domain = api.domains.get("example.com")
domain.mail.enable()                       # 1. the host's records

box = api.mail.create(address="hello@example.com", name="Hello")
box.send(to=["someone@example.net"], subject="Hi", text="…")

A mailbox cannot exist on a host that has not been enabled: the creation answers mail_not_enabled, naming the host that is missing.

Read the plan before you try

maxMailboxes: 0 means the plan has no mail at all

Read it from usage() rather than testing the plan's name — the day the plans change, it is the page that lies. A zero is a limit to show, not a dead end to discover.

Some names are reserved

The addresses a domain is expected to answer for are not available as ordinary mailboxes — they are answered for, and letting anyone take one would break that.

A mailbox has no quota of its own

It consumes the account's object storage, and quotaBytes is that quota. Past it, delivery is refused — except the copy of something you sent, which describes a message already gone.