PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Using the POP3 protocol
  • Deleting messages and number of incoming messages (POP3 protocol)
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
Allows you to delete the current email via a specific protocol:
  • POP3 protocol: the email is deleted from the email server.
  • 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.
After the call to EmailDeleteMessage, the Email.Out variable is positioned to True.
Reminder: Before handle an Email (get or deleting an Email for example), it is necessary to open a session with the EmailStartSession function (for the POP3 protocol, MS Exchange), with the EmailStartNotesSession function (for the Lotus Notes messaging software) or with the EmailStartOutlookSession or OutlookStartSession function (for the Outlook messaging software).
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for 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 Android applications.
New in version 22
Android Widget This function is now available in Android widget mode.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
Android This function is now available for Android applications.
cMaSession is emailIMAPSession
...
IF EmailStartSession(cMaSession) THEN
cMonEmail is Email
EmailReadFirst(cMaSession, cMonEmail)
WHILE NOT cMonEmail..Out
EmailDeleteMessage(cMaSession, cMonEmail)
EmailReadNext(cMaSession, cMonEmail)
END
EmailCloseSession(cMaSession)
END
// Utilisation avec le logiciel de messagerie Outlook
// TABLE_TableEmail contient l'ensemble des emails reçus
// COL_Exp contient le nom de l'expéditeur (variable Email.Expéditeur)
// COL_Sujet contient le sujet de l'email (variable Email.Sujet)
// COL_ID contient l'identifiant de l'email (variable Email.ID)
// Suppression de l'email sélectionné dans le champ Table
EmailDeleteMessage(IDSession, 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:
<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.
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 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.
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.
Business / UI classification: Business Logic
Component: wd270com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment