You did not declare the port. It is required. Default port 21 will not be going to work in gmail.
Here is the typical code for sending mail using gmail smtp
using System.Net;
using System.Net.Mail;
var fromAddress = new MailAddress("youremail@gmail.com", "Your Name");
var toAddress = new MailAddress("test@test.com", "To Name");
const string fromPassword = "password";
const string subject = "Subject";
const string body = "Body";
var smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
};
using (var message = new MailMessage(fromAddress, toAddress)
{
Subject = subject,
Body = body
})
{
smtp.Send(message);
}
cheers