Class PropertiesMailService

java.lang.Object
overit.geocall.config.company.PropertiesMailService

public class PropertiesMailService extends Object
class containing the configurations related to the configured mail services.
note: all the configuration refers to the company whose the identity belongs to.
  • Method Details

    • services

      public static List<String> services(Company company)
      Get the list of the names for the configured mail services.
      Parameters:
      company - the company from which extract the configuration
      Returns:
      the names of the configured mail service. If there's no mail service configured, this method will return an empty list.
    • host

      public static String host(Company company, String mailService)
      Retrieve the hostname associated to the mail server.
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      the service hostname or null if it is not configured
    • port

      public static Integer port(Company company, String mailService)
      Retrieve the listening port of the mail server.
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      the service port or null if it is not configured
    • provider

      public static String provider(Company company, String mailService)
      Retrieve the provider configuration string. Typically, this configuration is composed by different parameters separated by spaces. The first parameter is always the protocol that will be used, and this could be:
      • smtp
      • smtps
      After that it i s possible to configure other parameters:
      • tls: to enable the startTLS support
      • sendpartial: to send the message even if there's any invalid addresses within the recipient's list
      • dsn: to enable the Delivery Status Notification
      • delay=5: to set a defined delay (expressed in seconds) after the message has been sent
      • timeout=10: to set a timeout (expressed in seconds) during the message sending
      • ssl=10: specifies the SSL protocols that will be enabled for SSL connection (i.e. SSLv2Hello, SSLv3, TLSv1, TLSv1.1 or TLSv1.2)
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      the service provider configuration or null if it is not configured
    • username

      public static String username(Company company, String mailService)
      Retrieve the username used to authenticate with the mail server.
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      the username that will be used within the authentication or null if it is not configured
    • password

      public static String password(Company company, String mailService)
      Retrieve the password used to authenticate with the mail server.
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      the password that will be used within the authentication or null if it is not configured
    • clientId

      public static String clientId(Company company, String mailService)
      Retrieve the client id used to authenticate with OAuth.
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      the client id that will be used within the OAuth authentication or null if it is not configured.
    • clientSecret

      public static String clientSecret(Company company, String mailService)
      Retrieve the client secret used to authenticate with OAuth.
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      the client secret that will be used within the OAuth authentication or null if it is not configured.
    • tokenUrl

      public static String tokenUrl(Company company, String mailService)
      Retrieve the token url used to authenticate with OAuth.
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      the token url that will be used within the OAuth authentication or null if it is not configured.
    • oauthSystemUser

      public static String oauthSystemUser(Company company, String mailService)
      Retrieve the OAuth system user used to perform the POST. Alternatively can be used also the ID of the user in Azure.
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      the OAuth system user used to perform the POST or null if it is not configured.
    • sendBySystemUser

      public static boolean sendBySystemUser(Company company, String mailService)
      Retrieve the boolean value indicating if send by system user capability is enabled or not. If this value is false then the email will be sent by the user obtained from the filed "From" of the message object.
      Parameters:
      company - the company from which extract the configuration
      mailService - the name of the selected mail service
      Returns:
      true if is enabled, false otherwise
    • getMailServer

      public static MailServer getMailServer(Company company, String mailService)
      Get the MailServer instance starting from the configuration related to the passed company
      Parameters:
      company - the company from which extract the configuration
      mailService - the identifier of the mail service configuration
      Returns:
      the mail sever instance or null if it cannot be retrieved
      Throws:
      overit.geocall.asserts.AssertsException - if the passed company is null