You can use the following link to write a code to do what you are looking for...
http://www.rondebruin.nl/sendmail.htm
Saurabh...