Class EmailNotificationService
java.lang.Object
cf.maybelambda.httpvalidator.springboot.service.EmailNotificationService
Service to send email notifications using external SMTP service.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the email configuration is valid.void
sendAppTerminatedNotification
(String endTime) Sends a notification email about application termination.void
sendVTaskErrorsNotification
(List<String[]> mailBody) Sends a notification email with validation task failure results.
-
Constructor Details
-
EmailNotificationService
-
-
Method Details
-
sendVTaskErrorsNotification
Sends a notification email with validation task failure results.- Parameters:
mailBody
- A list of validation task failure results.- Throws:
ConnectIOException
- If an error occurs while sending the email.
-
sendAppTerminatedNotification
Sends a notification email about application termination.- Parameters:
endTime
- The end time of the application.- Throws:
ConnectIOException
- If an error occurs while sending the email.
-
isValidConfig
public boolean isValidConfig()Checks if the email configuration is valid.This method verifies that the necessary properties for sending emails are properly configured in the environment. Specifically, it checks:
- The "notifications.from" property, which should contain the sender's email address.
- The "notifications.to" property, which should contain the recipient's email address.
- The "mailer.apikey" property, which should contain the API key for authentication with SMTP service.
- Returns:
- True if all necessary properties are set and non-blank, false otherwise.
-