Results 1 to 7 of 7

Thread: java mail hangs

  1. #1
    ashwinkumar18 is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default java mail hangs

    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?

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Show us the code, I did much Java send email in spring and Java Mail

  3. #3
    ashwinkumar18 is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default

    Java 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);

  4. #4
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Have you ever heard about Observable?

  5. #5
    ashwinkumar18 is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default

    nope am very new to java


    pls enlighten me

  6. #6
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Try to google and find simple example of Observable.

  7. #7
    ashwinkumar18 is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

Similar Threads

  1. Replies: 2
    Last Post: 05-05-2008, 06:01 AM
  2. Retreiving of mail body using mail number
    By chandu.v09 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-13-2008, 02:25 PM
  3. java mail server
    By krismedia in forum New To Java
    Replies: 2
    Last Post: 01-23-2008, 04:41 AM
  4. Send a pic through mail, in java
    By lenny in forum Advanced Java
    Replies: 1
    Last Post: 07-25-2007, 02:49 PM
  5. Sending a mail with the local mail program
    By thedude in forum Advanced Java
    Replies: 2
    Last Post: 07-23-2007, 12:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •