SamLogic Internet Components - Home
ActiveX: SLPOP      (Filename: SLPOP3.OCX)


SLPOP is an ActiveX component that can be used to download e-mail messages (or just message headers) from a POP3 server. The control can also check the number of waiting mails on the server and their sizes. SLPOP uses the POP3 protocol (specified in RFC 1939) when communicating with the e-mail server.
 
 

Properties
 
Name Type Description
MailBody String This property will contain the body text of a downloaded e-mail.
 
MailFrom String This property will contain the sender's e-mail address of a downloaded e-mail. This property will also obtain a value if you call the GetMailHeader method.
 
MailHeader String This property will contain the e-mail header of a downloaded message. This property will also obtain a value if you call the GetMailHeader method.
 
MailPort Long Specifies the port number to use when connecting to the POP3 server. The default value for this property is 110 and normally you never need to change the value.
 
MailReplyTo String This property will contain the sender's reply e-mail address of a downloaded e-mail. This property will also obtain a value if you call the GetMailHeader method.
 
MailServer String Specifies the POP3 server to use when downloading e-mails. 
 
MailSubject String This property will contain the subject field of a downloaded message. This property will also obtain a value if you call the GetMailHeader method. 
 
Password String Specifies the password to use when connecting to the POP3 server.
 
UseLog Boolean Enables/disables using of a log file in the control. If this property has the value True a log file with the filename SLPOP3AX.LOG will be created. This log file contains detailed information about the POP3 communication between the client and the e-mail server.
 
In Windows XP and earlier the log file is stored in the Windows folder. In Windows Vista / 7 the log file is stored in the following folder: \Users\<User>\AppData\Roaming\SamLogic\Log Files
 
UserName String Specifies the user name to use when connecting to the POP3 server.
 
 
Events
 
Name Description
Connected This event is fired when a connection to the POP3 server is established.
 
Disconnected This event is fired when the connection to the POP3 server is disconnected.
 
ErrorOccured This event is fired if an error occurs when communicating with the POP3 server.
 
MailHeaderReceived This event is fired when an e-mail message header have been successfully downloaded using the GetMailHeader method.
 
MailReceived This event is fired when an e-mail have been successfully downloaded using the ReceiveMail method.
 
MailServerReportedError This event is fired if the e-mail server reports an error or denies access. The Operation parameter specifies at what step in the communication process the error occurred. Some common values for Operation is:

1 = The error occurred when the user name was sent.
2 = The error occurred when the password was sent.
5 = The error occurred when the e-mail message header was downloaded.
7 = The error occurred when the e-mail was downloaded.
 
MailSizeReceived This event is fired when the size of an e-mail has been retrieved using the GetMailSize method. The size of the e-mail can be read from the MailSize parameter in this event.
 

Methods
 
 
Connect () As Boolean


Opens a connection to the POP3 server. The method returns True if successful, or False otherwise. If a successful connection has been established, the Connected event is fired.

Disconnect () As Boolean

Disconnects (logs off) from the server. The method returns True if successful, or False otherwise.
  
 


Break ()

Cancels current operation. This method can be used to break the connection if the e-mail server is not responding in a given amount of time.

Delete (MailNumber As Integer) As Boolean

Deletes a specified e-mail at the POP3 server. The MailNumber parameter specifies which e-mail that should be deleted. The first e-mail has the value 1, the second e-mail has the value 2 etc. The e-mails are physically removed from the server when the Disconnect method is called. The method returns True if successful, or False if an error occurs.

GetLastError () As Long

Returns an error code for the last error that occurred in the control. A list of error codes is available here.

GetLastReplyCode () As Long

Returns the last reply code from the POP3 server. Is always one of the following values: 1 = OK, 0 = error or 2 = can't determine.

GetMailHeader (MailNumber As Integer) As Boolean

Downloads an e-mail message header. The MailNumber parameter specifies the e-mail which header should be downloaded. The first e-mail has the value 1, the second e-mail has the value 2 etc. When an e-mail header has arrived, the MailHeaderReceived event is fired. You can then obtain the e-mail header by reading the MailHeader property. Some fields in the e-mail header can be obtained by reading the MailFrom, MailReplyTo and MailSubject properties. The method returns True if successful, or False if an error occurs.

GetMailSize (MailNumber As Integer) As Boolean

Gets the size of a specified e-mail in the POP3 server. The MailNumber parameter specifies the number of the e-mail to examine. The first e-mail has the value 1, the second e-mail has the value 2 etc. When the size have arrived from the server to the client computer, the MailSizeReceived event is fired. The size of the e-mail can be read from the MailSize parameter in the MailSizeReceived event. This method returns True if successful, or False if an error occurs.

GetNumWaitingMails () As Integer

Returns the number of waiting e-mails in the POP3 server.

GetNumWaitingMailsLong () As Long

Returns the number of waiting e-mails in the POP3 server. This method should be used instead of GetNumWaitingMails if you expect the number of e-mails in an POP3 account to be very high (>32767).

GetSizeWaitingMails () As Long

Returns the total size in bytes of the waiting e-mails in the POP3 server.

ReceiveMail (MailNumber As Integer) As Boolean

Downloads an e-mail from the POP3 server. The MailNumber parameter specifies which e-mail that should be downloaded. The number of the first e-mail is 1. When an e-mail have been downloaded, the MailReceived event is fired. After a successful download, the e-mail body can be obtained by reading the MailBody property. The subject can be obtained by reading the MailSubject property. Other properties that can be used to get information about the downloaded e-mail is MailFrom and MailReplyTo.

This method do not delete the e-mail from the mail server. You must call the Delete method to remove the e-mail. The method returns True if successful, or False if an error occurs.
 

 
Example
 

Click here for a source code example that shows how to use the SLPOP ActiveX component
 
 
< Go back
 

 
SamLogic