updated README.md

pull/21/head
Niclas Thobaben 2022-02-15 13:37:47 +01:00
parent c082d5fb66
commit 1c83636c8e
1 changed files with 48 additions and 0 deletions

View File

@ -14,3 +14,51 @@ the request. The `RelayUser` contains all required information to forward an inc
to the expected target mail address.
Form Usage
-----------------------
The following HTML snippet shows the basic usage:
```html
<form action="https://api.nclazz.de/send" method="post">
<input type="hidden" name="token" value="3c1a04d16008a84c">
<input type="text" name="subject" placeholder="Subject">
<input type="email" name="from" placeholder="From">
<textarea name="content"></textarea>
<input type="submit" value="submit">
</form>
```
The following fields are available and be inserted into the form.
|Name |Type |Description |Restriction |
|-------------------|-----------|-------------------------------------------------------|-----------------------------------------------------------|
|`token` |`text` |The token of the Relays Account to use |**Mandatory**. Account must first be created |
|`subject` |`text` |The subject of the message to be send |**Mandatory**. Can be any string but must *not* be empty |
|`from` |`email` |The email of the form submitter |**Mandatory**. Must be a valid address by [RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322)|
|`content` |`text` |The content of the message. |**Mandatory**. Must *not* be empty |
|`onSuccess` |`url` |Redirects to this URL on success |Must be a valid URL |
|`onError` |`url` |Redirects to this URL on failure. Passes errors as query.|Must be a valid URL. |
Form Error Handling
-----------------------
The form will always return a success, no matter if the account exists or not. This is done to mitigate
reconnaissance activities. Errors on the submitted form on the other hand will be handled by a redirect
either to the referer set in `Referer` header or by providing `onError` url.
If an error occurs the affected properties will be set as query parameters with the type of validation
violation.
The affected properties can be `subject`, `from` or `content`.
The following error codes are available:
|Code |Description |
|---------------|-------------------------------------------------------|
|`NotBlank` |Property is mandatory and must be set |
|`Pattern` |Property is provided with an illegal format |