Skip to content

Commit 4299d8b

Browse files
Added logs when sending email
1 parent 0a84d41 commit 4299d8b

File tree

1 file changed

+3
-1
lines changed
  • notification-sdk/src/main/java/org/sunbird/notification/email

1 file changed

+3
-1
lines changed

notification-sdk/src/main/java/org/sunbird/notification/email/Email.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ private Multipart createMultipartData(String emailBody, String filePath)
251251
private void addRecipient(MimeMessage message, RecipientType type, List<String> recipient)
252252
throws AddressException, MessagingException {
253253
if (CollectionUtils.isEmpty(recipient)) {
254-
logger.info("Recipient list is empty or null ");
254+
logger.info("Recipient list is empty or null for type : " + type.toString());
255255
return;
256256
}
257257
for (String email : recipient) {
@@ -304,6 +304,7 @@ public boolean sendMail(
304304
List<String> emailList, String subject, String body, List<String> ccEmailList, List<String> bccList) {
305305
boolean response = true;
306306
Session session = getSession();
307+
long startTime = System.currentTimeMillis();
307308
try {
308309
MimeMessage message = new MimeMessage(session);
309310
addRecipient(message, Message.RecipientType.TO, emailList);
@@ -315,6 +316,7 @@ public boolean sendMail(
315316
response = false;
316317
logger.error("Exception occured during email sending " + e.getMessage(), e);
317318
}
319+
logger.info("Email Sent. Time taken (in ms): " + (System.currentTimeMillis() - startTime));
318320
return response;
319321
}
320322

0 commit comments

Comments
 (0)