mirror of
https://github.com/KumoCorp/kumomta.git
synced 2026-09-11 08:01:14 +00:00
we now just have one section containing docs for the HTTP API, which makes things a bit easier to reason about.
34 lines
1001 B
Markdown
34 lines
1001 B
Markdown
# inject_v1
|
|
|
|
```lua
|
|
kumo.api.inject.inject_v1(request)
|
|
```
|
|
|
|
{{since('2024.06.10-84e84b89')}}
|
|
|
|
This is a Lua entrypoint that calls into the [HTTP injection
|
|
API](../http/kumod/api_inject_v1_post.md). The parameter is a request object with
|
|
precisely the same semantics as described in the HTTP injection API
|
|
documentation.
|
|
|
|
The request will appear to come from the IPv4 loopback address, even though
|
|
no HTTP request is actually involved in this call; it is plumbed through
|
|
the same underlying implementation.
|
|
|
|
Any messages generated by this function will trigger the
|
|
[http_message_generated](../events/http_message_generated.md) event as per the
|
|
HTTP injection API.
|
|
|
|
In this example, a copy of the current incoming SMTP message is taken and sent
|
|
to an archival service:
|
|
|
|
```lua
|
|
kumo.on('smtp_server_message_received', function(msg)
|
|
kumo.api.inject.inject_v1 {
|
|
envelope_sender = msg:sender().email,
|
|
content = msg:get_data(),
|
|
recipients = { { email = 'archive@example.com' } },
|
|
}
|
|
end)
|
|
```
|