Lua
Lua
Explicitly Connect to the POP3 Server
See more POP3 Examples
Demonstrates the Chilkat MailMan.Pop3Connect method, which explicitly connects to the POP3 server. If SSL/TLS is required by the current property settings, the secure TLS channel is established as part of connecting. This example opens the connection.
Background:
Pop3Connect performs just the connect (and TLS handshake) step, without authenticating. Separating it from Pop3Authenticate gives explicit control over the session lifecycle and makes it easy to tell a connection failure apart from a login failure. For routine mailbox operations you don't need it — methods like CheckMail connect automatically.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- Demonstrates the MailMan.Pop3Connect method, which explicitly connects to the POP3 server.
-- If SSL/TLS is required by the current property settings, the secure channel is established
-- as part of connecting.
local mailman = chilkat.MailMan.new()
-- Configure the POP3 server connection.
mailman.mail_host = "pop.example.com"
mailman.mail_port = 995
mailman.pop_ssl = true
-- Explicitly connect to the POP3 server (does not authenticate).
local success = mailman:pop3_connect()
if not success then
print(mailman.last_error_text)
return
end
print("Connected to the POP3 server.")