Send Email In C#

public void Mail
{

try
{

// Creating a new mail message. The sender and receiver are
// indicated as sendermail@gmail.com and receivermail@yahoo.com
MailMessage mail = new MailMessage();

// Creating a new SMTP Client. The server URL/IP is indicated as
// sendServer.Text (that is the text box with the data).
SmtpClient SmtpServer = new SmtpClient(“smtp.gmail.com”);

mail.From = new MailAddress(“sendermail@gmail.com”);//Set The Email Address Of the Sender.
mail.To.Add(“receivermail@yahoo.com”);//Set The Email Address Of Reciever.
mail.Subject = “Test Mail”;//Subject Of The Mail.
mail.Body = “This is for testing SMTP mail from GMAIL”;//It Is the Main Body Of The Email. Also Append HTMl Code.  

 // Some servers require a specific port to connect
SmtpServer.Port = 587;

 // To be able to send the message, it is necessary to provide the
// credentials on the server. The username and the password is to give.                
SmtpServer.Credentials = new System.Net.NetworkCredential(“sendermail@gmail.com”, “password”);
SmtpServer.EnableSsl = true;

// Send the Mail.
SmtpServer.Send(mail);
MessageBox.Show(“Mail Send”);

}
catch (Exception ex)
{

//Console.WriteLine(ex.ToString());

}

}