Minor change to send the email functionality.

In order to handle for rendering the templates for sending the mails is changed by using isinstance.

Review ID - 9253010