PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Displaying the number of incoming emails found in the POP3 mailbox
  • Filling a treeview table with the tree structure of folders found in an Outlook database
EmailNbMessage (Example)
Displaying the number of incoming emails found in the POP3 mailbox
The following code is used to display the number of incoming emails found in the POP3 mailbox.
// Start an email session (POP3 protocol)
IF EmailStartSession(USER, PASSWORD, "pop3.ifrance.fr", ...
"smtp.ifrance.fr") = True THEN
UserName = USER
ELSE
UserName = ""
Error("Unable to establish the connection")
END
...
// Read the first incoming record
IF EmailReadFirst(UserName) THEN
IF Email.Out = False THEN
Info("You have" + EmailNbMessage() + "on the server")
Open(WIN_Email_RCV)
ELSE
Info("No email")
END
ELSE
Error()
END
Filling a treeview table with the tree structure of folders found in an Outlook database
The following code is used to fill a treeview table with all the folders found in an Outlook database.
// Declare the variables
 
// Identifier of the session
SessionID is int
// List of folders
FolderList is string
// Name of each folder
FolderName is string
// Subscript of each folder
FolderSubscript is int = 1
// Beginning of name for each folder
FolderPart1 is string
// End of name for each folder
FolderPart2 is string
// Number of emails found in each folder
NbEmails is int
 
// Start the session
SessionID = OutlookStartSession("")
// Error occurred?
IF SessionID = 0 THEN
Error("Error while starting the session", ErrorInfo())
ELSE
// List of folders
FolderList = EmailListFolder(SessionID, LstFolderAll)
// Extract the 1st listed folder
FolderName = ExtractString(FolderList, FolderSubscript, CR)
// Handle the folders
WHILE FolderName <> EOT
// Change the current folder
EmailChangeFolder(SessionID, FolderName)
// Number of emails found in the current folder
NbEmails = EmailNbMessage(SessionID)
// Extract the different parts from the folder name
FolderPart2 = ExtractString(FolderName, 1, "\", ...
FromEnd)
FolderPart1 = ExtractString(FolderName, 1, ...
"\" + FolderPart2)
// 1st folder to add into the table?
IF FolderSubscript = 1 THEN
TableAddChild(TVT_FolderTable, Null, ...
FolderPart2, NbEmails, FolderName)
ELSE
// Replace the "\" by TAB
// at the beginning of folder name
FolderPart1 = Replace(FolderPart1, "\", TAB)
// Add the following folders
TableAddChild(TVT_FolderTable, FolderPart1, ...
FolderPart2, NbEmails, FolderName)
END
// Increment the subscript of the folder
FolderSubscript ++
// Extract the other listed folders
FolderName = ExtractString(FolderList, FolderSubscript, CR)
END
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment