The code below will allow you to send email to smtp.gmail.com .  this works when you setup your domail to be hosted by google or if you have a Gmail account.

using System.Net.Mail;
using System.Net;

try

{
 

SmtpClient smtpClient = new SmtpClient("smtp.gmail.com",587);
smtpClient.EnableSsl = true;
smtpClient.DeliveryMethod =  SmtpDeliveryMethod.Network;
smtpClient.Credentials =  new NetworkCredential("username@yourdomain.com", "password");
 

MailMessage message = new MailMessage(from, to, subject, body);

smtpClient.Send(message);
}
catch (Exception ex)
{
throw ex;

}