const box = await api.mail.create({ address: "hello@example.com", name: "Hello" });
box.address; // "hello@example.com"
box.host; // "example.com"
box.local; // "hello"box = api.mail.create(address="hello@example.com", name="Hello")
box.address # "hello@example.com"
box.host # "example.com"
box.local # "hello"addressstringrequiredThe full address. Its host must be one where mail is enabled.
namestringThe display name.
The host must be enabled first
import { IaGenifyError } from "iagenify";
try {
await api.mail.create({ address: "hello@team.example.com" });
} catch (err) {
if (err instanceof IaGenifyError && err.code === "mail_not_enabled") {
await domain.mail.enable({ subdomain: "team" });
}
}from iagenify import IaGenifyError
try:
api.mail.create(address="hello@team.example.com")
except IaGenifyError as error:
if error.code != "mail_not_enabled":
raise
domain.mail.enable(subdomain="team")The refusal names the host that is missing, so the fix is one call away.
The caller does not choose the quota
It comes from the plan, and it is the account's object storage
A mailbox has no space of its own. quotaBytes is the account's, read fresh each time — which is why a mailbox gets fuller when a host deploys something or a storage fills up.
Errors
| Code | Status | When |
|---|---|---|
| mail_not_enabled | 403 | The host has no mail records yet. |
| mail_not_in_plan | 403 | The plan has no mail service. |
| address_taken | 409 | The address, or an alias of it, exists. |
| address_reserved | 400 | A name the domain is expected to answer for. |
What follows
update() for a picture and a signature, aliases.add() for other addresses that land here, forward() for copies elsewhere.