smtp 方法发送 mail

脚本示例:

local sz = require("sz")
local smtp = require("szocket.smtp")

from = "<youmail@126.com>" -- 发件人

--发送列表
rcpt = {
    "<youmail@126.com>",
    "<youmail@qq.com>",
    "<youmail@gmail.com>",
}
mesgt = {
    headers = {
        to = "youmail@gmail.com", -- 收件人
        cc = '<youmail@gmail.com>', -- 抄送
        subject = "This is Mail Title"
    },
    body = "这里放邮件内容"
}
r, e = smtp.send{
    server = "smtp.126.com", -- smtp 服务器地址
    user = "youmail@126.com",-- smtp 验证用户名
    password = "******",     -- smtp 验证密码  
    from = from,
    rcpt = rcpt,
    source = smtp.message(mesgt)
}

if not r then
    dialog(e,0)
else
    dialog("发送成功!",0)
end
Copyright 北京帮你玩科技有限公司 2020 all right reserved,powered by Gitbook该文章修订时间: 2020-01-19 17:41:57

results matching ""

    No results matching ""