Export file via email on Streamlit

Hello everyone and thanks for this amazing library for creating data science apps.

I have a question please, do you have any I idea how to send results like excel/csv file directly to a specific email adress after running my python script ?? since my algorithm can take several minutes or hours, so itโ€™s better to send the file when it finishs the work instead of checking every minute if it finishs or not !

Thank you for your help !

PS: Now, Iโ€™m downloading the files directly through a link

HI @Sameh,

You can use pythonโ€™s smtp module with the mailserver configuration for your sender mail address and send the results as an attachment.
I found this article at realpython really nice when I was exploring smtplib. You might find it helpful as well, https://realpython.com/python-send-email/#adding-attachments-using-the-email-package

2 Likes

thank you, Iโ€™ll try it and give u my feedback.