from django.template.loader import render_to_string def my_view(request): ... email_body = render_to_string( 'my_template.txt', context, request=request)