Lua编程 - 如何通过电子邮件发送多个附件?

时间:2015-09-23 15:47:46

标签: email lua smtp email-attachments

我尝试使用SMTP服务器和mime.lua将多个附件发送到电子邮件地址。我正在尝试获取文件夹中的所有pdf,但我收到零值并收到空的电子邮件。任何帮助将不胜感激。谢谢! 这是我的代码:

local mime = require 'mime'
local name = {}
function email()
    local i = 0 --counter for for loop
    for FileName, FileInfo in os.fs.glob('C:/Users/Desktop/*.pdf') do
        i = i+1
        trace(FileName)
        name[i] = FileName --populate name with FileName 
        print(name[i])
        trace(FileInfo)
    end   
end


function main()
    email()
    local Results = mime.send{--dont think i need this
        server='*************', 
        username='********', 
        password='***********',
        from='*****************', 
        to={'************************'},
        header={['Subject']='Test Subject'}, 
        body='Test Email Body', 
        use_ssl='try',
        attachments=name,
        trace(name)
    }
end

0 个答案:

没有答案