def send_email(text):
#send_email = False
send_email = True
st = datetime.datetime.fromtimestamp(time.time()).strftime('%d-%m-%Y %H:%M:%S')
msg = MIMEText(text+"\nData captured at: "+st)
me = configure.EMAIL_ADDRESS
you = configure.DESTINATION_EMAIL
msg['Subject'] = 'GPS Tracker'
msg['From'] = me
msg['To'] = you
if send_email:
s = smtplib.SMTP_SSL('smtp.gmail.com:465')
s.login(configure.EMAIL_ADDRESS, configure.EMAIL_PASSWORD)
s.sendmail(me, [you], msg.as_string())
s.quit()
评论列表
文章目录