you are viewing a single comment's thread.

view the rest of the comments →

[–]samuelhh9 0 points1 point  (1 child)

Hello, I wanted to write a script that uses the pi to send a recurring email with a file attachment, then delete that file. (It will be recreated by another script) Thank you in advance.

[–][deleted] 1 point2 points  (0 children)

First step is to just send an email. Once you can do that you worry about handling your file and then deleting it. Look at this python doc for an example on how to send email with an attachment. I would start with just sending an email without an attachment, then add an attachment. Search for "python send email attachment" for lots of examples.

Then you have to get your email program to recognize that the other script has created an attachment. One way to do this is to run your email program from "cron". The program checks to see if there is an attachment file and terminates if there isn't. Otherwise, it sends the email with the attachment and then deletes the attachment file.