I want to set my laser trip wire, which has a keypad to enable/disable the laser, to send me an email notification when the laser has been crossed. I have an ethernet shield but I am new to ethernet shields. Here is my code below:

First you need to figure out which authentication/encryption method your mail server requires. Chances are that the code zeus2kx posted wont work for you e.g. if your server requires TSL. If your server supports plain authentication you can use zeus2kx code as a template for your implementation. Before writing code for the Arduino try test the stmp communication from a PC using telnet. On Windows start the command prompt and telnet to the the smtp(25) port of your mail server:

When the telnet connection is established, type the stmp commands that send the message. The following commands work when the server do not require authentication (for example, if you send a message to an email address that is hosted locally on that server).

You will see that the server writes back when you type the commands. For example, after you have typed the "mail from: <me@somewhere.net>" it may respond with "<me@somewhere.net>... Sender ok".

When you have successfully sent an email from your PC just transfer the command to client.print()-lines for the Arduino. It should work. On the other hand, if you can't send a message from a PC sending email won't work from the Arduino either.

ok, I got it to compile, but my keypad does not work, which means I cannot turn on the laser and no data will be sent to my email. I am using the UNO and only have limited number of digital inputs. Also, the LEDs are always on, which I am assuming that means that the digital inputs are being used to control the ethernet shield. Is there anyway around this?

It seems to not be doing anything. I open the serial monitor and no activity shows up. I even condensed the code so that it would just send an email and commented all the keypad and laser stuff out, but still nothing.