added support for plain text and html emails