-
Notifications
You must be signed in to change notification settings - Fork 12
Lua Modules
Dolf Schimmel edited this page Mar 13, 2016
·
6 revisions
It's possible to write your own modules using Lua. You can do so by adding to the configuration:
[luaModule "something"]
enabled = true
script = ./lua/something.lua
Following the configuration above, it will register the module as lua-something internally.
This script outlines all the available calls that are available:
function milterCheck(message)
print(message:getFrom())
print(message:getQueueId())
for i,v in pairs(message:getRcpt()) do
print(v)
end
print("Headers:")
for i,v in pairs(message:getHeaders()) do
print(v:getKey())
print(v:getValue())
print("")
end
print("Body:")
print(message:getBody())
-- score must be one of PERMIT, TEMPFAIL, REJECT, ERROR.
-- Second and third argument are the rejection message and score.
return "REJECT", "We think it's spam!", 2.00
end