Lua
Lua
Send email using SMTP STARTTLS.
Send email using SMTP STARTTLS. With STARTTLS, the SMTP client connects to the SMTP server on port 25 (non-SSL) and then issues a STARTTLS command to convert the connection to a secure TLS channel.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.
-- The mailman object is used for sending and receiving email.
local mailman = chilkat.MailMan.new()
-- Set the SMTP server.
mailman.smtp_host = "smtp.mymailserver.com"
mailman.smtp_username = "myLogin"
mailman.smtp_password = "myPassword"
mailman.start_tls = true
-- Create a new email object
local email = chilkat.Email.new()
email.subject = "This is a test"
email.body = "This is a test"
email.from = "Chilkat Support <support@chilkatsoft.com>"
local success = email:add_to("Chilkat Admin", "admin@chilkatsoft.com")
success = mailman:send_email(email)
if not success then
print(mailman.last_error_text)
return
end
success = mailman:close_smtp_connection()
if not success then
print("Connection to SMTP server not closed cleanly.")
end
print("Mail Sent!")