Class MailProvider

java.lang.Object
org.nuclos.api.provider.MailProvider

public class MailProvider extends Object
This class is used in rule programming and provides methods for sending and receiving E-mails.

Please check Nuclos system parameter for setting connection parameter like POP3/SMTP

Author:
Matthias Reichart
  • Constructor Details

    • MailProvider

      public MailProvider()
  • Method Details

    • setMailService

      public void setMailService(MailService repService)
    • send

      public static void send(NuclosMail mail) throws BusinessException
      This method sends a NuclosMail All connection settings like POP3/SMTP must be set in Nuclos as system parameters
      Parameters:
      mail - NuclosMail - email to send
      Throws:
      BusinessException
    • send

      public static void send(InputStream is) throws BusinessException
      Takes an email as an .eml from an input stream and sends it.
      Parameters:
      is - - input stream, which holds the email as a .eml
      Throws:
      BusinessException - - problem, which occurred while attempting to send
    • receive

      public static List<NuclosMail> receive(boolean bDeleteMails) throws BusinessException
      This method retrieves all NuclosMails that can be found in the Inbox of the account mentioned in the system parameters.

      If argument 'bDeleteMails' is true, all mails will be deleted after retrieving them from the server.

      All connection settings like POP3/SMTP must be set in Nuclos as system parameters

      Parameters:
      bDeleteMails - - bDeleteMails
      Returns:
      List of NuclosFile
      Throws:
      BusinessException
    • receive

      public static List<NuclosMail> receive(String folderFrom, boolean bDeleteMails) throws BusinessException
      This method retrieves all NuclosMails that can be found in the specified folder of the account mentioned in the system parameters.

      Fetching mails from specific folders only works via IMAP. For POP3 the folder is always "INBOX".

      If argument 'bDeleteMails' is true, all mails will be deleted after retrieving them from the server.

      All connection settings like POP3/SMTP must be set in Nuclos as system parameters

      Parameters:
      folderFrom -
      bDeleteMails - - bDeleteMails
      Returns:
      List of NuclosFile
      Throws:
      BusinessException
    • transformToEml

      public static void transformToEml(NuclosMail nuclosMail, OutputStream outputStream) throws BusinessException
      Transforms a NuclosMail to the EML format and writes it to the specified OutputStream.
      Parameters:
      nuclosMail - - NuclosMail, that should be transformed
      outputStream - - OutputStream, where the EML is written to
      Throws:
      BusinessException