2020-05-23 20:09:01 +02:00
|
|
|
|
|
|
|
local data = ...
|
|
|
|
-- print(data.content)
|
|
|
|
local error_msg = {}
|
|
|
|
local iserror = false
|
|
|
|
for k,v in pairs(data.to) do
|
|
|
|
print("sent to:"..v)
|
|
|
|
local to = v
|
2020-06-05 20:06:10 +02:00
|
|
|
local from = "From: mrsang@lxsang.me\n"
|
2020-05-23 20:09:01 +02:00
|
|
|
local suject = "Subject: " .. data.title .. "\n"
|
|
|
|
local content = data.content.."\n"
|
|
|
|
local cmd = 'echo "' .. utils.escape(from .. suject .. content) .. '"| sendmail ' .. to
|
|
|
|
--print(cmd)
|
|
|
|
local r = os.execute(cmd)
|
|
|
|
if not r then
|
|
|
|
iserror = true
|
|
|
|
table.insert(error_msg, v)
|
|
|
|
print("Unable to send mail to: "..v)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local result = {}
|
|
|
|
result.error = iserror
|
|
|
|
result.result = error_msg
|
|
|
|
return result
|