mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-11-07 22:18:29 +01:00
24 lines
645 B
Lua
24 lines
645 B
Lua
|
|
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
|
|
local from = "From: xsang.le@gmail.com\n"
|
|
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 |