|
|
|
|
|
- Managing emails in asynchronous mode
EmailStatus (Function) In french: EmailEtat Returns the status of an email sent via an SMTP session started in asynchronous mode.
IF EmailStartSession(USER, PASSWORD, "pop3.ifrance.fr", ...
"smtp.ifrance.fr", 110, 25, True) = True THEN
NomUser = USER
ELSE
NomUser = ""
Error("Impossible d'établir la connexion")
END
Email.Recipient = "support@pcsoft.fr"
Email.Sender = "Tartampion@boite.net.fr"
Email.Message = "Test Auto eMail"
Email.NbRecipient = 1
IF EmailSendMessage(NomUser) = False THEN
Error("EmailEnvoieMessage a échoué '" + ErrorInfo(errMessage) + "'")
ELSE
Info("EmailEnvoieMessage a réussi")
END
...
SWITCH EmailStatus(Email.MailIdentifier)
CASE emailSent: Trace("L'email a été envoyé")
CASE emailPending: Trace("Email en cours de traitement")
CASE emailError: Trace("Erreur: " + ErrorInfo(errMessage))
END
Syntax
<Result> = EmailStatus(<Email Identifier>)
<Result>: Constant Outgoing status of the specified email: | | emailError | An error occurred. The error details are returned by ErrorInfo(errMessage). | emailPending | The email is waiting to be sent. It is in the spooler. | emailSent | The email was sent. |
<Email Identifier>: Integer Email identifier (Email.MailIdentifier variable or ID property of the Email variable initialized when the email was sent with EmailSend and EmailSendMessage). Remarks Managing emails in asynchronous mode The email functions are locking functions by default. Which means that no other code can be run during their execution. The program will resume only when the current Email functions have been run. WEBDEV gives you the ability to manage the emails in asynchronous mode. This mode allows your sites to send emails without locking the execution of other processes. To use the asynchronous mode, you must: - Uncheck "Disable the email spooler" in the WEBDEV administrator ("Advanced" tab).
- Enable the asynchronous mode when starting the SMTP session (with EmailStartSMTPSession or EmailStartSession).
- All outgoing emails will be transmitted to a "spooler". Emails are queued up before being sent.
Executing Email functions does no longer block the rest of the program. EmailStatus determines the status of an email. Note: If the WEBDEV administrator is closed, the email spooler is cleared. Pending emails are not sent and are removed from the spooler. If "Disable the email spooler" is checked while emails are still found in the spooler, these emails will not be lost: the administrator keeps sending them but no new email is accepted by the spooler. Caution: Asynchronous mode can only be used when starting a session on an SMTP server ( EmailStartSMTPSession function to send emails, or EmailStartSession). The asynchronous mode is ignored in all other cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|