x-header data not visible

Hello, trying out kumoMTA, currently we got it set up so we can send (limited) emails.
We were looking further into the x-headers and how to add them, but we can’t see them inside the ‘http_message_generated’ event
I can add them manually with msg:add_header, it’s also configured in queues to not remove the header. so I must be doing something wrong doing the http call.
Are there some hints or tips for me to figure out this issue?

`kumo.on(‘http_message_generated’, function(msg)
local tenant = msg:get_first_named_header_value(‘X-Tenant’)
if not tenant then
kumo.reject(500, “No tenant”)
end
– Call the queue helper to set up the queue for the message.
queue_helper:apply(msg)

    -- Scheduling
    --msg:import_scheduling_header 'X-Schedule'
    -- SIGNING MUST COME LAST OR YOU COULD BREAK YOUR DKIM SIGNATURES
    dkim_signer(msg)

end)`

curl -i 'http://localhost:80/api/inject/v1' -H 'Content-Type: application/json' -d '{"envelope_sender":"ok@service.slgnt.eu","content":{"subject":"hello\n\nHello there","html_body":"<html>This is the HTML content of the message</html>","text_body":"This is the Text content of the message","from":{"email":"ok@service.slgnt.eu","name":"Test"},"headers":{"X-Tenant":"EU.SMC"}},"recipients":[{"email":"ubuntu@kumo.edc.com"}]}'
init.lua (5.7 KB)
queues.toml (1.63 KB)

for reference, this is the response:
{ "success_count": 0, "fail_count": 1, "failed_recipients": [ "ubuntu@kumo.edc.com" ], "errors": [ "ubuntu@kumo.edc.com: 500 No tenant\nstack traceback:\n\t[C]: in function 'kumo.reject'\n\t[string \"/opt/kumomta/etc/policy/init.lua\"]:260: in function <[string \"/opt/kumomta/etc/policy/init.lua\"]:257>\n" ] }

If you remove the check does it get a tenant assignment when the queue helper is called?

Also what version are you running?

OS version:
Ubuntu 22.04.5 LTS
kumoMTA version:
2024.09.02.062344.c5476b89

tested by using ‘EU.SMC’ as tenant name which should go to pool 3
but shows unspecified
{ "type": "Delivery", "id": "53d4df477cf311ef9bfd06abee3ebd0f", "sender": "ok@service.slgnt.eu", "recipient": "thomas.aerts@selligent.com", "queue": "EDC@selligent.com", "site": "unspecified-\u003E(alt1|alt2|alt3|alt4)?.aspmx.l.google.com@smtp_client", "size": 1057, "response": { "code": 250, "enhanced_code": { "class": 2, "subject": 0, "detail": 0 }, "content": "OK 1727457000 5b1f17b1804b1-42f57e6c071si11978915e9.197 - gsmtp", "command": ".\r\n" }, "peer_address": { "name": "aspmx.l.google.com.", "addr": "74.125.71.27" }, "timestamp": 1727457000, "created": 1727456999, "num_attempts": 0, "bounce_classification": "Uncategorized", "egress_pool": "unspecified", "egress_source": "unspecified", "source_address": { "address": "172.31.20.238:35938" }, . . }

And that test message had the header when it got to the destination?

closing the loop here, the issue was caused by the newlines in the subject header. I’ve opened detect and either error out or fixup trying to use newlines in headers in the http injection api · Issue #296 · KumoCorp/kumomta · GitHub to either surface this with an error, or silently fix it. We haven’t decided which way to go about this yet.