I would like to create a text file in Python, write something to it, and then e-mail it out (put test.txt
as an email attachment).
However, I cannot save this file locally. Does anyone know how to go about doing this?
As soon as I open the text file to write in, it is saved locally on my computer.
f = open("test.txt","w+")
I am using smtplib
and MIMEMultipart
to send the mail.