- Joined
- Jan 14, 2011
ok so heres my script i found something some one cooked up to generate a future date in time depending on a certain number of days.
for instance this email will be sending on friday reminding people to turn in paperwork for the week ending in "sundays date" two days in the future.
i cant figure out how to put a string in the message if i put a %x for instance or even %m/%d/%y it just shows exactly like that.
for instance this email will be sending on friday reminding people to turn in paperwork for the week ending in "sundays date" two days in the future.
i cant figure out how to put a string in the message if i put a %x for instance or even %m/%d/%y it just shows exactly like that.
Code:
import datetime
now = datetime.datetime.now()
print now
from datetime import timedelta
diff = datetime.timedelta(days=5)
print diff
print now + diff
future = now + diff
future.strftime("%m/%d/%Y")
'06/02/2008'
import smtplib
fromaddr = '[email protected]'
toaddrs = '58036*****@email.uscc.net'
msg = 'please be sure to turn in inspection reports the week ending in ?%var?'
username = '[email protected]'
password = 'p***rd'
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()