Hi,
Note, just a comparison to understand if I’m not looking in the right direction to achieve what I want
Momentum guy here
I’ve recently resumed my research and POCs with KumoMTA after a few months
My need is to activate multiple Listeners, the messages received on these listeners must be identifiable later. Is there a way to add “context variables” to messages as they come in through the Listeners?
Doesn’t seem possible from the reference start_esmtp_listener
Example from “Momentum”:
ESMTP_Listener {
Listen "172.23.123.233:25" {
Peer "0.0.0.0/0" {
context = [
message_type = "A",
customer_id = "FOO"
]
}
}
}
ESMTP_Listener {
Listen "192.168.45.176:25" {
Peer "0.0.0.0/0" {
context = [
message_type = "B",
customer_id = "BAR"
]
}
}
}
With this setup, I can later retrieve these context variables at any stage of email processing in Momentum:
vctx_customer_id = vctx_conn_get "customer_id";
vctx_message_type = vctx_conn_get "message_type";
ec_header_add "X-My-Customer-ID" "${vctx_customer_id}";
ec_header_add "X-My-Message-Type" "${vctx_message_type}";
This approach is really useful as it allows me to avoid writing additional code or maintaining extra mappings
I know I could extract this information from the, for example, received_via metadata, but that would require setting up and maintaining a mapping like:
172.23.123.233:25 message_type A
172.23.123.233:25 customer_id FOO
192.168.45.176:25 message_type B
192.168.45.176:25 customer_id BAR
to be used in the 'smtp_server_message_received' function(msg, conn) stage, however, this would mean maintaining an additional database, handling connections, caching, exceptions, and memory usage in order to retrieve this data for every single message
Is there a simpler/alternative way to achieve this in KumoMTA that I might have overlooked?