throw error message on test email config failure (#15311)

This commit is contained in:
Ashish Gupta 2024-02-22 18:17:31 +05:30 committed by GitHub
parent a499c3e36a
commit 3adc1e5d9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -274,7 +274,7 @@ public class EmailUtil {
}
public static void sendMail(Email email, boolean async) {
if (mailer != null && getSmtpSettings().getEnableSmtpServer()) {
if (Boolean.TRUE.equals(getSmtpSettings().getEnableSmtpServer()) && mailer != null) {
mailer.sendMail(email, async);
} else {
LOG.error("Mailer is not initialized or Smtp is not Enabled.");
@ -384,7 +384,11 @@ public class EmailUtil {
}
public static void testConnection() {
mailer.testConnection();
if (Boolean.TRUE.equals(getSmtpSettings().getEnableSmtpServer()) && mailer != null) {
mailer.testConnection();
} else {
LOG.error("Mailer is not initialized or Smtp is not Enabled.");
}
}
private static String getEmailVerificationSubject() {