Lua Requires Chilkat v11.0.0+
Lua
POP3 Fetch Mime Source of Email by UIDL
Demonstrates how to fetch the MIME source of a single email by UIDL.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local mailman = chilkat.MailMan.new()
mailman.mail_host = "pop.example.com"
mailman.pop_username = "myLogin"
mailman.pop_password = "myPassword"
mailman.mail_port = 995
mailman.pop_ssl = true
local stUidls = chilkat.StringTable.new()
local success = mailman:fetch_uidls(stUidls)
if not success then
print(mailman.last_error_text)
return
end
-- Download each email as MIME.
local bdMime = chilkat.BinData.new()
local count = stUidls.count
local i = 0
while i < count do
success = mailman:fetch_mime_bd(stUidls:string_at(i), bdMime)
if not success then
print(mailman.last_error_text)
return
end
-- Do whatever is needed with the MIME contained in bdMime.
i = i + 1
end