java - Quartz job to send email using Javamail, but Javamail is synchronous -
the title sums issue @ moment. if have multiple instances of job running at/around same time, javamail throws exception it's meant used synchronously. there way can make run asynchronously? or there alternative javamail asynchronous?
i think there several ways deal such kind of tasks:
- wrap service periodically send batch of emails;
send each email in 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); }
Comments
Post a Comment