How do I set pool / IP based on the header?

I know the current documentation help you set the tenant:

kumo.on(‘smtp_server_message_received’, function(msg)
– Assign tenant based on X-Tenant header.
local tenant = msg:get_first_named_header_value ‘X-Tenant’
if tenant then
msg:set_meta(‘tenant’, tenant)
end
end)

I want a similar method to set the source IP from my list.

[source.“ip-11”]

You have to assign to a pool, but it can be a pool of 1 ip

You may want to consider using the queue helper too

Yep, that’s what I used!

I’ll post my config here, just in case..

local sources = require 'policy-extras.sources'
sources:setup { '/opt/kumomta/etc/sources.toml' }

-- Configure the queue and DKIM.

kumo.on('get_queue_config', function(domain, tenant, campaign)
  local zoneId = tenant
  local params = {
    egress_pool = "pool-" .. zoneId,
    retry_interval = '5 minutes',
    max_retry_interval = '1 hour',
    max_age = '5 days'
  }
  return kumo.make_queue_config(params)
end)