Lua smtp

#!/usr/bin/env lua
local smtp = require("socket.smtp")
from = "[email protected]" --发件人
--发送列表
rcpt = {
        "[email protected]",
        "[email protected]"
}
mesgt = {
        headers = {
                to = "[email protected]", --收件人
                cc = "[email protected]", --抄送  
                subject = "This is Mail Title" --主题
        },
        body = "This is Mail Content."
}
r, e = smtp.send{
        from = from,
        rcpt = rcpt,
        source = smtp.message(mesgt),
        server = "smtp.ym.163.com",
        user = "[email protected]",
        password = "password"
}
if not r then
        print(e)
else
        print("send ok!")
end


你可能感兴趣的:(邮件,lua)