title: JavaMail: How to solve SocketException?
body: <p>I am using the following code to send emails from a Java application. On my computer it works fine, on second computer too, but on another computer (in the same network) it doesn't, although we're using the same connection settings.</p>
  
  <pre><code>public void connect() throws MessagingException
  {
      Authenticator auth = new Authenticator(){ 
          @Override
          protected PasswordAuthentication getPasswordAuthentication()
          {
              return new PasswordAuthentication(smtpUser, smtpPassword);
          }
      };
      Properties props = new Properties();
      props.put("mail.smtp.host", this.smtpServer);
      props.put("mail.smtp.auth", true); 
  
      session = Session.getDefaultInstance(props, auth);
  
      store = session.getStore(this.protocol);
      store.connect(this.mailboxServer, this.user, this.password);  //&lt;-- exception is thrown here
  
  }
  </code></pre>
  
  <p>This is the exception I get: </p>
  
  <pre><code>javax.mail.MessagingException: connect failed; 
  nested exception is: 
      java.net.SocketException: Permission denied: connect
      at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:161)
      at javax.mail.Service.connect(Service.java:288)
      at javax.mail.Service.connect(Service.java:169)
      at com.myapp.MailboxConnection.connect(MailboxConnection.java:66)
  caused by: java.net.SocketException: Permission denied: connect
  </code></pre>
  
  <p>What could be the reason that it doesn't work on one computer?</p>