2018-02-22 15:47:09 +01:00
|
|
|
|
|
|
|
if not REQUEST.query.json then
|
|
|
|
fail("unknown request")
|
|
|
|
end
|
|
|
|
local rq = (JSON.decodeString(REQUEST.query.json))
|
|
|
|
local to = "xsang.le@gmail.com"
|
|
|
|
local from = "From: "..rq.email.."\n"
|
|
|
|
local suject = "Subject: "..rq.subject.."\n"
|
2018-02-22 19:15:03 +01:00
|
|
|
local content = "Contact request from:"..rq.name.."\n Email: "..rq.email.."\n"..rq.content.."\n"
|
2018-02-22 15:47:09 +01:00
|
|
|
|
|
|
|
local cmd = 'echo "'..utils.escape(from..suject..content)..'"| sendmail '..to
|
|
|
|
|
2018-02-22 15:48:14 +01:00
|
|
|
--print(cmd)
|
2018-02-22 15:47:09 +01:00
|
|
|
local r = os.execute(cmd)
|
|
|
|
|
|
|
|
if r then
|
|
|
|
result(r)
|
|
|
|
else
|
|
|
|
fail("Cannot send email at the moment, the service may be down")
|
|
|
|
end
|