Can someone tell me why this code works fine with a non Corona version of Lua eg. Lua for Windows, but fails when I try it with Corona ?
It gives an error "cannot find file or directory smtp-test.lua , which is the file I’m attaching, which is located in the same folder as main.lua ?
[code]
smtp = require(“socket.smtp”)
mime = require(“mime”)
ltn12 = require(“ltn12”)
mailserv = “XXX”
mailport = “25”
from = ""
rcpt = { “”, “” }
mesgt = smtp.message{
headers = {
to = “XXX”,
subject = “Test Lua Email”
},
body = {
preable = “This email contains attachments.”,
[1] = {
body = mime.eol(0, [[
“With any luck, we are able to see a Lua-sent
email here.”
]])
},
[2] = {
headers = {
[“content-type”] = ‘text/plain; name=“smtp-test.lua”’,
[“content-disposition”] = ‘attachment; filename=“smtp-test.lua”’,
[“content-description”] = ‘the send script’s source’,
[“content-transfer-encoding”] = “BASE64”
},
body = ltn12.source.chain(
ltn12.source.file(io.open(“smtp-test.lua”, “r”)),
ltn12.filter.chain(
mime.encode(“base64”),
mime.wrap()
)
)
},
epilogue = “A few words at the end…”
}
}
r, e = smtp.send {
from = from,
rcpt = rcpt,
source = mesgt,
server = mailserv,
port = mailport
}
if (e) then
io.stderr:write("Could not send email: ", e, “\n”)
end
[/code] [import]uid: 97524 topic_id: 19703 reply_id: 319703[/import]