Managing email accounts over the API
Types of mailboxes
In our API, we differentiate between two types of mailboxes:
- E-Mail adresses are used to send and receive emails. They are either associated with a mailbox (that you can connect to using an email client) or with a forwarding address (that forwards all incoming emails to one or more other email addresses).
- Delivery boxes are used to send emails. They are used to send emails from a web application or a script.
Requirements
To manage email accounts, you will need an existing project. You can create a new project using the Creating a project guide.
Create a new email account
To create a new email account, send a POST
request to the /v2/projects/{projectID}/mailaddresses
endpoint. The request body must contain a JSON object with the following properties:
address required | string <email> |
isCatchAll required | boolean |
required | object |
{- "address": "user@example.com",
- "isCatchAll": true,
- "mailbox": {
- "enableSpamProtection": true,
- "password": "string",
- "quotaInBytes": -1
}
}
Take note of the password you set for the email account. You will not be able to retrieve it later.
mail-mailaddress-create
Create a new forwarding address
A forwarding address is an email address that forwards all incoming emails to one or more other email addresses. To create a new forwarding address, send a POST
request to the /v2/projects/{projectID}/mailaddresses
endpoint. The request body must contain a JSON object with the following properties:
address required | string <email> |
forwardAddresses required | Array of strings <email> |
{- "address": "user@example.com",
- "forwardAddresses": [
- "user@example.com"
]
}
Create a new delivery box
A delivery box is an email address that can be used to send emails from a web application or a script. To create a new delivery box, send a POST
request to the /v2/projects/{projectID}/deliveryboxes
endpoint. The request body must contain a JSON object with the following properties:
description
(string, required): A description for the delivery box. This description will be displayed in the web interface.password
(string, required): The password for the delivery box. This password will be used to authenticate against the SMTP server.
Take note of the password you set for the delivery box. You will not be able to retrieve it later.
mail-deliverybox-create
Deleting email accounts
To delete an email address or a delivery box, send a DELETE
request to the /v2/mailaddresses/{id}
or /v2/deliveryboxes/{id}
endpoint, respectively. The id
parameter must contain the ID of the email address or delivery box you want to delete. No request body is needed.