https://t.me/RX1948
Server : LiteSpeed
System : Linux srv104790275 5.15.0-161-generic #171-Ubuntu SMP Sat Oct 11 08:17:01 UTC 2025 x86_64
User : dewac4139 ( 1077)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /usr/share/doc/opendkim/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/opendkim/examples/stats.lua
-- stats.lua -- conventional stats extensions
--
-- Copyright (c) 2011, 2012, The Trusted Domain Project.  All rights reserved.
--
-- Referencing this as StatisticsScript from an opendkim that has both "stats"
-- and "lua" enabled will produce some extended stats lines for each message
-- that indicate whether the message passed SPF and/or SenderID, and
-- whether or not SpamAssassin thought the message was spam.  This might
-- be useful for data correlation at the data aggregation point.

--
-- SpamAssassin
--
spam = odkim.get_header(ctx, "X-Spam-Status", 0)
if spam == nil then
	odkim.stats(ctx, "spam", "-1")
elseif string.sub(spam, 1, 3) == "No," or string.sub(spam, 2, 4) == "No," then
	odkim.stats(ctx, "spam", "0")
elseif string.sub(spam, 1, 4) == "Yes," or string.sub(spam, 2, 5) == "Yes," then
	odkim.stats(ctx, "spam", "1")
else
	odkim.stats(ctx, "spam", "-1")
end

--
-- SPF/Sender-ID
--
n = 0
done = 0
found = 0
while (done == 0) do
	ares = odkim.get_header(ctx, "Authentication-Results", n)
	if ares == nil then
		done = 1
	else
		spf = string.find(ares, "spf=", 1, true)
		if spf ~= nil then
			done = 1
			found = 1
			if string.find(ares, "spf=pass", 1, true) ~= nil then
				odkim.stats(ctx, "spf", "1")
			elseif string.find(ares, "spf=fail", 1, true) ~= nil then
				odkim.stats(ctx, "spf", "0")
			else
				odkim.stats(ctx, "spf", "-1")
			end
			if string.find(ares, "sender-id=pass", 1, true) ~= nil then
				odkim.stats(ctx, "senderid", "1")
			elseif string.find(ares, "sender-id=fail", 1, true) ~= nil then
				odkim.stats(ctx, "senderid", "0")
			else
				odkim.stats(ctx, "senderid", "-1")
			end
		end
	end
	n = n + 1
end
if found == 0 then
	odkim.stats(ctx, "spf", "-1")
	odkim.stats(ctx, "senderid", "-1")
end

odkim.stats(ctx, "rcpts", tostring(odkim.rcpt_count(ctx)))

https://t.me/RX1948 - 2025