I want to send an email with django and I want the body
of email to contains content from .txt
file. I import from my templates. I went through the docs but I didn't find how to do it.
Here is what I have in my views.py:
send_mail('TEST', 'myfile.txt', 'admin@test.com', [test@test.com], fail_silently=False)
I tried to add myfile.txt
to my template directory. But when I replace 'myfile.txt'
by myfile.txt
in send_mail()
, I off course got an error because myfile.txt
is not a defined variable. Any idea on how I can accomplish that?