AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Gestión de correos electrónicos
  • Retrieving messages
  • Asynchronous message retrieval (IMAP)
  • Memory consumption
  • Managing the progress bar
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Retrieves all the emails found on an email server.
Ejemplo
// Retrieve all unread emails from the in-box.
IMAPSession is emailIMAPSession
arrUnreadEmails is array of Email

// Start the session
EmailStartSession(IMAPSession)

// Retrieve all unread emails
arrUnreadEmails = EmailGetAll(IMAPSession, ertNotRead)

// Display the information for each email
FOR EACH MyEmail OF arrUnreadEmails
	LooperAddLine(LOOP_EMAIL, MyEmail.Sender, MyEmail.Message, MyEmail.Subject)
END
Sintaxis
<Result> = EmailGetAll(<Connection> [, <Read options>])
<Result>: Array of Email variables
Emails found in the in-box (the elements effectively retrieved depend on the parameters).
<Connection>: Character string or emailXXSession variable
Connection to the messaging server.
This parameter can be:
<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.
Remarks:
  • 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).
ertHeader
(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.
Note This value is not available for POP3 connections.
Observaciones

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).
Remarks:
  • 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.
  • Outlook Email recovery The ContentType property is not available and the ContentID property is optional.

Asynchronous message retrieval (IMAP)

In order not to be blocking, the emails are asynchronously retrieved with the constant ertAsynchronous in a secondary thread. The array returned by EmailGetAll must be browsed in its entirety before any call to another EmailXXX function that needs an exchange with the IMAP server.
Warning: accessing non-recovered information may result in an error when accessing the array..
For example, do not write the following code:
arrUnreadEmails = EmailGetAll(IMAPSession, ertAsynchronous)
FOR EACH mail OF arrUnreadEmails
	IF mail.Subject [~] "warning" THEN
		EmailChangeStatus(IMAPSession, mail, emailStatusNotRead)
	END
END

Indeed, it is necessary to manage the change of status after browsing through all the emails.
For example:
nIndex is int
tabIndexEmailChangeStatus is an array of integers

arrUnreadEmails = EmailGetAll(IMAPSession, ertAsynchronous)
FOR EACH mail OF arrUnreadEmails
	nIndex++
	IF mail.Subject [~] "warning" THEN
		Add(arrSubscriptEmailChangeStatus, nIndex)
	END
END

FOR EACH n OF arrSubscriptEmailChangeStatus
	EmailChangeStatus(IMAPSession, arrUnreadEmails[n], emailStatusNotRead)
END

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.
WINDEVAndroidWidget Android iPhone/iPad

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: total size and current progress status.
  • Procedure receiving four parameters: total size, current progress status, current message index and total number of messages.
Componente: wd300com.dll
Versión mínima requerida
  • Versión 15
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local