Как правильно настроить отсылку сообщений на e-mail?
Я сделал настройки в Common functions :
-- user function library
-- 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 = 'ivan.ivanov@gmail.com',
-- smtp username
user = 'ivan.ivanov@gmail.com',
-- smtp password
password = '1234567890',
-- 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
Далее в целях эксперимента создал Sheduled script, посылающий каждую минуту произвольное сообщение
-- logtime = os.time() - 60*60*24
-- make sure mail settings are set in user function library before using this function
subject = 'LM e-mail test'
message = 'Testing e-mail from LogicMachine'
mail('ivan.petrov@me.com', subject, message)
Сообщения не посылаются... Что не так?