Results 1 to 4 of 4
  1. #1
    Naren222 is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    Default Javamail, occasionally i get "no buffer space available,maximum connections reached"

    Hello everyone,

    I am using javax.mail.* package and its API's to send e-mail, as in the below link.
    [Moderator edit: link removed]

    3 out of 10 times i get this error and its random.
    "no buffer space available maximum connections reached". Am using it on Windows XP service pack 3.

    What might be going wrong ?

    Regards,
    Naren
    Last edited by DarrylBurke; 06-25-2013 at 01:52 PM. Reason: Removed spammy link

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,045
    Rep Power
    23

    Default Re: Javamail, occasionally i get "no buffer space available,maximum connections reach

    If you want advice on your code, post that code here after first going through the http://www.java-forums.org/forum-gui...w-members.html and BB Code List - Java Programming Forum - Learn Java Programming

    I've removed the link to an external site.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Naren222 is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    Default Re: Javamail, occasionally i get "no buffer space available,maximum connections reach

    Hello everyone,

    I am using javax.mail.* package and its API's to send e-mail, as below

    3 out of 10 times i get this error and its random.
    "no buffer space available maximum connections reached". Am using it on Windows XP service pack 3.

    What might be going wrong and where ?

    Regards,
    Naren


    Java Code:
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.MimeMessage;
    import javax.mail.internet.MimeMessage.RecipientType;
    import javax.mail.internet.MimeMultipart;
    
    
    public class SendEmail
    {
       public static void main(String [] args)
       {    
    
          String to = "abc@company.com";
          String from = "AutomaticMailer@company.com";
          String host = "mail.company-name.com";
          String attachFile = "C:/Report.txt";
          String attachFileName = "Report.txt";
          
          String attachFile1 = "C:/SupportFile.txt";
          String attachFileName1 = "SupportFile.txt";
          
          String attachFile2 = "C:/Commands.txt";
          String attachFileName2 = "CheckModulesCommands.txt";
          
          Properties properties = System.getProperties();
          properties.setProperty("mail.smtp.host", host);
    
          Session session = Session.getDefaultInstance(properties);
    
          try
          {
             MimeMessage message = new MimeMessage(session);
             message.setFrom(new InternetAddress(from));
    
             message.addRecipients(Message.RecipientType.TO, InternetAddress.parse(to));
             message.setSubject("This is the Subject Line!");
             message.setText("This is actual message");
             MimeBodyPart messageBodyPart = new MimeBodyPart();  
    
             messageBodyPart.setText("Test mail one");  
             Multipart multipart = new MimeMultipart("mixed");  
             multipart.addBodyPart(messageBodyPart);  
             
             // File 1 attachment
             messageBodyPart = new MimeBodyPart();  
             DataSource source = new FileDataSource(attachFile);  
             messageBodyPart.setDataHandler(new DataHandler(source));  
             messageBodyPart.setFileName(attachFileName);
             multipart.addBodyPart(messageBodyPart);
             
             // File 2 attachment
             messageBodyPart = new MimeBodyPart();  
             DataSource source1 = new FileDataSource(attachFile1);  
             messageBodyPart.setDataHandler(new DataHandler(source1));  
             messageBodyPart.setFileName(attachFileName1);
             multipart.addBodyPart(messageBodyPart);
             
             
             // Third attachment
             messageBodyPart = new MimeBodyPart();  
             DataSource source2 = new FileDataSource(attachFile2);  
             messageBodyPart.setDataHandler(new DataHandler(source2));  
             messageBodyPart.setFileName(attachFileName2);
             multipart.addBodyPart(messageBodyPart);
             
             message.setContent(multipart);  
             
             // Send message
             Transport.send(message);
             
             System.out.println("Sent message successfully !!!!!!");
                      
          }
          catch (MessagingException mex)
          {
             mex.printStackTrace();
          }
       }
    }

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,045
    Rep Power
    23

    Default Re: Javamail, occasionally i get "no buffer space available,maximum connections reach

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 0
    Last Post: 12-07-2012, 09:29 AM
  2. Replies: 1
    Last Post: 11-09-2012, 10:07 PM
  3. "Producer Consumer" Integer Buffer
    By Java101 in forum Threads and Synchronization
    Replies: 12
    Last Post: 01-26-2012, 07:13 PM
  4. Replies: 2
    Last Post: 10-03-2011, 06:22 PM
  5. Replies: 2
    Last Post: 01-24-2011, 01:26 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
  •