import smtplib
from email.mime.text import MIMEText
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(16, GPIO.IN)
print "press button to send email"

while True:
        input = GPIO.input(16)
        if input == True:
print "Email sent"
#create email 
message = """REPLACE THIS TEXT WITH DESIRED MESSAGE"""
msg = MIMEText(message)
msg['subject'] = 'Rpi test'
msg['from'] = 'PUT ORIGINATOR EMAIL ADDRESS HERE'
msg['to'] = 'PUT RECIPIENT EMAIL ADDRESS HERE'
# send email
s = smtplib.SMTP('smtp.gmail.com' , ‘587’)

s.ehlo()
	s.starttls()
s.ehlo()

                s.login(‘PUT YOUR GMAIL ADDRESS HERE [should be same as from address above]’ , ‘PUT YOUR GMAIL PASSWORD HERE')
                s.sendmail(msg['From'], msg['To'], msg.as_string())
                s.quit()

----------------------------
Troubleshooting the button - how to use RPi.GPIO library in Python to detect button press; in the Raspberry Pi’s NANO programming mode, enter the following code from http://razzpisampler.oreilly.com/ch07.html 

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)
GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(16)
if input_state == False:
print('Button Pressed')
time.sleep(0.2)

------------------------