try {
emailService.sendEmailAsync(to, emailSubject, emailText, true, null, inline);
} catch (MessagingException ex) {
+ // WARNING!!!!
+ // Because we are using @Async we will never catch thrown exceptions from sendEmailAsync.
+ // Exceptions will be caught by org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler. :(
LOGGER.error("Send email error", ex);
}
}
<!-- Enable Asynchronous Spring Tasks -->
<task:annotation-driven />
<task:executor id="asyncEmailSender" pool-size="1-10" keep-alive="60"
- queue-capacity="10" rejection-policy="CALLER_RUNS" />
+ queue-capacity="0" rejection-policy="CALLER_RUNS" />
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">