Add support for autodetcing mail type