Package com.apgar.common.lib.mail
Class MailBean
java.lang.Object
com.apgar.common.lib.mail.MailBean
Represents a mail configuration bean that retrieves SMTP settings from environment variables or ebx.properties file.
- Author:
- APGAR Consulting
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the email activation status from environment variables.Retrieves the email activation status from ebx.mail.activate property in ebx.properties file.getLogin()Gets the login for the SMTP server.Gets the password for the SMTP server.Gets the SMTP host.Gets the SMTP port.getSsl()Gets the SSL activation status for the SMTP connection.voidsetEmailActivationFromDeploymentVariable(String emailActivationFromDeploymentVariable) Sets the email activation status from the deployment variable.voidsetEmailActivationFromEbxProperties(String emailActivationFromEbxProperties) Sets the email activation status.voidSets the login for the SMTP server.voidsetPassword(String password) Sets the password for the SMTP server.voidsetSmtpHost(String smtpHost) Sets the SMTP host.voidsetSmtpPort(String smtpPort) Sets the SMTP port.voidSets the SSL activation status for the SMTP connection.
-
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
Gets the SMTP host.- Returns:
- the SMTP host as a String
-
setSmtpHost
Sets the SMTP host.- Parameters:
smtpHost- the SMTP host to set
-
getSmtpPort
Gets the SMTP port.- Returns:
- the SMTP port as a String
-
setSmtpPort
Sets the SMTP port.- Parameters:
smtpPort- the SMTP port to set
-
getLogin
Gets the login for the SMTP server.- Returns:
- the SMTP login as a String
-
setLogin
Sets the login for the SMTP server.- Parameters:
login- the SMTP login to set
-
getPassword
Gets the password for the SMTP server.- Returns:
- the SMTP password as a String
-
setPassword
Sets the password for the SMTP server.- Parameters:
password- the SMTP password to set
-
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
Sets the SSL activation status for the SMTP connection.- Parameters:
ssl- the SSL activation status to set, expected to be "true" or "false".
-
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
Sets the email activation status.- Parameters:
emailActivationFromEbxProperties- the email activation status to set, expected to be "true" or "false".
-
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
Sets the email activation status from the deployment variable.- Parameters:
emailActivationFromDeploymentVariable- the email activation status to set, expected to be "true" or "false".
-