Lua
Lua
Test HotMail POP3 (pop3.live.com or pop-mail.outlook.com)
See more POP3 Examples
Demonstrates connecting and authenticating to pop3.live.com. Make sure to enable POP3 access, as shown here:
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()
-- Connection settings for pop3.live.com (or pop-mail.outlook.com, both should work)
mailman.mail_host = "pop-mail.outlook.com"
mailman.mail_host = "pop3.live.com"
mailman.pop_username = "my_account@live.com"
mailman.pop_password = "my_live.com_password"
mailman.mail_port = 995
mailman.pop_ssl = true
-- Make the TLS connection to the POP3 server.
local success = mailman:pop3_connect()
if not success then
print(mailman.last_error_text)
return
end
-- Authenticate..
success = mailman:pop3_authenticate()
if not success then
print(mailman.last_error_text)
return
end
-- Find out how many emails are on the server..
local numEmails = mailman:check_mail()
if numEmails < 0 then
print(mailman.last_error_text)
return
end
-- Examine the POP3 session log:
print(mailman.pop3_session_log)
-- End the POP3 session and close the connection to the POP3 server.
success = mailman:pop3_end_session()
if not success then
print(mailman.last_error_text)
return
end
print("-- Finished.")
-- The output of this program:
-- **** Connected to pop3.live.com:995
-- < +OK DUB006-POP206 POP3 server ready
-- > USER chilkat@live.com
-- < +OK password required
-- > PASS ****
-- < +OK User successfully authenticated. [AuthResult=0 Proxy=CY1PR17MB0630.namprd17.prod.outlook.com:1995:SSL]
-- > STAT
-- < +OK 46 3980488
--
-- -- Finished.
--