fix message parsing, lookup mimetype