handling of mail binary in a more generic way