Move IMAP operations that were done in mx_commit_message to a dedicated imap_commit_message function.