I have the below program which send the mail using java mail api ,i want to modify in terms of parallel execution by using executor framework that i want that 5 different threads independently should trigger my this program but those 5 different threads should trigger simultaneously at the same time , please advise how to modify the below piece of code so that i can add executor framework in it and that will divide the task of sending the mails into five different threads and those independent 5 threads will send the mail at the same time
public class SSendEmail implements Runnable {
public static void main(String [] args) throws Exception, IOException, Exception{
for(int i=0;i<5;i++) {
new Thread(new SSendMail()).start();
}
}
public void run() {
String smtpHost = "xxx";
String mailSmtpPort = "000";
String mailTo[] = {"sart@wer.com" };
String mailCc[] = {"sart@wer.com" };
xxsendmail(mailTo, mailCc, "sendername",
"testsubject.", "testsubject..", smtpHost , mailSmtpPort);
}
}