Use Rex to encode multipart MIME message.

Thanks to Juan Vazquez, figured out that the 'binary' flag was the only
thing missing from the original implementation.