try {
final Message newMessage = getMessage();
if (newMessage != null) {
// Retrieve an outbox to save the message in
final Store store = Session.waitForDefaultSession().getStore();
final Folder[] allOutboxFolders = store.list(Folder.OUTBOX);
Folder outbox = null;
for (int i = allOutboxFolders.length - 1; i >= 0; --i) {
final Folder parent = allOutboxFolders[i].getParent();
if (parent != null