Useful functions to ease IMAP operations