Fixed the way of rendering the templates when sending emails.

Way of rendering the template(html/text) is changed using the isinstance(python in-buit function).

Review ID - 9253010