This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

[OLD] LogicMachine firmware 2017.06
#38
Please help me !
I use LM3 reactor, I use 2017/6/1 version, but send mail is faulty. I still use that code with version 2016/4/24 still works error.
Does anyone have mail sending errors?
-------------------------
------------------- send an e-mail-----------------------------------------
function mail(to, subject, message)
-- make sure these settings are correct
local settings = {
-- "from" field, only e-mail must be specified here
from = 'abcdxyz@gmail.com',
-- smtp username
user = 'abcdxyz@gmail.com',
-- smtp password
password = 'password',
-- smtp server
server = 'smtp.gmail.com',
-- smtp server port
port = 465,
-- enable ssl, required for gmail smtp
secure = 'sslv23',
}

local smtp = require('socket.smtp')
local escape = function(v)
return '<' .. tostring(v) .. '>'
end

-- message headers and body
settings.source = smtp.message({
headers = {
to = escape(to),
subject = subject,
},
body = message
})

-- fixup from field
settings.from = escape(settings.from)
settings.rcpt = { escape(to) }

return smtp.send(settings)
end
-------------------------------


Messages In This Thread
RE: [RELEASE] LogicMachine firmware 2017.06 - by phongvucba - 22.09.2017, 05:24

Forum Jump: