i created a window app which send email to a particular email id which is inserted in my textbox,
here is my code on my button click
private void button1_Click(object sender, EventArgs e)
{
MailMessage msg = new MailMessage("sender@gmail.com", textBox1.Text, "here is the subject of the mail", textBox2.Text);
SmtpClient mail = new SmtpClient();
mail.Host = "smtp.gmail.com";
mail.Port = 465;
mail.Credentials = new NetworkCredential("sender@gmail.com", "senderpassword");
mail.EnableSsl = true;
mail.Send(msg);
MessageBox.Show("message has been sent to the mail provided");
}
i am getting an error message which is written below
'System.Net.Mail.SmtpException' occurred in System.dll
please let me know what is the issue which i am facing