Support folder other than INBOX

Originally from https://github.com/elasticsearch/logstash/pull/921