The title basically sums up my issue at the moment. If I have multiple instances of the Job running at/around the same time, Javamail throws an exception as it's meant to be used synchronously. Is there a way I can make it run asynchronously? Or is there an alternative to Javamail that is asynchronous?
I think there are several ways to deal with such kind of tasks:
send each email in its on thread, i.e. imply separate SMTP connection;
@Async
public void sendEmail(String smtpServer, String to,String from,String subject, String body) {
send(smtpServer, to, from, subject, body);
}