I’m trying to debug and test some mail and want to route messages going to @mail.local to Mailhog running on port 1025 on the local machine.
In my init.lua I have:
kumo.on('get_queue_config', function(domain, tenant, campaign, routing_domain)
if domain == 'mail.local' then
-- Relay via some other internal infrastructure.
-- Enclose IP (or IPv6) addresses in `[]`.
-- Otherwise the name will be resolved for A and AAAA records
return kumo.make_queue_config {
protocol = {
smtp = {
mx_list = {
'mail.local',
{ name = 'mail.local', addr = '127.0.0.1:1025' },
},
},
},
}
end
-- Otherwise, just use the defaults
return kumo.make_queue_config {}
end)
Email sent to test@mail.local just disappears.
Also, can the protocol with smtp options not be set inside the queues.toml file? When I try to do so, I get an error that mx_list is an unsupported property.
Any help on how to make the custom delivery work or what I’m doing wrong would be appreciated.
“…can the protocol with smtp options not be set inside the queues.toml file? “
No. Queues and shaping and sources are all separate things that work together in combination. A queue is the storing messages before egress. The shaping adds throttles and special egress parameters (like outbound smtp port) and the source defines what ip to use and what name to present it with.
You could set an IPTABLES routing rule.
Or you could use a routing_domain as already recommended. In the shaping for that routing domain, you can set the prefered port.
Hello, have you been able to solve this issue? I am facing something similar, while trying to route the message to mailhog localhost:1025 - messages just sit there, not in any queue, not picked up.
You need to set the outbound smtp port in shaping directives. You have not included any configs so it is really impossible to provide specific help beyond that.