Advertisement
Guest User

SSCMail.py

a guest
May 5th, 2017
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import smtplib
  2.  
  3. from email.mime.multipart import MIMEMultipart
  4. from email.mime.text import MIMEText
  5.  
  6. username = 'emailtosendnotificationfrom@gmail.com'
  7. password = 'passwordforemailabove'
  8.  
  9. def initializeEmail():
  10. s = smtplib.SMTP('smtp.gmail.com',587)
  11. s.starttls()
  12. s.login(username,password)
  13. return s
  14.  
  15. def sendEmail(s, message):
  16. msg = MIMEMultipart()
  17.  
  18. msg['From'] = username
  19. msg['To'] = "emailtorecievenotification@gmail.com"
  20. msg['Subject']="NEW MARKS ARE OUT"
  21.  
  22. msg.attach(MIMEText(message, 'plain'))
  23.  
  24. s.send_message(msg)
  25.  
  26. del msg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement