Hello.
We are currently testing KumoMTA and encountering difficulties with a specific point.
Our main domain is being impacted by automated application emails, so we have created a subdomain for them. However, due to the difficulty of changing the source address directly within the applications, we are trying to implement a sender rewrite rule in the MTA. The goal is to have messages originating from addresses such as app1@domain, app2@domain, etc., rewritten as app1@sub.domain, app2@sub.domain, and so on.
I am specifically trying to understand if smtp_client_mail_from is the right hook for this, or if I should be using pre_helper_modify_message to rewrite both the Envelope and the From: header to ensure DMARC alignment.
My current configuration:
rewrite.lua
local rewrite = {}
local sender_map = {
["app1@domain"] = "app1@sub.domain",
}
function rewrite.apply(sender)
local lower = string.lower(sender)
if sender_map[lower] then
kumo.log_info(string.format("[REWRITE] %s -> %s", sender, sender_map[lower]))
return sender_map[lower]
end
return sender
end
return rewrite
init.lua
kumo.on('smtp_client_mail_from', function(msg, mail_from)
local original_sender = mail_from:get_address()
local rewritten = rewrite.apply(original_sender)
if rewritten ~= original_sender then
mail_from:set_address(rewritten)
kumo.log_info(string.format('[EGRESS-REWRITE] %s -> %s id=%s', original_sender, rewritten, msg:get_id()))
end
end)
However, the rewrite is not happening. I suspect I might be mishandling the mail_from object or using the wrong event for this purpose.
**Version:** kumod 2026.04.09-ea3b2a9b
Any help would be greatly appreciated. Thanks in advance!