DecodeAttachment  Boolean variable if we set this property to TRUE the control will decode attachment that available inside an email.
MailFrom  String variable, READ ONLY
ReplyTo  String variable, READ ONLY
CCAddress  String variable, READ ONLY
AttachmentMailDirectory  String variable, set this property with directory path of our disk to save email attachment to specified directory
BCCAddress  String variable, READ ONLY
MailSubject  String variable, READ ONLY
MailDate  String variable, READ ONLY
POPServerName  String variable, set this property to our POP server domain.
GetMail  Boolean variable, set this property to TRUE to fetch mail from POP server.
ConnectToPOPServer  Boolean variable
DisconnectFromPOPServer  Boolean variable
UserName  String variable
Password  String variable
TotalMail  Integer variable, READ ONLY
MailSize  Long variable, READ ONLY
MailIndex  Integer variable, mail number that available on POP server
DeleteMail  Boolean variable, set this property to TRUE to delete an email.
MailListOnServer  Boolean variable, set this property to TRUE to fetch mail listing on POP server.
MailAvailable(Available As Boolean)Usage :
This event will be appeared if we have mail on our POP server and Available parameter will be set to TRUE by the control.
MailNotAvailable(NotAvailable As Boolean)
This event will be appeared if we don't have mail on our POP server , NotAvailable parameter will be set to TRUE by the control.
MailDownloaded(Downloaded As Boolean)
This event will be appeared if mail on POP server has been downloaded to our disk , Downloaded parameter will be set to TRUE by the control.
Disconnected(Disconnect As Boolean)
This event will be appeared if the control closed connection from POP server , Disconnect parameter will be set to TRUE by the control.
Connected(Connect As Boolean)
This event will be appeared if the control connected to POP server , Connect parameter will be set to TRUE by the control.
ToTalMailOnServer(TotalMail As Integer, TotalMailSize As Long)
If we have mail on POP server this event will be appeared , ToTalMail parameter is total email that available on POP server and TotalMailSize parameter is our total mail size on Pop Server.
MessageSource(Contents As String)
This event will be appeared if mail has been downloaded from POP server, Contents parameter is a raw message of an email that contains header of an email and body of message that usually contains html tag,attachment tag etc.
MessageText(MyMessage As String)
This event will be appeared if an email has text message for the recipient, MyMessage parameter contains email message without email's header, attachment tag, html tag etc .
ConnectionStatus(Status As String)
This event contains current communication log between the control and POP server.
MailIdentity(IdentityAvailable As Boolean)
If mail identity such as sender's address,recipient's address,reply address, Cc address etc of an email available, this event will be appeared and parameter IdentityAvailable will be set to TRUE.
Error(State As Boolean, ErrorCode As Integer, Description As String)
If error occured during communication between control and POP server ,this event will be appeared and State parameter will be set to TRUE, ErrorCode parameter is the error number while Description parameter is error description that corresponding with ErrorCode. This event will give error report that caused by Windows socket or POP command execution error such as login failure.
MailList(List As String)
This event will be appeared if the control query mail listing on POP server , List parameter contains mail listing that available on POP server.
MailDeleted(MailIndex As Integer)
This event will be appeared if the control delete mail on POP server, MailIndex parameter contains corresponding mail number on POP server that have been deleted.
BusyState(Busy As Boolean)
This event will be appeared if the control is in busy state to communicate with POP server , Busy parameter will be set to TRUE by the control if the control is busy and FALSE if the control is ready to execute next command from user application.
AttachmentAvailable(Available As Boolean, AttachmentList As String, TotalAvailableAttachment As Integer)
This event will be appeared if an email has attachment, Available parameter will be set to TRUE by the control If Available parameter is TRUE, AttachmentList contains file attachment of an email and TotalAvailable is total file attachment inside an email.
AttachmentDecoded(AttachmentName As String, Finished As Boolean) This event will be appeared if the control has been decoded file attachment inside an email. AttachmentName parameter contains decoded file's name and Finished will be set to TRUE if decoding process has been done.
To fetch email from POP server , we should login to the POP server using code snippet such as follows :Fetch an email from POP server' Login process to POP serverIf login process to POP server is successful, the control will start to query available email to the POP server. If POP server has email MailAvailable(Available As Boolean) and ToTalMailOnServer(TotalMail As Integer, TotalMailSize As Long) will be appeared vice versa if we don't have email on POP server MailNotAvailable(NotAvailable As Boolean) will be appeared and NotAvailable parameter will be set to TRUE and the control will disconnect from POP server. During login process to POP server BusyState(Busy As Boolean) appear and Busy parameter will be set to TRUE.
POPMail1.POPServerName = ServerName.Text
POPMail1.Username = Username.Text
POPMail1.Password = Password.Text
POPMail1.ConnectToPOPServer = True
If POP server has email, we know total available email on POP server from TotalMail parameter of ToTalMailOnServer event that appeared during login process. Let us say that we have 5 email on POP server so TotalMail = 5 and if we want to fetch email number 3 from POP server, we can do it using code snippet such as follows :Decoding email attachment' Fetch an email process from POP serverDuring this process BusyState(Busy As Boolean) appear, Busy parameter will be TRUE, at this moment the control not ready yet to receive command from user application since the control is busy to communicate with POP server.
POPMail1.MailIndex = 3
POPMail1.GetMail = True
If an email has been downloaded from POP server, events such as follows will be appeared :
- MessageSource(Contents As String) which Contents is string parameter that contains complete email message such as header, body of message, attachment etc.
- MessageText(MyMessage As String) which MyMessage is string parameter that contains email text that useful for us without header, attachment tag,html tag etc that inserted inside an email .
- MailIdentity(IdentityAvailable As Boolean), if IdentityAvailable parameter is TRUE means that the control already stripped out identity of an email such as mail from address, reply to address, Cc address etc from message source of an email. We can get email identity from following code snippet:' Identity of an email- AttachmentAvailable(Available As Boolean, AttachmentList As String, TotalAvailableAttachment As Integer)
MailFromLabel.Caption = POPMail1.MailFrom
MailReplyToLabel.Caption = POPMail1.ReplyTo
MailCCAddressLabel.Caption = POPMail1.CCAddress
MailBCCAddressLabel.Caption = POPMail1.BCCAddress
MailDateLabel.Caption = POPMail1.MailDate
MailSubjectLabel.Caption = POPMail1.MailSubject
If an email has attachment this event will be appeared and parameters of the event will be set as follows:Available parameter set to TRUEIf an email has HTML tag the control creates temporary HTML file, it will launch internal simple internet explorer and open it.
AttachmentList parameter will contains listing of attachment inside an email with string format: FileName1;FileType1;FileName2;FileType2;FileName3;FileType3;.....etc, the maximum attachment listing is 100.
TotalAvailableAttachment parameter will contains total attachment inside an email.
- MailDownloaded(Downloaded As Boolean)
This event appear if mail has been downloaded from POP server, Downloaded will be set to TRUE.
Before decoding attachment of an email, user application should feed directory path to the control. This directory path will be used to save mail attachment. Code snippet to save mail attachment is as follows:Delete an email on POP server
' Decoding mail attachment to specified directory pathIf decoding process has been done AttachmentDecoded(AttachmentName As String, Finished As Boolean) will be appeared, AttachmentName parameter contains file's name attachment that has been decoded and saved to a specified directory, Finished parameter will be set to TRUE if decoding has been done without problem. During this process BusyState(Busy As Boolean) appear and Busy parameter will be set to TRUE.
POPMail1.AttachmentMailDirectory = WorkingDir.Path
POPMail1.DecodeAttachment = True
To delete an email on POP server we should determine mail number that we will delete. Code snippet to delete an email is such as follows:Fetch email listing from POP server' Deleting an email on POP serverIf deleting process is successful event MailDeleted(MailIndex As Integer) will be appeared which MailIndex parameter contains mail number that have been deleted. During this process BusyState(Busy As Boolean) appear and Busy parameter will be set to TRUE.
POPMail1.MailIndex = 3
POPMail1.DeleteMail = True
We can get email listing from POP server using following code snippet:' Fetch mail listing from POP serverThen event MailList(List As String) will be appeared, List parameter contains email that available on POP server with string format as follows: mail number  mail size, mail number and mail size separated by space. During this process BusyState(Busy As Boolean) appear and Busy parameter will be set to TRUE.
POPMail1.MailListOnServer = True
If you found bugs or comments please send it to us, we will review it and make revisions. You can purchase source code of POPMail.ocx Version: 1.06 from our secure order page.
This page uses frames, but your browser doesn't support them.