Errors
The status codes and error messages of the REST API and what to do about them.
When a request fails, OpenMail answers with a status code and, in most cases, a JSON array that describes the problem.
Status codes
| Status | Body | Cause | What to do |
|---|---|---|---|
400 | [{"error":"Template not found"}] | No template has this id. | Check the profile and template identifiers, for example demo/welcome. |
400 | [{"name":"to","error":"The field \"to\" is invalid","path":"to"}] | to is missing. | Send a recipient. |
400 | [{"name":"cc","error":"The field \"cc\" is invalid","path":"cc"}] | cc, bcc or reply is not one valid email address. | Send one address per field. |
400 | [{"error":"550 5.1.0 REQUESTED ACTION NOT TAKEN: MAILBOX UNAVAILABLE"}] | The SMTP server refused the email. The text comes from the server. | Read the message; check the recipient and the SMTP settings. |
401 | An HTML error page | The token is missing or wrong, or your address is blocked. | Check the token. See below. |
401 | [{"name":"401","error":"401: Unauthorized"}] | The token may not list profiles. | Check Allow read list of profiles. |
431 | An HTML error page | The multipart request is bigger than about 1 MB. | Attach big files by URL. |
Blocked after wrong tokens
After six requests with a wrong or missing token, OpenMail answers 401 to every request from the same IP address, also with a valid token, for up to 15 minutes. Restarting OpenMail lifts the block.
Fix the token in your app, then wait or restart OpenMail.
Errors from the SMTP server
If the SMTP server refuses an email, OpenMail answers 400 with the error of the server, as in the table above, and shows it in red in the Error column of Logs. Use Test in the profile to check the connection. See Test emails.