Files
kumomta/docs/userguide/operation/httpinjection.md
T
Wez Furlong b5fb4bd1f9 docs: replace manual http docs with generated docs
we now just have one section containing docs for the HTTP API,
which makes things a bit easier to reason about.
2026-02-02 08:17:20 +00:00

48 lines
1.5 KiB
Markdown

# Injecting Using HTTP
KumoMTA will listen for message injection in any
[listener](../..//reference/kumo/start_esmtp_listener/index.md)
[defined](../../reference/kumo/start_http_listener/index.md) in
configuration. You have complete control over the IPs and Ports available for
message injection.
The HTTP Listener will accept any properly formatted HTTP connection request
allowed by its configuration. For instance, based on this:
```lua
kumo.start_http_listener {
use_tls = true,
listen = '0.0.0.0:8005',
-- allowed to access any http endpoint without additional auth
trusted_hosts = { '127.0.0.1', '::1' },
}
```
KumoMTA will accept any HTTPS injection on port 8005 from the local host ONLY.
(This also enables the full [HTTP API](../../reference/http/kumod/index.md) from
localhost).
The simplest test of [HTTP injection](../../reference/http/kumod/api_inject_v1_post.md)
can be done using cURL right from localhost console.
```console
$ curl -i 'http://localhost:8005/api/inject/v1' \
-H 'Content-Type: application/json' -d '
{"envelope_sender": "noreply@example.com",
"content": "Subject: hello\n\nHello there",
"recipients": [{"email": "recipient@example.com"}]
}'
```
That should return something like this:
```json
{"success_count":1,"fail_count":0,"failed_recipients":[],"errors":[]}
```
Any system that can use an HTTP API to pass JSON should work as an injection
system if you follow the JSON payload formatting rules posted
[here](../..//reference/http/kumod/api_inject_v1_post.md)