SHARE
TWEET

Untitled

a guest Apr 2nd, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import smtplib
  2. from email.message import EmailMessage
  3. import os
  4. import urllib.request
  5.  
  6. movie_url = 'https://www.cinemacity.sk/films/avengers-endgame/3270s2r'
  7. notif_file = '/home/matus/email_sent'
  8.  
  9. from_mail = "throwaway42473773@gmail.com"
  10.  
  11. fp = urllib.request.urlopen(movie_url)
  12. response = fp.read().decode("utf8")
  13. fp.close()
  14.  
  15. if response.find('showingType = "SHOWING"') > 0 and not os.path.exists(notif_file):
  16.     server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
  17.     server.login(from_mail, "pedigree")
  18.  
  19.     to = ['matus.zelenak.gjh@gmail.com', 'zuzkamagyarova@gmail.com']  
  20.     subject = 'We are in the Endgame now (for real)'
  21.     body = 'Order your tickets here: '
  22.  
  23.     msg = EmailMessage()
  24.     msg.set_content('Order your tickets here: {}'.format(movie_url))
  25.  
  26.     msg['Subject'] = subject
  27.     msg['From'] = from_mail
  28.     msg['To'] = ', '.join(to)
  29.  
  30.     server.send_message(msg)
  31.     server.quit()
  32.  
  33.     f = open(notif_file, 'w')
  34.     f.write('We are done here')
  35.     f.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top