Class MailBean

java.lang.Object
com.apgar.common.lib.mail.MailBean

public class MailBean extends Object
Represents a mail configuration bean that retrieves SMTP settings from environment variables or ebx.properties file.
Author:
APGAR Consulting
  • Constructor Details

    • MailBean

      public MailBean()
      Constructs a new MailBean instance.

      It initializes the SMTP settings based on the availability of environment variables. If the environment variables are not set, it defaults to the values defined in the properties file.

      The following settings are retrieved:

      • smtpHost: Obtained from the environment variable EBX_SMTP_HOST or from property ebx.mail.smtp.host in ebx.properties.
      • smtpPort: Obtained from the environment variable EBX_SMTP_PORT or from property ebx.mail.smtp.port in ebx.properties.
      • login: Obtained from the environment variable EBX_SMTP_LOGIN or from property ebx.mail.smtp.login in ebx.properties.
      • password: Obtained from the environment variable EBX_SMTP_PASSWORD or from property ebx.mail.smtp.password in ebx.properties.
      • ssl: Obtained from the environment variable EBX_SMTP_SSL_ENABLED or from property ebx.mail.smtp.ssl.activate in ebx.properties.
      • emailActivationFromEbxProperties: Retrieved from property ebx.mail.activate in ebx.properties.
      • emailActivationFromDeploymentVariable: Set to "true" if the environment variable EBX_SMTP_HOST exists.
  • Method Details

    • getSmtpHost

      public String getSmtpHost()
      Gets the SMTP host.
      Returns:
      the SMTP host as a String
    • setSmtpHost

      public void setSmtpHost(String smtpHost)
      Sets the SMTP host.
      Parameters:
      smtpHost - the SMTP host to set
    • getSmtpPort

      public String getSmtpPort()
      Gets the SMTP port.
      Returns:
      the SMTP port as a String
    • setSmtpPort

      public void setSmtpPort(String smtpPort)
      Sets the SMTP port.
      Parameters:
      smtpPort - the SMTP port to set
    • getLogin

      public String getLogin()
      Gets the login for the SMTP server.
      Returns:
      the SMTP login as a String
    • setLogin

      public void setLogin(String login)
      Sets the login for the SMTP server.
      Parameters:
      login - the SMTP login to set
    • getPassword

      public String getPassword()
      Gets the password for the SMTP server.
      Returns:
      the SMTP password as a String
    • setPassword

      public void setPassword(String password)
      Sets the password for the SMTP server.
      Parameters:
      password - the SMTP password to set
    • getSsl

      public String getSsl()
      Gets the SSL activation status for the SMTP connection.
      Returns:
      the SSL activation status as a String, expected to be "true" or "false".
    • setSsl

      public void setSsl(String ssl)
      Sets the SSL activation status for the SMTP connection.
      Parameters:
      ssl - the SSL activation status to set, expected to be "true" or "false".
    • getEmailActivationFromEbxProperties

      public String getEmailActivationFromEbxProperties()
      Retrieves the email activation status from ebx.mail.activate property in ebx.properties file.
      Returns:
      the email activation status as a String, expected to be "true" or "false".
    • setEmailActivationFromEbxProperties

      public void setEmailActivationFromEbxProperties(String emailActivationFromEbxProperties)
      Sets the email activation status.
      Parameters:
      emailActivationFromEbxProperties - the email activation status to set, expected to be "true" or "false".
    • getEmailActivationFromDeploymentVariable

      public String getEmailActivationFromDeploymentVariable()
      Gets the email activation status from environment variables.
      Returns:
      a String indicating the email activation status, expected to be "true" or "false". Returns "true" if the settings are sourced from environment variables; otherwise, returns "false".
    • setEmailActivationFromDeploymentVariable

      public void setEmailActivationFromDeploymentVariable(String emailActivationFromDeploymentVariable)
      Sets the email activation status from the deployment variable.
      Parameters:
      emailActivationFromDeploymentVariable - the email activation status to set, expected to be "true" or "false".