code: public static Session getSession(final ServerSetup setup, Properties mailProps) {
          Properties props = setup.configureJavaMailSessionProperties(mailProps, false);
  
          log.debug("Mail session properties are {}", props);
  
          return Session.getInstance(props, null);
      }
docs: Gets a JavaMail Session for given server type such as IMAP and additional props for JavaMail.
  
  @param setup     the setup type, such as <code>ServerSetup.IMAP</code>
  @param mailProps additional mail properties.
  @return the JavaMail session.