ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Managing emails
  • No next email
  • Initializing the reading of emails
  • Using the POP3 protocol
  • Using MS Exchange
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Reads the incoming email found after the current email:
  • via the POP3 or IMAP protocol: the incoming emails are found in the mailbox.
If no email is found (no next message), the Email.Out variable is set to True.
Reminder: Before reading an email, it is necessary to open a session with EmailStartSession, EmailStartNotesSession or EmailStartOutlookSession.
// Read the first email
EmailReadFirst(EmailID)
IF Email.Out = False THEN
// Displays the sender and the subject in a table
TableAdd(TABLE_IncomingEmails, Email.Sender + TAB + Email.Subject)
// Read the next email
EmailReadNext(EmailID)
END
Syntax

Reading the next incoming email via the POP3 or IMAP protocol Hide the details

<Result> = EmailReadNext(<Session> [, <Email>])
<Result>: Boolean
  • True if the message was read,
  • False otherwise. If an error occurs, the ErrorOccurred variable is set to True.
    To get more details on the error, use ErrorInfo with the errMessage constant. If no email is found, ErrorOccurred remains set to False and the Email.Out variable is positioned to True.
<Session>: Character string, or emailPOP3Session or emailIMAPSession variable
Identifies the user session. Corresponds to:
<Email>: Optional Email variable
Name of the Email variable to be initialized with the message content.
If this parameter is not specified, the Email structure is used.
Windows

Reading the next email received via MS Exchange, Lotus Notes or Outlook Hide the details

<Result> = EmailReadNext(<Session> [, <Email> [, <Read mode> [, <Type>]]])
<Result>: Boolean
  • True if the message was read,
  • False otherwise. If an error occurs, the ErrorOccurred variable is set to True.
    To get more details on the error, use ErrorInfo with the errMessage constant. If no email is found, ErrorOccurred remains set to False and the Email.Out variable is positioned to True.
<Session>: Integer, or emailOutlookSession or emailNotesSession variable
Identifier of current email session. This identifier can be:
<Email>: Optional Email variable
Name of the Email variable to be initialized with the message content.
If this parameter is not specified, the Email structure is used.
<Read mode>: Optional constant or character string
Indicates the messages that will be read:
emailAll or "ALL"
(Default value)
All the messages will be read.
emailUnread or "UNREAD"Only the unread messages will be read.
<Type>: Optional character string
Describes the type of message to read. By default, <Type> = "IPM" (Inter Personal Message).
Remarks

No next email

If no email was found (no next message), the Email.Out variable is set to True. The next call to EmailReadNext will read the first incoming email (equivalent to EmailReadFirst).

Initializing the reading of emails

If the read operation was not initialized by EmailReadFirst, EmailReadNext is used to read the first message.

Using the POP3 protocol

When reading a message, the files attached to this message can be copied to the local disk with EmailSaveAttachment.
Tip: We recommend that you keep the messages and their attachments on the local disk, then delete them from the server. This operation is used to:
  • reduce the size of the mailbox on the server,
  • improve and speed up the communications in POP3 sessions: only the new messages will be read on the server.
Reports and QueriesWindows

Using MS Exchange

EmailUpdate allows you to receive the messages from the Internet email server when using MS Exchange.
When reading a message, the files attached to this message are copied into the temporary directory of Windows. The full name of these files are stored in Email.Attach. These attached files can be copied by fCopyFile.
Related Examples:
The POP3 Email functions Unit examples (WINDEV): The POP3 Email functions
[ + ] Using the Email functions to manage the POP3 protocol.
This protocol is used to retrieve emails from a server.
WD JavaMail Training (WINDEV): WD JavaMail
[ + ] This example is a Java example used to read and send emails.
Business / UI classification: Business Logic
Component: wd290com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/22/2023

Send a report | Local help