V10 ResourcesGuides
ResourcesGuides
Guides
Back | List of Articles

How to send email messages asynchronously?

Last changed in 03/02/2023

Sending email messages asynchronously is a convenient way to send notifications to the entities with which organizations relate in the course of their business activity. To be able to use this functionality, you must have PRIMAVERA Scheduler Service installed. The scheduler service is the part that will be responsible for monitoring the status of messages and sending them, for which purpose it is necessary to configure the SMTP server at the end of the installation of this service.

The messages to be sent are stored in the MessagesEmail table in the PRIEMPRE database. After successful processing they are marked as sent (Sent field) so that they are not available again.

To register the sending of a new email message you must use the Email service provided by the platform as shown in the example below.

using StdPlatBE100;
using StdPlatBS100;
using System;

namespace Email
{
    public class MensagensAssincronas
    {
        public void EnviaMensagem()
        {
            StdPlatBE100.StdBEMensagemEmail bEMensagemEmail = new StdPlatBE100.StdBEMensagemEmail();

            bEMensagemEmail.Assunto= "Exemplo de Envio";
            bEMensagemEmail.EmailTo = "[email protected]";
            bEMensagemEmail.Data = DateTime.Now;
            bEMensagemEmail.Anexos = null;
            bEMensagemEmail.Mensagem = "Este é um exemplo de envio de mensagens de forma assincrona.";

            PSO.Email.Actualiza(bEMensagemEmail);
        }
    }
}
Bookmark or share this article
Esta página foi útil?
Obrigado pelo seu voto.

login para deixar a sua opinião.

Obrigado pelo seu feedback. Iremos analisá-lo para continuarmos a melhorar!
Artigos Relacionados
Começar a Usar Como criar um projeto de integração com Visual Studio? Como criar um projeto de extensibilidade de interface (PEX) com Visual Studio? Como criar um projeto de extensibilidade de API (Motor) com Visual Studio? Como criar separadores do utilizador com Visual Studio?