I am using below confiugration however email is always routed from default path and does not matches. – ==============================================================
– ROUTING DECISION HELPER FUNCTION
– ==============================================================
local function should_use_maileroo(msg)
local mail_from = “”
local sender_obj = msg:mail_from()
if sender_obj and sender_obj.address then
mail_from = sender_obj.address:lower()
end
– Get the source IP from message reception meta
local source_ip = “unknown”
local peer = msg:meta(“peer_address”)
if peer and peer.addr then
source_ip = peer.addr
end
local use_maileroo = (mail_from == “billing@xyz.com” or source_ip == “172.29.100.82”)
if use_maileroo then
kumo.log_info(string.format(“MAILEROO ROUTING: MAIL FROM=%s, SOURCE IP=%s”, mail_from, source_ip))
end
return use_maileroo
end
– ==============================================================
– QUEUE CONFIGURATION - SIMPLIFIED
– ==============================================================
kumo.on(“get_queue_config”, function(domain, source, site, msg)
if msg:get_meta(“route_via_maileroo”) == “yes” then
kumo.log_info(string.format(“MAILEROO: Creating queue config for domain=%s”, domain))
return kumo.make_queue_config {
name = string.format("maileroo~%s", domain),
protocol = {
smtp = {
relay_host = "smtp.maileroo.com",
relay_port = 587,
ehlo_domain = "xyz.com",
smtp_auth = {
type = "plain",
username = "billing@xyz.com",
password = "Test_Password",
},
enable_tls = "Required",
connect_timeout = "30s",
idle_timeout = "60s",
},
},
max_concurrency = 10,
max_age = "24h",
retry_interval = "1h",
max_retry_interval = "4h",
max_message_rate = "500/1m",
}
end