// Get the default session
final Session session = getSessionInstance(System.getProperties());
// Get an email message store, and connect to it
final Store store = getStore(session, info.getType());
store.connect(server, port, info.getUsername(), info.getPassword());
// Try to get the default folder
Folder folder = store.getDefaultFolder();
if (folder == null) {
throw new MessagingException("No default folder");