mirror of
https://github.com/KumoCorp/kumomta.git
synced 2026-08-20 00:01:15 +00:00
3fd76dd45a
Augments our queue name format to be
`campaign:tenant@domain!routing_domain`.
The routing_domain is optional. If the routing_domain is not set, its
effective value is that of the recipient domain.
You can `msg:set_meta('routing_domain', 'bar.com')` to set the
routing_domain for a message, so if the original recipient was
`user@foo.com`, that would cause the computed queue name for it to be
`foo.com!bar.com`.
The routing_domain is used when deciding on the ready_queue name
and destination MXs, so continuing our example, instead of resolving
`foo.com` MX records we'd resolve `bar.com` and deliver to that site.
The `get_egress_path_config` event `domain` parameter is redefined to be
the effective `routing_domain`.
The `get_queue_config` event `domain` parameter is the regular recipient
domain. The `routing_domain` is not currently made available to
`get_queue_config`. If/when we expose it, it will likely be via a
queue name object instead of adding an additional parameter. That would
be a breaking change.
The consequence of not exposing this parameter is that per-message
routing scenarios for the same domain (but different routing domains)
cannot vary the scheduled queue parmeters (eg: retry intervals). Even
though they would have separate scheduled queue instances, those
instances would have the same scheduled queue parameters. If you need
to be able to do that, then explicitly setting the domain portion of the
queue name would be a way to do that: `msg:set_meta('queue',
'foo.com-via-bar.com!bar.com')`. `get_queue_config` would then be
called with `domain='foo.com-via-bar.com'` and your policy could then
respond accordingly.
1.5 KiB
1.5 KiB
message:set_meta(KEY, VALUE)
Messages are associated with some metadata. You can think of this metadata as being equivalent to a JSON object.
The set_meta method allows you to set a field of that object to a value
that you specify.
You can assign any value that is serializable as a JSON:
-- set foo='bar', a string value
msg:set_meta('foo', 'bar')
-- set foo=123, a numeric value
msg:set_meta('foo', 123)
-- set foo=true, a boolean value
msg:set_meta('foo', true)
-- set foo={key="value"}, an object value
msg:set_meta('foo', { key = 'value' })
You can retrieve a metadata value via message:get_meta.
Pre-defined meta values
The following meta values have meaning to KumoMTA:
"queue"- specify the name of the queue to which the message will be queued. Must be a string value."tenant"- specify the name/identifier of the tenant, if any. Must be a string value."campaign"- specify the name/identifier of the campaign. Must be a string value."authz_id"- the authorization id if the message was received via authenticated SMTP"authn_id"- the authentication id if the message was received via authenticated SMTP"reception_protocol"-"ESMTP"or"HTTP""received_via"- the address:port of the local machine which received the message. Currently only set for SMTP receptions."received_from"- the address:port of the peer address from which we received the message"routing_domain"- {{since('dev', inline=True)}}. Overrides the domain of the recipient domain for routing purposes.