3
I want to send a simple mail in Lua, I used the example in official documentation, and always give me back nil
. Example:
-- load the smtp support
local smtp = require("socket.smtp")
from = "<[email protected]>"
rcpt = {
"<[email protected]>",
"<[email protected]>",
"<[email protected]>"
}
mesgt = {
headers = {
to = "Fulano da Silva <[email protected]>",
cc = '"Beltrano F. Nunes" <[email protected]>',
subject = "My first message"
},
body = "I hope this works. If it does, I can send you another 1000 copies."
}
r, e = smtp.send{
from = from,
rcpt = rcpt,
source = smtp.message(mesgt)
}
Says:
host or service not provided, or not know
Doesn’t generate any errors? Enough to send? I think only this won’t really solve it. You need to set and authenticate on the server. This example only works if specific circumstance, it is not there to resolve any situation.
– Maniero