api.mail

usage()

api.mail.usage() → Promise<Usage>

What the plan gives in mail, readable before anything is attempted — including the zero that means the plan has no mail at all.

freeread it, do not guessquota is the account's
Using Python?

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

const usage = await api.mail.usage();
// { pack, mailboxes, maxMailboxes, aliases, hosts, usedBytes, quotaBytes, extraMailboxCredits }

if (!usage.maxMailboxes) {
  // This plan has no mail service. Show the limit, with a link to the plans.
}
usage = api.mail.usage()
# {"pack", "mailboxes", "maxMailboxes", "aliases", "hosts", "usedBytes", "quotaBytes", "extraMailboxCredits"}

if not usage["maxMailboxes"]:
    pass  # This plan has no mail service. Show the limit, with a link to the plans.
packstring

Which plan.

mailboxes · maxMailboxesinteger

How many exist, and how many the plan allows.

aliasesinteger

How many alias addresses exist.

hostsinteger

How many hosts have mail enabled.

usedBytes · quotaBytesinteger

What mail holds, against the account's object storage.

extraMailboxCreditsinteger

What an additional mailbox is priced at.

Read the zero

Never test the plan's name

maxMailboxes: 0 is the signal that this plan has no mail — the same shape as maxHosts: 0 for hosting. A page that reads the number keeps working when the plans change; a page that matches on a plan's name lies that day.

The quota is not per mailbox

quotaBytes is the account's object storage, shared with files and with whatever hosts keep online. It is re-read each time — so a mailbox can become full because something else filled up.

What happens when it is full

Delivery is refused with a retry-later answer, so the sender's server tries again rather than giving up. The copy of a send is the exception: refusing it would lose the trace of a message already gone without freeing anything.

Showing it

const u = await api.mail.usage();

if (!u.maxMailboxes) return showPlanLimit();
if (u.mailboxes >= u.maxMailboxes) return showAtLimit(u.extraMailboxCredits);
return showCreateButton();
def mail_screen():
    u = api.mail.usage()
    if not u["maxMailboxes"]:
        return show_plan_limit()
    if u["mailboxes"] >= u["maxMailboxes"]:
        return show_at_limit(u["extraMailboxCredits"])
    return show_create_button()