# create()

Canonical URL: https://developers.iagenify.com/pt/sdk/ref/mail/create/
Language: pt

`api.mail.create({ address, name }) → Promise<Mailbox>`

Crea un buxbox su un host habilitat. La quota viene del plan, mai del llamante.

Status: POST /api/mail · host must be enabled · quota from the plan

```javascript
const box = await api.mail.create({ address: "hello@example.com", name: "Hello" });

box.address;   // "hello@example.com"
box.host;      // "example.com"
box.local;     // "hello"
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `address` | string | obrigatório | L'indirizzo completo. Il suo host deve essere un onde il mail è activat. |
| `name` | string |  | Il nome display. |

## Il host deve essere activat prima {#host}

```javascript
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" });
  }
}
```

Il renegazione nomes l'host che manca, quindi la correzione è un appell a distant.

## Il chi lo chiama non scelse la quota {#quota}

> **Proveniente del plan, e è il stoccaggio de objetos del cont**
>
> Una caixa de postas non ha spazio per sé. quotaBytes è del conto, let fresca ogni volta — e è il motivo per cui una caixa de postas se riempie quando un host dispiega algo o un storage s'implena.

## Erros {#errors}

| Código | Status | Quando |
| --- | --- | --- |
| mail_not_enabled | 403 | Il host non ha ancora records mail. |
| mail_not_in_plan | 403 | Il plan non ha servizio postal. |
| address_taken | 409 | L'indirizzo, o un pseudonyme di esso, existe. |
| address_reserved | 400 | Un nome del dominius deve rispondere. |

## - O que segue {#then}

[update()](/pt/sdk/ref/mailbox/update) para una foto e una firma, [aliases.add()](/pt/sdk/ref/mailbox/aliases/add) para altre adresses que aterrescono aqui, [forward()](/pt/sdk/ref/mailbox/forward) para copias ailleurs.

- [mail.enable()](/pt/sdk/ref/domain/mail/enable): Agindo un host ante un buxboxe pode exister.
- [Box de posta](/pt/sdk/ref/mailbox): Ce porta un buxbox, e ce poti fare a lui.
- [usage()](/pt/sdk/ref/mail/usage): - Prima di checking.

```python
box = api.mail.create(address="hello@example.com", name="Hello")

box.address   # "hello@example.com"
box.host      # "example.com"
box.local     # "hello"
```

```python
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")
```
