I have a view which generates a PDF file and returns it as a HtmlResponse. Then the suitable URL shows that file. I want to be able to attach that pdf to an e-mail. Which is the best way to do this?
Any tips or examples are appreciated!
I have a view which generates a PDF file and returns it as a HtmlResponse. Then the suitable URL shows that file. I want to be able to attach that pdf to an e-mail. Which is the best way to do this?
Any tips or examples are appreciated!
You can use
EmailMessage.attach()
Assuming you have a method
create_pdf
that creates your PDF, you should be able to do something like this: