Hosting e-mail through the API: mailboxes, passwords, quotas, forwarders and the default address

E-mail·· 56 views· 4 min read

The short answer: the API manages the e-mail of the active hosting plans in your account: mailboxes, passwords, quotas, forwarders, autoresponders and the default address, and it shows the status of SPF, DKIM and DMARC. You read with email:read and change with email:write. Everything runs on the hosting given in {id}, which you find with GET /v1/services.

Mailboxes

Operation What it does
GET .../email/mailboxes Lists the mailboxes, with space used and quota.
POST .../email/mailboxes Creates a mailbox: address, password and, optionally, quota_mb.
PUT .../mailboxes/{address}/password Changes the password.
PUT .../mailboxes/{address}/quota Changes the quota.
DELETE .../mailboxes/{address} Deletes the mailbox and its messages. Needs the address in confirm.

curl https://api.mozout.com/v1/services/123/email/mailboxes -X POST \
-H "Authorization: Bearer $RLX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"address": "info@yourcompany.com", "password": "...", "quota_mb": 1024}'

The password must be 12 to 128 characters, with at least 3 kinds among lowercase, uppercase, digits and symbols, and without the account or mailbox name. The API never stores or returns it. The quota runs from 1 MB up to the plan's disk space; unlimited is not accepted. Server system names, such as _mainaccount, are not accepted.

For requests with a password, the Idempotency-Key has no effect: repeating the request runs it again. If the connection drops while changing a password, check before you retry.

Forwarders, autoresponders and the default address

What Operations Notes
Forwarders GET, POST, DELETE .../email/forwarders Only to e-mail addresses, never to programs. The list shows one domain at a time, in ?domain=; without it, the main one.
Autoresponders GET, PUT, DELETE .../email/autoresponders PUT creates or replaces.
Default address GET and PUT .../email/default-address What happens to mail sent to addresses that do not exist.
SPF, DKIM and DMARC GET .../email/authentication Shows the status of the three records for a domain. To change them, use DNS.

For the default address, action can be fail (bounce), forward, discard or main_account (deliver to the hosting's main account). We recommend fail, to receive less spam.

The domain of the account e-mail

Whoever controls the e-mail used to sign in to the account can take the account over, because that is where password resets and sign-in codes arrive. So, on that e-mail's domain, and on the domain of each account user's e-mail, the API does not create, delete or change mailboxes, does not create or delete forwarders and does not change the default address. It answers 409 account_email_domain, in Sandbox too. Reads and autoresponders keep working. Make those changes in My MozOut.

Limits and what is not there yet

Changes are limited to 20 per minute, per hosting account, and passwords to 10 per minute. E-mail filters and the delivery log are handled in cPanel. A service that is not active answers 409, as with hosting.

A practical idea: when a new employee is added to your HR system, the same program creates their mailbox with a strong password and a sensible quota; when they leave, it changes the password and sets an autoresponder. SPF, DKIM and DMARC records are changed through the DNS API.

Want to create mailboxes from your own system? See the API page and test with a Sandbox key.

See the API page

SEE ALSO

Hosting through the API: subdomains, databases, cron jobs, SSL, PHP options and FTP

DNS through the API: adding, changing and deleting records, and restoring a zone backup

Idempotency-Key in our API: repeating a purchase, payment or ticket without doing it twice

API request limits: per key, per account and per task, the headers and what to do after a 429

API Sandbox or Production: what each key really does, and moving your program to production

Our API's error codes: what each one means, and which ones are worth retrying

RECOMMENDED PRODUCT

Professional e-mail on your domain

Mailboxes in your company name, no adverts, with spam filtering. from KSh858.00/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.