Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- import email.message
- import time
- def sendmail():
- content = "Labdien!\n Si ir testa zina\n ar cienu, tests!"
- msg = email.message.EmailMessage()
- msg.set_content(content)
- msg['Subject'] = "Tests"
- msg['From'] = 'REDACTED'
- msg['To'] = 'REDACTED'
- smtp = smtplib.SMTP("REDACTED", 587)
- smtp.starttls()
- smtp.login("REDACTED", "REDACTED")
- smtp.sendmail(msg['From'], msg['To'], msg.as_string())
- smtp.quit()
- # Honestly it's a bit redundant to use `threading` package for this. `time` will for fine. Just need to be a bit more math savvy
- # and calculate the delay yourself
- time.sleep(300)
- # also this method is redundant itself
- sendmail()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement