Advertisement
Guest User

IFTTT Email

a guest
Sep 2nd, 2015
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. '''
  2. Sending an email in Python to use with IFTTT (and Wiimotes).
  3. Modified from the following address: http://www.averagemanvsraspberrypi.com/2013/09/make-your-raspberry-pi-tweet-its.html
  4. '''
  5.  
  6. import smtplib
  7. from email.mime.text import MIMEText
  8.  
  9. # Set up the email information.
  10. # Note: If you use an IFTTT recipe that is triggered by regular email instead of GMail,
  11. # then send the email to trigger@recipes.ifttt.com (trigger@ifttt.com is no longer used).
  12. From = "CMPT380@gmail.com"
  13. Password = "GoLlamas"
  14. To = "CMPT380@gmail.com" # "trigger@recipes.ifttt.com"
  15. Body = "This is the body"
  16. Subject = "This is the subject"
  17. Subject = "Wiimote has been picked up!"
  18.  
  19. msg = MIMEText(Body)
  20. msg['From'] = From
  21. msg['To'] = To
  22. msg['Subject'] = Subject
  23. server = smtplib.SMTP('smtp.gmail.com:587')
  24. server.ehlo_or_helo_if_needed()
  25. server.starttls()
  26. server.ehlo_or_helo_if_needed()
  27. server.login(From,Password)
  28. server.sendmail(From, To, msg.as_string())
  29. server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement