Try this:
MailMessage m = new MailMessage("sender", "reciver", "hi", "how are u");
SmtpClient sm = new SmtpClient("smtp.gmail.com", 587);
sm.DeliveryMethod = SmtpDeliveryMethod.Network;
sm.UseDefaultCredentials = false;
sm.EnableSsl = true;
sm.Credentials = new System.Net.NetworkCredential("your user id@gmail.com", "your password");
sm.Send(m);