Interface ISendMailManager

  • All Known Implementing Classes:
    SendMailManager

    @StableMinor(version="14.0",
                 sinceVersion="4.0")
    public interface ISendMailManager
    Manager that offers send mail service. It also offers capability of sending e-mails asynchronously, by queueing them.
    Since:
    4.0.4
    Version:
    $Revision: 24477 $ $Date: 2021-04-28 11:30:36 -0300 (Wed, 28 Apr 2021) $
    • Method Detail

      • getMailConfig

        IMailConfig getMailConfig​(SessionConfig sessionConfig,
                                  ITransaction transaction)
                           throws PortalException
        Returns the IMailConfig containing the configurations for sending e-mails.
        Parameters:
        sessionConfig - the user session information.
        transaction - the transaction for persistence access.
        Returns:
        the IMailConfig, never null.
        Throws:
        PortalException - if it was not possible to obtain the IMailConfig.
        Since:
        4.0.4
      • setMailConfig

        void setMailConfig​(SessionConfig sessionConfig,
                           IMailConfig mailConfig,
                           ITransaction transaction)
                    throws PortalException
        Sets the IMailConfig containing the configurations for sending e-mails.
        Parameters:
        sessionConfig - the user session information.
        mailConfig - the IMailConfig.
        transaction - the transaction for persistence access.
        Throws:
        PortalException - if it was not possible to set the IMailConfig.
        Since:
        4.0.4
        See Also:
        #getMailConfig(ITransaction)
      • sendMail

        void sendMail​(SessionConfig sessionConfig,
                      ISingleMail mail,
                      ITransaction transaction)
               throws PortalException
        Sends an e-mail immediately. This method does not garantee rollback of the e-mail sending as a result of the transaction rollback.
        Parameters:
        sessionConfig - the user session information.
        mail - information about the e-mail to be sent.
        transaction - the transaction for persistence access.
        Throws:
        PortalException - if it was not possible to send the e-mail.
        Since:
        4.0.4
        See Also:
        createSingleMail()
      • addMailToSendQueue

        void addMailToSendQueue​(SessionConfig sessionConfig,
                                ISingleMail mail,
                                String queueId,
                                ITransaction transaction)
                         throws PortalException
        Adds an e-mail to the send queue. The queue is processed in the background and the e-mail will be sent when it is processed.
        Parameters:
        sessionConfig - the user session information.
        mail - information about the e-mail to be sent.
        queueId - the id of the queue where the mail will be added to. If null a new queue will be generated. To generate a new queueId use generateNewQueueId().
        transaction - the transaction for persistence access. If the transaction rollbacks the e-mail will not be added to the queue and not sent.
        Throws:
        PortalException - if it was not possible to queue the the e-mail.
        Since:
        4.0.4
        See Also:
        createSingleMail()
      • addMailToSendQueue

        void addMailToSendQueue​(SessionConfig sessionConfig,
                                IMultipleMail mail,
                                String queueId,
                                ITransaction transaction)
                         throws PortalException
        Adds an e-mail to the send queue. The queue is processed in the background and the e-mail will be sent when it is processed.
        Parameters:
        sessionConfig - the user session information.
        mail - information about the e-mail to be sent.
        queueId - the id of the queue where the mail will be added to. If null a new queue will be generated. To generate a new queueId use generateNewQueueId().
        transaction - the transaction for persistence access. If the transaction rollbacks the e-mail will not be added to the queue and not sent.
        Throws:
        PortalException - if it was not possible to queue the e-mail.
        Since:
        4.0.4
        See Also:
        createMultipleMail()
      • pollMailQueueProcessing

        void pollMailQueueProcessing()
                              throws PortalException
        Verifies the need to create another mail queue process thread, and create it if necessary. This method is called at regular intervals by the portal framework to give the manager the opportunity to span processing threads.
        Throws:
        PortalException - if it was not possible to complete the operation.
        Since:
        4.0.4
      • generateNewQueueId

        String generateNewQueueId()
                           throws PortalException
        Returns a new generated queue id.
        Returns:
        a new generated queue id.
        Throws:
        PortalException - if the queue id could not be generated.
        Since:
        4.0.4
      • deleteMail

        void deleteMail​(SessionConfig sessionConfig,
                        String mailId,
                        ITransaction transaction)
                 throws PortalException
        Deletes a mail and all its internal components (body, attachments, destinations).
        Parameters:
        sessionConfig - the user session information.
        mailId - the mail's id.
        transaction - the transaction for persistence access.
        Throws:
        PortalException - if it was not possible to delete the mail.
        Since:
        4.0.4
      • deleteMailDestination

        void deleteMailDestination​(SessionConfig sessionConfig,
                                   String mailDestinationId,
                                   ITransaction transaction)
                            throws PortalException
        Deletes a mail destination.
        Parameters:
        sessionConfig - the user session information.
        mailDestinationId - the mail destination's id.
        transaction - the transaction for persistence access.
        Throws:
        PortalException - if it was not possible to delete the mail destination.
        Since:
        8.1.0