- Code: Select all
fname = "D:\\datas"+year+month+day+".htm"
infile = open(fname, 'r')
data = infile.read()
fromaddr = "XXXXX@gmail.com"
toaddrs = "XXXXXX@gmail.com"
server = smtplib.SMTP('smtp.gmail.com:587')
server.sendmail(fromaddr, toaddrs, data)
the code supposed to transfer a .htm document to an email and than to delete it.
the only problem with that script is that the os.remove() in the end just not working, tried it in seperate file and it worked perfectly fine.
anyone has an idea how to fix this problem?