Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- from email.message import EmailMessage
- import os
- import urllib.request
- movie_url = 'https://www.cinemacity.sk/films/avengers-endgame/3270s2r'
- notif_file = '/home/matus/email_sent'
- from_mail = "throwaway42473773@gmail.com"
- fp = urllib.request.urlopen(movie_url)
- response = fp.read().decode("utf8")
- fp.close()
- if response.find('showingType = "SHOWING"') > 0 and not os.path.exists(notif_file):
- server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
- server.login(from_mail, "pedigree")
- to = ['matus.zelenak.gjh@gmail.com', 'zuzkamagyarova@gmail.com']
- subject = 'We are in the Endgame now (for real)'
- body = 'Order your tickets here: '
- msg = EmailMessage()
- msg.set_content('Order your tickets here: {}'.format(movie_url))
- msg['Subject'] = subject
- msg['From'] = from_mail
- msg['To'] = ', '.join(to)
- server.send_message(msg)
- server.quit()
- f = open(notif_file, 'w')
- f.write('We are done here')
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement