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:

  1. wrap service periodically send batch of emails;
  2. 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

Popular posts from this blog

c# SetCompatibleTextRenderingDefault must be called before the first -

c++ - Fill runtime data at compile time with templates -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -