Skip to content

kumo.api.inject.inject_v1(request)

Since: Dev Builds Only

The functionality described in this section requires a dev build of KumoMTA. You can obtain a dev build by following the instructions in the Installation section.

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)