13.10.2017, 08:45
Thanks, please update packages again:
Package for LM4:
https://dl.openrb.com/lm-17/pkg/luasocke...23_mxs.ipk
Package for LM5:
https://dl.openrb.com/lm-17-imx6/pkg/lua...3_imx6.ipk
Replace mail() function in Common functions with this and change from/user/password field values to your access details:
Package for LM4:
https://dl.openrb.com/lm-17/pkg/luasocke...23_mxs.ipk
Package for LM5:
https://dl.openrb.com/lm-17-imx6/pkg/lua...3_imx6.ipk
Replace mail() function in Common functions with this and change from/user/password field values to your access details:
Code:
function mail(to, subject, message)
-- make sure these settings are correct
local settings = {
-- "from" field, only e-mail must be specified here
from = '...',
-- smtp username
user = '...',
-- smtp password
password = '...',
-- smtp server
server = 'mailgate.cosmotemail.gr',
-- smtp server port
port = 587,
-- enable tls
secure = 'tlsv1',
-- use STARTTLS mode
starttls = true,
}
local smtp = require('socket.smtp')
if type(to) ~= 'table' then
to = { to }
end
for index, email in ipairs(to) do
to[ index ] = '<' .. tostring(email) .. '>'
end
-- fixup from field
local from = '<' .. tostring(settings.from) .. '>'
-- message headers and body
settings.source = smtp.message({
headers = {
to = table.concat(to, ', '),
subject = subject,
['From'] = from,
['Content-type'] = 'text/html; charset=utf-8',
},
body = message
})
settings.from = from
settings.rcpt = to
return smtp.send(settings)
end