title: What is the difference between getDefaultInstance() and getInstance() in Session class?
body: <p>What is the difference between <code>Session.getDefaultInstance(props, authenticator)</code> and <code>getInstance(props, authenticator)</code>?  In general, when will you choose one over the other?</p>
  
  <p>I also read Java doc on <a href="https://javamail.java.net/nonav/docs/api/javax/mail/Session.html#getDefaultInstance%28java.util.Properties,%20javax.mail.Authenticator%29" rel="noreferrer">getDefaultInstance(props, authenticator)</a>, but still couldn't able to make out the difference distinctly/clearly.</p>
  
  <p>Hope experts can help me in understanding this better.</p>
  
  <p><strong>UPDATE:</strong> Actual reason that triggered to ask this question is: We've used <code>Session.getDefaultInstance()</code> method in some places within our web-based application.  Sometimes, it throws <code>java.lang.SecurityException: Access to default session denied</code>, on quick googling, it suggested to use <code>Session.getInstance()</code> method instead. Hence, when one would choose one over the other?</p>