First follow these instructions for setting up a raspberry pi. This tutorial assumes you are running it headless without an HDMI cable or a wireless keyboard and mouse.
I recommend using putty to ssh into the raspberry pi after booting. It should take about 90 seconds to boot if connected to a network. Otherwise it will wait for the network for 2 minutes extra on that timeframe.
Step 1: WiFi
If you are connecting via ethernet you can skip this step. Otherwise, setup wifi using this tutorial.
Step 2: Circuit
After you have your raspberry pi setup, its time to build the circuit. You will need to male female leads, a pushbutton, and a resistor. Since we will configure the raspberry pi to use a pull down resistor, you do not need to attach a ground. I am using a raspberry pi 2, so your pins may map differently.
Step 3: Setting Up Python
Now we need to configure python to use the gpio pins. In order to do this we need the gpio library. This can be easily obtained with the command
enter this into the terminal on your raspberry pi.
sudo apt-get install python-dev python-rpi.gpio
Step 4: Almost Done
All that is left is getting the script onto the raspberry pi and running it.
To do this run these commands.
sudo apt-get install git
Now navigate to the folder you want to put the script inside of in a terminal window
git remote add pingbot https://github.com/399123/bell
git pull pingbot master
Congratulations, you now have the script.
Step 5: Configure the Web Server
The last thing to do is to configure the pi to log into the email client. To do this, follow the video here.
Step 6: Congratulations
Congratulations, you set up a raspberry pi to send an email when a button is pressed.