title: How to set socks proxy username/password in java mail
body: <p>I am using javamail for sending mail (SMTP protocol) as follows</p>
  
  <pre><code>String host = "smtp.gmail.com";
  :
  props.put("mail.smtp.auth", "true");
  
  props.put("mail.smtp.socks.host","sock_proxy_host");
  props.put("mail.smtp.socks.port","sock_proxy_port");
  
  Session session = Session.getInstance(props,new javax.mail.Authenticator() {
          protected PasswordAuthentication getPasswordAuthentication() {
                  return new PasswordAuthentication("..", "..");
          }
  });
  </code></pre>
  
  <p>But the socks proxy i am using requires a basic authentication. I am trying to setting the credential as </p>
  
  <pre><code>System.setProperty("java.net.socks.username", "socks_username");             
  System.setProperty("java.net.socks.password", "socks_passwd");
  </code></pre>
  
  <p>Is there any other way to set the socks proxy username/password (using javamail API)?</p>