added support for html and text email templates