I want to sent a mail for multiple recipients after click the OK button and then show the in progress label in JFrame while sending a mail, but it shows a label after mail sent, how to solve it
JLabel title = new JLabel("In Progress");
title.setVisible(false);
title.setBounds(160, 50, 250, 40);
f.add(jb);
f.add(title);
JButton b = new JButton("submit");
b.setBounds(120,120, 80,30);
f.add(b);
f.setSize(500,400);
f.setLayout(null);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if (!title.isVisible()) {
title.setVisible(true);
}
Properties props = new Properties();
props.put("mail.smtp.host",host);
props.put("mail.smtp.auth", "true");
Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user,password);
}
});
ArrayList<String> arr = new ArrayList<String>();
try (BufferedReader br = new BufferedReader(new FileReader("E:/selenium/mailid.csv"))) {
String sCurrentLine;
while ((sCurrentLine = br.readLine()) != null) {
arr.add(sCurrentLine);
}
} catch (IOException e) {
e.printStackTrace();
}