Sample code for 30+ languages & platforms
PowerBuilder

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 PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Mailman
integer li_NumEmails

li_Success = 0

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Mailman = create oleobject
li_rc = loo_Mailman.ConnectToNewObject("Chilkat.MailMan")
if li_rc < 0 then
    destroy loo_Mailman
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Connection settings for pop3.live.com (or pop-mail.outlook.com, both should work)
loo_Mailman.MailHost = "pop-mail.outlook.com"
loo_Mailman.MailHost = "pop3.live.com"

loo_Mailman.PopUsername = "my_account@live.com"
loo_Mailman.PopPassword = "my_live.com_password"
loo_Mailman.MailPort = 995
loo_Mailman.PopSsl = 1

// Make the TLS connection to the POP3 server.
li_Success = loo_Mailman.Pop3Connect()
if li_Success <> 1 then
    Write-Debug loo_Mailman.LastErrorText
    destroy loo_Mailman
    return
end if

// Authenticate..
li_Success = loo_Mailman.Pop3Authenticate()
if li_Success <> 1 then
    Write-Debug loo_Mailman.LastErrorText
    destroy loo_Mailman
    return
end if

// Find out how many emails are on the server..
li_NumEmails = loo_Mailman.CheckMail()
if li_NumEmails < 0 then
    Write-Debug loo_Mailman.LastErrorText
    destroy loo_Mailman
    return
end if

// Examine the POP3 session log:
Write-Debug loo_Mailman.Pop3SessionLog

// End the POP3 session and close the connection to the POP3 server.
li_Success = loo_Mailman.Pop3EndSession()
if li_Success <> 1 then
    Write-Debug loo_Mailman.LastErrorText
    destroy loo_Mailman
    return
end if

Write-Debug "-- 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.
// 


destroy loo_Mailman