Add
using System.Net;
using System.Net.Mail;
try
{
SmtpClient client = new SmtpClient("smtp.gmail.com");
MailMessage message = new MailMessage("your's e-mail id(xyz@gmail.com)","e-mail id of the person you want to send mail" );
message.Body = "Body";
message.Subject = "Subject";
client.Credentials = new System.Net.NetworkCredential("Your gmail login(xyz)", "gmail password");
client.Port = Convert.ToInt32("587");
client.Send(message);
MessageBox.Show("Mail delivered successfully!!!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show("Message could not be sent.\nThe following error was returned:\n’" + ex.Message + "‘", "Sending Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this is working perfectly on my system.