Handling events
' Declare mailer object global to control ' it within different subroutines Dim objPOP3 ' User clicked the button. Must get e-mail Private Sub Command1_Click() Dim objMsgs ' Allow POP3 object to process Windows ' events during operation objPOP3.EnableEvents = True ' Unlock POP3 component objPOP3.LicenseKey = "put your license key here" ' Set POP3 server name objPOP3.ServerName = "mail.server.com" ' Set user credentials objPOP3.UserName = "username" objPOP3.Password = "password" ' Connect to the server and log in the mailbox If objPOP3.Connect Then ' Completely download all messages in ' the mailbox (this often takes some time) Set objMsgs = objPOP3.RetrieveMessages ' Close the connection objPOP3.Disconnect End If End Sub ' App launched, create mailer object but ' do not get any e-mail yet Private Sub Form_Load() ' Create mailer component Set objPOP3 = CreateObject("MailBee.POP3") End Sub ' User closed the app Private Sub Form_Unload(Cancel As Integer) ' If e-mail is still being received, ' abort mail operation If objPOP3.Busy Then objPOP3.Abort End Sub
Not applicableSee Also: