Sample code for 30+ languages & platforms
Lua

Send email using SSL (port 465).

Send email using SMTP SSL on port 465.

Chilkat Lua Downloads

Lua
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.att.yahoo.com"

-- Set SMTP login and password (if necessary)
mailman.smtp_username = "myUsername@sbcglobal.net"
mailman.smtp_password = "myPassword"

mailman.smtp_ssl = true
mailman.smtp_port = 465

-- 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!")