Messages missing a valid Message-ID header are not accepted

Hello all. I am new with Kumomta. I am getting the above error.
So I added this to my init.lua

kumo.on(‘smtp_server_message_received’, function(msg)
math.randomseed(os.time())
local character_set = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789”
local function generateRandomString(length)
local random_string_table = {}
local set_length = #character_set

    for i = 1, length do
            local random_index = math.random(1, set_length)
            table.insert(random_string_table, string.sub(character_set, random_index, random_index))
    end
    return table.concat(random_string_table)

end
local myRandomString = generateRandomString(24)
msg:append_header(“Message-ID”, myRandomString)
queue_helper:apply(msg)
end)

I am still getting error.

I thought I read that Kumo should add a Message-ID without any new code.

Thanks

KumoMTA can add a Message-ID header automatically if configured right, but you didn’t provide your config so it’s hard to check.

local kumo = require ‘kumo’
local utils = require ‘policy-extras.policy_utils’

local shaping = require ‘policy-extras.shaping’
local queue_module = require ‘policy-extras.queue’
local listener_domains = require ‘policy-extras.listener_domains’
local sources = require ‘policy-extras.sources’
local log_hooks = require ‘policy-extras.log_hooks’

sources:setup { ‘/opt/kumomta/etc/policy/sources.toml’ }

kumo.on(‘init’, function()
for _, port in ipairs { 25, 587 } do
kumo.start_esmtp_listener {
listen = ‘0:’ .. tostring(port),
hostname = ‘planbnow.net’,
relay_hosts = {
‘127.0.0.1’,
‘222.22.22.22/27’,
},
}
end

kumo.define_spool {
name = ‘data’,
path = ‘/var/spool/kumomta/data’,
}

kumo.define_spool {
name = ‘meta’,
path = ‘/var/spool/kumomta/meta’,
}

kumo.configure_local_logs {
log_dir = ‘/var/log/kumomta’,
max_segment_duration = ‘1 minute’,
}

kumo.configure_bounce_classifier {
files = {
‘/opt/kumomta/share/bounce_classifier/iana.toml’,
},
}

kumo.start_http_listener {
listen = ‘127.0.0.1:8000’,
}

end)

kumo.on(‘get_listener_domain’, listener_domains:setup {
‘/opt/kumomta/etc/policy/listener_domains.toml’
})

kumo.on(‘smtp_server_message_received’, function(msg)
math.randomseed(os.time())
local character_set = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789”
local function generateRandomString(length)
local random_string_table = {}
local set_length = #character_set

    for i = 1, length do
            local random_index = math.random(1, set_length)
            table.insert(random_string_table, string.sub(character_set, random_index, random_index))
    end
    return table.concat(random_string_table)

end
local myRandomString = generateRandomString(24)
msg:append_header(“Message-ID”, myRandomString)
queue_helper:apply(msg)
end)

Yeah take all that back out, replace it with a check_fix_conformance - KumoMTA Docs call to fix missing message ID.

Thank you sir

Hi, just reading this thread, am I to understand that by default KumoMTA does not generate a message ID?

Yes, according to the specs, the MTA is not supposed to be the thing that adds a Message-ID header, it is supposed to already be present in the message that is sent to/through it. You can optionally configure KumoMTA to check for a missing header and add one as discussed above