Advertisement
Guest User

Untitled

a guest
Dec 14th, 2015
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import smtplib
  2. from email.mime.multipart import MIMEMultipart
  3. from email.mime.text import MIMEText
  4.  
  5. msg = MIMEMultipart('alternative')
  6. msg['Subject'] = "High temps from sensor!"
  7. msg['From'] ="dummy1@hotmail.com"
  8. msg['To'] ="dummy2@hotmail.com,dummy3@hotmail.com"
  9.  
  10. txt = "Fire? check tempature sensor!"
  11.  
  12. html"""\
  13. <html>
  14. <head></head>
  15. <body>
  16. <h1>Fire??</h1>
  17. <p>
  18. Check tempature sensor!!
  19. </p>
  20. </body>
  21. </html>"""
  22.  
  23. part1 = MIMEText(text, 'plain')
  24. part2 = MIMEText(html, 'html')
  25.  
  26. msg.attach(part1)
  27. msg.attach(part2)
  28.  
  29.  
  30. msg = smtplib.SMTP("smtp.gmail.com",587)
  31. mail.ehlo()
  32. mail.starttls()
  33. mail.login('xxx@gmail.com','xxx')
  34. mail.sendmail('from@gmail.com, to@gmail.com', msg.as_string())
  35. mail.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement