
KumoMTA
To complete the integration, you will need to update the Lua start up configuration file located at /opt/kumomta/etc/policy/init.lua. Please follow the instructions below to complete the integration.
Updating Configuration File
Using your favorite editor open the configuration file located at /opt/kumomta/etc/policy/init.lua. You are within the correct file, if the file looks similar to the following example:
--[[
########################################################
KumoMTA minimal Send Policy
(Save this as /opt/kumomta/etc/policy/init.lua for systemd automation)
This config policy defines KumoMTA with a minimal
set of modifications from default.
Please read the docs at https://docs.kumomta.com/
For detailed configuration instructions.
########################################################
]]
--
local kumo = require 'kumo'
--[[ Start of INIT section ]]
--
kumo.on('init', function()
-- ...
end)
--[[ End of INIT Section ]]
--[[ Start of Non-INIT level config ]]
-- -- PLEASE read https://docs.kumomta.com/ for extensive documentation on customizing this config.
--[[ End of Non-INIT level config ]]
Smtp Relay Hosts
To allow EmailElement to send emails using your MTA, our IPs will need to be added as a relay_host.
To accomplish this, please add the following IPs: 38.74.128.59, 64.62.168.6 and, 8.45.58.31 to the relay_host option under the start_esmtp_listener section on the init event.
kumo.on('init', function()
-- ... (other init level config)
kumo.start_esmtp_listener {
-- ... (other start_esmtp_listener level config)
relay_hosts = { '127.0.0.1', '38.74.128.59', '64.62.168.6', '8.45.58.31' }, -- Add EmailElement's IP addresses here
-- ... (other start_esmtp_listener level config)
}
-- ... (other init level config)
end)
Set Up Webhook for Email Tracking
In order for EmailElement to track your deliveries, we will need to receive delivery events from your MTA.
To accomplish this, please create a webhook after the init event.
-- Import Webhook helpers
local log_hooks = require 'policy-extras.log_hooks'
-- START SETUP
-- START configure EmailElement webhook
-- Send a JSON webhook to EmailElement.
-- See https://docs.kumomta.com/userguide/operation/webhooks/
log_hooks:new_json {
name = 'ee-webhook',
url = 'https://deliverywebhook.emailelement.com/api/event/kumomta',
log_parameters = {
headers = { 'Date', 'Message-Id', 'Subject' },
per_record = {
Feedback = {
enable = false,
},
},
},
queue_config = {
-- Age out messages after being in the queue for max_age
max_age = '20 minutes',
-- If a message cannot be immediately delivered and encounters a transient failure,
-- then a (jittered) delay of retry_interval will be applied before trying again
retry_interval = '5 minutes',
-- Retry at most every max_retry_interval
max_retry_interval = '10 minutes',
}
}
-- END configure EmailElement webhook
-- END SETUP
kumo.on('init', function()
-- ... (init level config)
end)
The preceding code will create a webhook named ee-webhook.
After adding the above snippets, please save and close the file.
Remember to restart your KumoMTA after editing the configuration file.
Restart command: sudo systemctl restart kumomta
Wrap up
For reference, here is the complete file after following all of the steps listed above.
--[[
########################################################
KumoMTA minimal Send Policy
(Save this as /opt/kumomta/etc/policy/init.lua for systemd automation)
This config policy defines KumoMTA with a minimal
set of modifications from default.
Please read the docs at https://docs.kumomta.com/
For detailed configuration instructions.
########################################################
]]
--
local kumo = require 'kumo'
-- Import Webhook helpers
local log_hooks = require 'policy-extras.log_hooks'
-- START SETUP
-- START configure EmailElement webhook
-- Send a JSON webhook to EmailElement.
-- See https://docs.kumomta.com/userguide/operation/webhooks/
log_hooks:new_json {
name = 'ee-webhook',
url = 'https://deliverywebhook.emailelement.com/api/event/kumomta',
log_parameters = {
headers = { 'Date', 'Message-Id', 'Subject' },
per_record = {
Feedback = {
enable = false,
},
},
},
queue_config = {
-- Age out messages after being in the queue for max_age
max_age = '20 minutes',
-- If a message cannot be immediately delivered and encounters a transient failure,
-- then a (jittered) delay of retry_interval will be applied before trying again
retry_interval = '5 minutes',
-- Retry at most every max_retry_interval
max_retry_interval = '10 minutes',
}
}
-- END configure EmailElement webhook
-- END SETUP
--[[ Start of INIT section ]]
--
kumo.on('init', function()
kumo.start_esmtp_listener {
listen = '0.0.0.0:25',
relay_hosts = { '127.0.0.1', '38.74.128.59', '64.62.168.6', '8.45.58.31' }, -- Add EmailElement's IP addresses here
}
kumo.start_http_listener {
listen = '127.0.0.1:8000',
}
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',
-- Flush logs every 10 seconds.
-- You may wish to set a larger value in your production
-- configuration; this lower value makes it quicker to see
-- logs while you are first getting set up.
max_segment_duration = '10s',
}
end)
--[[ End of INIT Section ]]
--[[ Start of Non-INIT level config ]]
-- PLEASE read https://docs.kumomta.com/ for extensive documentation on customizing this config.
--[[ End of Non-INIT level config ]]
That's it! You should be ready to send email using KumoMTA.