Skip to content

kumo.api.inject.inject_v1(request)

Since: Version 2024.06.10-84e84b89

The functionality described in this section requires version 2024.06.10-84e84b89 of KumoMTA, or a more recent version.

This is a Lua entrypoint that calls into the HTTP injection API. 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 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:

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)