I have a scheduled python script that was working fine in April. Then on May 1st it stopped working. The script still runs without an error but the message body is empty. Any idea why?
Also I tried running via the console and had the same problem. My code:
# import smtplib for the actual sending function
import smtplib
import datetime
now = datetime.datetime.now()
todays_date = str(now.month) + '-' + str(now.day) + '-' + str(now.year)
# import the email modules we'll need
from email.mime.text import MIMEText
# open a plain text file for reading.
textfile = 'rtm-completed'+ todays_date + '.txt'
print textfile
fp = open(textfile, 'rb')
# create a plain text message
msg = MIMEText(fp.read())
fp.close
print msg.as_string()
me = 'email@gmail.com'
you = 'trigger@recipe.ifttt.com'
msg['Subject'] = 'Completed Tasks Today'
msg['From'] = me
msg['To'] = you
username = 'email'
password = 'password'
# send the message via our own SMTP server, but don't include the
# envelope header
s = smtplib.SMTP('smtp.gmail.com:587')
s.ehlo()
s.starttls()
s.login(username, password)
s.sendmail(me, you, msg.as_string())
s.quit()
[edit by admin: formatting]