PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Using the POP3 protocol
  • Deleting messages and number of incoming messages (POP3 protocol)
  • Using the MS Exchange client, Pocket Outlook, Lotus Notes or Outlook
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Allows you to delete the current email:
  • via the POP3 protocol: the email is deleted from the email server.
  • via the IMAP protocol: the email is flagged as "erased/deleted". It will be actually deleted from the email server during the next "expunge" command (clear the bin from a WebMail for example).
    Versions 20 and later
    You also have the ability to force the destruction of all deleted emails via EmailExpunge.
    New in version 20
    You also have the ability to force the destruction of all deleted emails via EmailExpunge.
    You also have the ability to force the destruction of all deleted emails via EmailExpunge.
  • WINDEVWEBDEV - Server codeWindows Mobile via the MS Exchange client or via Pocket Outlook: the email is deleted from the in-box of messages.
  • WINDEVWEBDEV - Server code via the Lotus Notes or Outlook messaging: the email is deleted from the in-box of messages.
After the call to EmailDeleteMessage, the Email.Out variable is positioned to True.
Reminder: Before handling an email (reading or deleting an email for example), a session must be opened by EmailStartSession (for the POP3, MS Exchange, Pocket Outlook protocol), by EmailStartNotesSession (for the Lotus Notes messaging software) or by EmailStartOutlookSession or OutlookStartSession (for the Outlook messaging software).
LinuxJava The POP3 protocol can only be used to delete emails.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 22 and later
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
New in version 22
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
cMySession is EmailIMAPSession
...
IF EmailStartSession(cMySession) THEN
cMyEmail is Email
EmailReadFirst(cMySession, cMyEmail)
WHILE NOT cMyEmail..Out
EmailDeleteMessage(cMySession, cMyEmail)
EmailReadNext(cMySession, cMyEmail)
END
EmailCloseSession(cMySession)
END
// Use with the Outlook messaging software
// TABLE_EmailTable table contains all the incoming emails
// COL_Sender contains the sender name (Email.Sender variable)
// COL_Subject contains the email subject (Email.Sujet variable)
// COL_ID contains the email identifier (Email.ID variable)
// Delete the selected email from the Table control
EmailDeleteMessage(SessionID, COL_ID)
Syntax

Deleting an email by using the POP3 or IMAP protocol Hide the details

<Result> = EmailDeleteMessage(<Session> [, <Email or Message Number>])
<Result>: Boolean
  • True if the message was deleted,
  • False otherwise.
<Session>: Character string, or emailPOP3Session or emailIMAPSession variable
Identifies the user session. This parameter corresponds to:
Versions 15 and later
Java The emailPOP3Session and emailIMAPSession variables are not available.
New in version 15
Java The emailPOP3Session and emailIMAPSession variables are not available.
Java The emailPOP3Session and emailIMAPSession variables are not available.
<Email or Message Number>: Optional Email variable or integer
If this parameter is an Email variable, the message corresponding to the variable is deleted.
If this parameter is an integer, it identifies the number of the message to delete on the server.
If this parameter is not specified, the last message read is deleted from the email server.
WINDEVWEBDEV - Server codeReports and QueriesWindowsWindows MobileAjaxUser code (UMC)

Deleting an incoming email via MS Exchange, Pocket Outlook, Lotus Notes, Outlook Hide the details

<Result> = EmailDeleteMessage(<Session> [, <Email or Message Identifier>])
<Result>: Boolean
  • True if the message was deleted,
  • False otherwise. To find out the error details, use ErrorInfo associated with the errMessage constant.
<Session>: Integer or EmailOutlookSession variable
Identifier of current email session. This value can be:
<Email or Message Identifier>: Optional Email variable or character string
If this parameter is an Email variable, the message corresponding to the variable is deleted.
If this parameter is a character string, it specifies the identifier of the message to delete on the server.
If the parameter is not specified, the last message read is deleted from the email server and the Email.out variable is set to True.
Remarks

Using the POP3 protocol

If <Message Number>:
  • is not specified: the last message read is deleted from the email server.
  • is specified: the message identified by <Message Number> is deleted from the email server.
When a message is deleted by EmailDeleteMessage:
  • The message will be actually deleted from the email server during the disconnection (EmailCloseSession).
  • The Email.Out variable is set to True.

Deleting messages and number of incoming messages (POP3 protocol)

If a message was deleted by EmailDeleteMessage:
  • EmailNbMessage returns the number of messages found on the email server before the deletion.
  • the message numbers are not re-assigned.
Therefore, if four messages are found on the server during the connection, these messages are numbered from 1 to 4. If the message #1 is deleted:
  • EmailNbMessage (used in the same session) returns 4.
  • Message 1 cannot be read by EmailReadMessage because the message does not exist anymore (only messages 2, 3 and 4 exist).
The message numbers are re-assigned during the next connection.
Caution: Gmail via a POP3 session: when using EmailDeleteMessage, the email is flagged as deleted but it is not deleted. It is the standard operating mode of Gmail via POP3.
WINDEVWEBDEV - Server codeReports and QueriesWindowsWindows MobileAjaxUser code (UMC)

Using the MS Exchange client, Pocket Outlook, Lotus Notes or Outlook

The last message read is deleted from the incoming messages. This message will not be displayed anymore when the messages are browsed by EmailReadFirst and EmailReadNext.
After the call to EmailDeleteMessage, the Email.Out variable is positioned to True.
To retrieve a deleted message, you have the ability to check the box of deleted messages of MS Exchange, Pocket Outlook, Lotus Notes or Outlook.
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.
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.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230com.dll
Windows Mobile wp230com.dll
Java wd230java.jar
Linux wd230com.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment