我无法追踪" mail"我的代码块中的函数:
mail(technicalte@gmail.com,testSubject,testMailBody)
我收到以下错误: 第4行的Lua语法错误:&#39;)&#39;预计在&#39; <&#39;
附近这是什么意思,你能帮帮我吗?
顺便说一句,你可以看到下面的邮件功能:
function mail(to, subject, message)
-- make sure these settings are correct
local settings = {
-- "from" field, only e-mail must be specified here
from = 'technicalte@gmail.com',
-- smtp username
user = 'technicalte@gmail.com',
-- smtp password
password = 'mypassword',
-- 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
答案 0 :(得分:1)
mail(technicalte@gmail.com, testSubject, testMailBody)
应该是
mail("technicalte@gmail.com",testSubject,testMailBody)
technicalte@gmail.com
不是有效的变量名称。