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