Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import time
  4. import smtplib
  5. import RPi.GPIO as GPIO
  6. GPIO.setmode(GPIO.BCM)
  7. GPIO.setup(25, GPIO.IN)
  8. GPIO.input(25)
  9. while True:
  10. if not GPIO.input(25):
  11.  
  12. fromaddr = 'dautente@gmail.com'
  13. toaddrs = 'autente@gmail.com'
  14. #Aggiungo i dati per l'invio
  15. username = 'utente' #inserire proprio indirizzo
  16. password = 'password' #inserire propria password
  17.  
  18. server = smtplib.SMTP('smtp.gmail.com:587')
  19. server.starttls()
  20. server.login(username, password)
  21. server.sendmail(fromaddr, toaddr, msg)
  22. server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement