How To: Shutdown a PC Using A Cell Phone
By Jakob Griffith on Jan 27th, 2009 at 8:56PM

Hypothetical situation: You wake up late because your alarm didn’t go off when expected, so you’re rushing out the door to catch the bus (or driving to work). After much panicking, running, and distress you manage to make it and not a second too soon. “Thank goodness” is the only thing running through your mind as you try and relax; that is, until you overhear the conversation behind you between two smirking girls.
“Yeah, I got a new Mac, it’s so cool.”
“Teehee, I can’t wait to get a new PC.”
You laugh silently to yourself remembering your new Core i7 setup that will be waiting for you once you get home. Suddenly, a thought goes through your head. “Did I turn off my PC? Yes yes, surely I did. Oh no, I didn’t! If I don’t turn it off, it will overheat!“ What are you going to do! No family is home and there’s no way of shutting it down in time! But you have no fear, for you recently programmed your phone to remotely shut down your PC for you.
Please do excuse the poorly written story above. I’ve had a little too much caffeine. Today’s article is taking the software and programming side of DIY. Remotely shutdown/restart/run a program/whatever you want your PC via your cell phone.
The supplies you’ll need are Visual C# 2008 Express Edition, aspNetPOP3, AdvancedIntellect.Ssl.dll, and a NEW Gmail account with POP3 enabled.
This guide assumes you know a slight bit of C# and programming in general (like, what a variable bool is), but I’ll try and explain the best I can. To begin, open up Visual C# 2008 and load a new windows form. Name it “remote”. Presented in front of you should be a blank window. Click View>Toolbox. Here you can play around and add things to the window. Anything from labels, to check boxes, to buttons, to loading bars. Add whatever you feel your program needs. But at least two text boxes, a button, and a timer are mandatory. Right click the Timer>Properties. Change the interval to 600000 (this is about 10 minutes in milliseconds).
My form layout, feel free to make yours however you want. I included some labels.

1.You’ll also need to install aspNetPOP3.
2.Extract the license file to:
C:\Documents and Settings\NAME\My Documents\Visual Studio 2008\Projects\Remote\Remote\bin\Debug
and extract AdvancedIntellect.Ssl.dll to the same place.
Now comes the fun part: Making those buttons and boxes work! Double click on your button that you placed on your form. Beginners might get a little confused at what they are looking at, but bare with me. Click View>Designer and double click the timer. If you just want to quickly program, skip down to the next paragraph. If you want to learn what everything does, I suggest reading up on learning C#.
1.Underneath “using System.Windows.Forms;” type “using aspNetPOP3;”
2.Without going into much detail, click Project>Add Reference. Then find aspNetPOP3 in the list.
3.Click Project>Add Reference>Browse and locate where you extracted AdvancedIntellect.Ssl.dll
3.Right click “remote” in the “solution explorer” Add>Existing Item, and navigate to your XML license file that you extracted when you installed aspNetPOP3. “aspNetPOP3.xml.lic”
What we just did was instead of writing out hundreds of lines of code to allow us to connect to Gmail, someone else has already done that and we simply added it to our project.
1.Underneath “InitializeComponent();” type “timer1.Stop();”
2.Underneath the bracket { in “private void button1_Click(object sender, EventArgs e)” type “timer1.Start();”
What we just did here was instead of the program running once and never checking Gmail again, we made it loop through every 10 minutes, but the loop doesn’t start until you click the button.
What we have done thus far…click image to view full screen.
Almost done. Copy and paste the code below, under the bracket { that comes after “private void timer1_Tick(object sender, EventArgs e)”
POP3 pop = new POP3("pop.gmail.com", textBox1.Text, textBox2.Text);
AdvancedIntellect.Ssl.SslSocket ssl = new AdvancedIntellect.Ssl.SslSocket();
pop.LoadSslSocket(ssl);
pop.Port = 995;
POP3.LoadLicenseFile("C:/Documents and Settings/kobaj/My Documents/Visual Studio 2008/Projects/Remote/Remote/bin/Debug/aspNetPOP3.xml.lic");
pop.Connect();
pop.PopulateInboxStats();
int count = pop.InboxMessageCount;
count = count - 1;
string text = pop.GetMessageAsText(count);
int position = text.IndexOf("shutdown");
if (position != -1)
{
pop.Delete(count);
pop.CommitDeletes();
pop.Disconnect();
System.Diagnostics.Process.Start("Shutdown", "/s");
}
It should look similar to the following. (Do note: picture has outdated code.)
In effect, you are finished! Congratulations, you might not know what it all does. But play around, not like you can hurt anything. Click Build>Build Solution. Navigate to
C:\Documents and Settings\YOURNAME\My Documents\Visual Studio 2008\Projects\Remote\Remote\bin\debug\remote.exe. Now simply double click the exe. Your program should be running flawlessly, enter in your Gmail user name and Gmail password and click the button. Grab your phone and text your Gmail account the word “shutdown”. Your PC should respond accordingly.
Coding is a very long and tortuous project, so if you have any problems or want to see your program do more, etc. You can contact me at kobaj.g(at)gmail(dot)com.
Known Bugs:
Firefox/other programs can prevent shutdown.
Delete needs to be worked on.
Amount of emails must be greater than 2.









After several emails and questions, I’ve found an error in that if you copy and paste the code from the website, for some unknown reason, it wont compile.
But have no fear, I have a fix! Type it out.
[Reply]
Hello,i have selected ur project as my final year project.
So can you please help me out with it.
Please reply on my mail id.
Please do the needful.
Thankyou!
[Reply]