lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm writing my first Lua script which is supposed to send a message via SMTP, but lua is complaining with:

attempt to index local 'smtp' (a boolean value)

Any ideas why smtp is a boolean value? Is there a better way to send an email in Lua?

The code is as follows:

function main()

-- load the smtp support
local smtp = require("smtp")

from = "<x@xxx>"

rcpt = "<x@xxx>"

mesgt = {
  headers = {
    to = "xxx",
    cc = 'xxx',
    subject = "test"
  },
  body = "Message sent from lua"
}

r, e = smtp.send{
  from = from,
  rcpt = rcpt,
  source = smtp.message(mesgt)
}
end

Thanks
 - J