From a1d6065c7535de524aaa66af1dd97e146bca7c85 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Fri, 1 Sep 2017 16:11:59 +0530 Subject: [PATCH] Sending email only when the mail transport is enabled. --- .../email/sender/core/service/EmailSenderServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/service/EmailSenderServiceImpl.java b/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/service/EmailSenderServiceImpl.java index daaf8f61029..791b61daa9d 100644 --- a/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/service/EmailSenderServiceImpl.java +++ b/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/service/EmailSenderServiceImpl.java @@ -71,12 +71,14 @@ public class EmailSenderServiceImpl implements EmailSenderService { if(EmailSenderDataHolder.getInstance().getConfigurationContextService() .getServerConfigContext().getAxisConfiguration().getTransportOut(transportSenderName) == null){ log.warn("Email invitation is not sent as the email is not configured."); + } else { + threadPoolExecutor.submit(new EmailSender(recipient, emailData.getSubject(), emailData.getBody())); } } catch (ContentProcessingInterruptedException e) { throw new EmailSendingFailedException("Error occurred while retrieving email content to be " + "sent for recipient '" + recipient + "'", e); } - threadPoolExecutor.submit(new EmailSender(recipient, emailData.getSubject(), emailData.getBody())); + } }