Help / WLanguage / WLanguage functions / Communication / Managing emails
  • Retrieving messages
  • Memory consumption
  • Managing the progress bar
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Retrieves all the emails found on an email server.
// Retrieve all unread emails from the in-box.
OutlookSession is emailOutlookSession
arrUnreadEmails is array of Emails
// Start the session
// Retrieve all unread emails
arrUnreadEmails = OutlookSession.GetAll(ertNotRead)
// Display the information for each email
FOR EACH MyEmail OF arrUnreadEmails
LOOP_EMAIL.AddLine(MyEmail.Sender, MyEmail.Message, MyEmail.Subject)
<Result> = <Session>.GetAll([<Read options>])
<Result>: Array of Email variables
Emails found in the in-box (the elements effectively retrieved depend on the parameters).
<Session>: emailOutlookSession variable
Name of the EmailStartOutlookSession variable corresponding to the email session to use.
<Read options>: Optional Integer constant
The possible values are:
ertAsynchronousThe messages are retrieved in asynchronous mode. The function immediately returns an array of Email variables containing as many elements as necessary. The effective retrieval of data is performed "upon request" when accessing the array elements.
  • In this mode, the progress bars and the callbacks defined by EmailProgressBar are ignored.
  • Older emails are processed first.
ertFullThe messages are entirely read from the server (header, message body and attachments).
(default value)
Only the headers are read. The effective retrieval of other data (message body and attachments) is performed "upon request" when accessing the array elements.
ertNotReadOnly the messages flagged as "not read" on the server are retrieved.
Remark: This value is not available for a POP3. connection.

Retrieving messages

To retrieve all messages as well as their attachments, we recommend that you use the ertFull constant to reduce the number of calls to the server.
On the contrary, if only a few emails are to be fully retrieved, it is recommended to use the ertHeader constant (default value) and let the message body be automatically retrieved when necessary (i.e. when the Message property of the Email variable is accessed).
  • If a property of an email is modified before the message body or the attachments are retrieved, the retrieval of the message body and attachments is canceled.
  • Retrieving Outlook emails: The ContentType property is not available and the ContentID property is optional.

Memory consumption

The retrieval of emails is performed in memory. If the in-box contains several messages or large attachments, the reading can consume a lot of memory.

Managing the progress bar

To get the retrieval progress status, implement a progress bar or a procedure with EmailProgressBar.
Two procedure syntaxes are supported:
  • Procedure receiving two parameters: the total size and the current progress.
  • Procedure receiving four parameters: the total size, the current progress, the subscript of the message currently processed and the total number of messages.
Related Examples:
WD Mail Complete examples (WINDEV): WD Mail
[ + ] This application is an email client developed in WINDEV. It is based on the Email objects.
This email client is used to retrieve and send emails by using the POP, IMAP and SMTP protocols.
You have the ability to apply filters to the incoming emails.

The application can also be used to manage several email accounts. The writing of an email is based on the HTML edit control.
Component: wd290com.dll
Minimum version required
  • Version 24
This page is also available for…
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help