Lua
Lua
Email Body - Plain Text and/or HTML
Any given email may have a plain-text body, an HTML body, or both. The Body property will return the HTML body by default (if it exists) otherwise it will return the plain-text body. There are methods for checking to see if an email has a particular body (HasPlainTextBody and HasHtmlBody) and there are methods for getting a specific body: GetHtmlBody, GetPlainTextBody.Chilkat Lua Downloads
local chilkat = require("chilkat")
local email = chilkat.Email.new()
-- Load an email from a .eml
local success = email:load_eml("something.eml")
if not success then
print(email.last_error_text)
return
end
-- Display the default Body:
print(email.body)
-- If a plain-text body is present, display it:
local bText = email:has_plain_text_body()
if bText then
print(email:get_plain_text_body())
end
-- If an HTML body is present, display the HTML source:
local bHtml = email:has_html_body()
if bHtml then
print(email:get_html_body())
end