How to create and attach a file to an email without saving the file?

109 Views Asked by At

I am trying to add a function to my website where a button will attach a PDF of the window to an email that the user enters. I am using Flask-Mail to send the email, and just printing the window to create the PDF. Right now, the email will send, and I am able to attach something. The problem is that I would like to create the PDF and attach it without the file saving to the user's device.

How should I go about this? My code is written in Python and JavaScript. I have seen other threads with c# code where you can use the memory stream to do something like attaching a file without saving it. Is there something similar that could be achieved with Python?

0

There are 0 best solutions below