mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-07-23 09:09:57 +02:00
fix
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
BUILDDIR = ../build/grs
|
||||
|
||||
copyfiles = font-awesome.css fonts images showdown.min.js main.js ubuntu-regular.css mainsite.css sendto.html hermit-light.css hljs
|
||||
copyfiles = font-awesome.css fonts images sendmail.lua showdown.min.js main.js ubuntu-regular.css mainsite.css sendto.html hermit-light.css hljs
|
||||
|
||||
main:
|
||||
- mkdir $(BUILDDIR)
|
||||
|
@ -3,11 +3,11 @@ String.prototype.__ = function()
|
||||
{
|
||||
return this
|
||||
}
|
||||
function mailtoMe( sch)
|
||||
function mailtoMe(prefix)
|
||||
{
|
||||
if(scheme) return;
|
||||
// get scheme
|
||||
$.get(sch)
|
||||
$.get(prefix+"/sendto.html")
|
||||
.done(function(d) {
|
||||
scheme = $.parseHTML(d)
|
||||
var obs = riot.observable()
|
||||
@ -35,7 +35,7 @@ function mailtoMe( sch)
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "info/sendmail.lua",
|
||||
url: prefix + "/sendmail.lua",
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(data),
|
||||
dataType: 'json',
|
||||
|
20
grs/sendmail.lua
Normal file
20
grs/sendmail.lua
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
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"
|
||||
local content = "Contact request from:"..rq.name.."\n Email: "..rq.email.."\n"..rq.content.."\n"
|
||||
|
||||
local cmd = 'echo "'..utils.escape(from..suject..content)..'"| sendmail '..to
|
||||
|
||||
--print(cmd)
|
||||
local r = os.execute(cmd)
|
||||
|
||||
if r then
|
||||
result(r)
|
||||
else
|
||||
fail("Cannot send email at the moment, the service may be down")
|
||||
end
|
Reference in New Issue
Block a user