(PowerBuilder) Read a POP3 Mailbox
Read a POP3 mailbox and display the FROM and SUBJECT header fields of each email.
integer li_rc
oleobject loo_Mailman
integer li_NumMessages
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// The mailman object is used for receiving (POP3)
// and sending (SMTP) email.
loo_Mailman = create oleobject
// Use "Chilkat_9_5_0.MailMan" for versions of Chilkat < 10.0.0
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
// Set the POP3 server's hostname
loo_Mailman.MailHost = "pop.someMailServer.com"
// Set the POP3 login/password.
loo_Mailman.PopUsername = "myLogin"
loo_Mailman.PopPassword = "myPassword"
// Get the number of messages in the mailbox.
li_NumMessages = loo_Mailman.GetMailboxCount()
Write-Debug string(li_NumMessages)
destroy loo_Mailman
|