Skip to content

Commit 3ab9698

Browse files
committed
#85 In case of exceptions, log the failed email
1 parent 354cb74 commit 3ab9698

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/org/simplejavamail/mailer/internal/mailsender/MailSender.java

+5
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,14 @@ private void sendMailClosure(final Session session, final Email email) {
264264
checkShutDownRunningProcesses();
265265
}
266266
} catch (final UnsupportedEncodingException e) {
267+
LOGGER.error("Failed to send email:\n{}", email);
267268
throw new MailSenderException(MailSenderException.INVALID_ENCODING, e);
268269
} catch (final MessagingException e) {
270+
LOGGER.error("Failed to send email:\n{}", email);
269271
throw new MailSenderException(MailSenderException.GENERIC_ERROR, e);
272+
} catch (final Exception e) {
273+
LOGGER.error("Failed to send email:\n{}", email);
274+
throw e;
270275
}
271276
}
272277

0 commit comments

Comments
 (0)