hi
i am trying to send mail through java . The java application hangs temporarily or blocks while the mail is being sent.
how could i avoid this?
Printable View
hi
i am trying to send mail through java . The java application hangs temporarily or blocks while the mail is being sent.
how could i avoid this?
Show us the code, I did much Java send email in spring and Java Mail
Code:boolean debug = false;
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
session.setDebug(debug);
Message msgs = new MimeMessage(session);
InternetAddress addressFrom = new InternetAddress(emailFromAddress);
msgs.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recieverList.length];
for ( int h = 0; h< recieverList.length;h++) {
addressTo[h] = new InternetAddress(recieverList[h].toString().trim());
}
msgs.setRecipients(Message.RecipientType.TO, addressTo);
msgs.setSubject(Compose.subject);
msgs.setContent(Compose.body, "text/plain");
exitgui();
MailSent ms = new MailSent();
ms.setVisible(true); [B]// i wish to display a pls wait icon in this screen , but it is blocked till the mail is sent[/B]
Transport.send(msgs);
Have you ever heard about Observable?
nope am very new to java
pls enlighten me
Try to google and find simple example of Observable.
oka !!doing it!!
thank you