What you want to do is likely above your present ability. (For now.)
I'm telling you this kindly.
However, you have asked a question, and I will answer it.
(Who knows, this might be the start of a wonderful new world of socket programming for you.)
First, since you are using Windows, you will want to familiarize yourself with Winsock.
Google windows socket tutorials
You will find a nice tutorial for it here:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=9818&lngWId=3
And a handy reference here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738545(v=vs.85).aspx
Code Project is also a fantastic place for finding code examples, but you'll need to register to download.
Since you are using the MinGW compiler (part of Dev-C++), you will need to add -lwsock32 and -lws2_32 in your libraries.
Once you're comfortable with writing socket code, I suggest you have a look at this:
http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
Have a look at the example exchange in the article. It'll help.
Happy coding!