hey , i tried to make the email sender in c# using visual studio 2015 but i got an error , while i press send email it gives me error your credentials are incorrect but i am using a correct email this is the code :
private void button1_Click(object sender, EventArgs e)
{
try
{
if (!textBox4.Text.Contains("@gmail.com"))
{
MessageBox.Show("Please Provide a gmail address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
button1.Enabled = false;
MailMessage message = new MailMessage();
message.From = new MailAddress(textBox4.Text);
message.Subject = textBox2.Text;
message.Body = textBox3.Text;
foreach (string s in textBox1.Text.Split(';'))
message.To.Add(s);
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential(textBox4.Text, textBox5.Text);
client.Host = "smtp.gmail.com";
client.Port = 587;
client.EnableSsl = true;
client.Send(message);
}
catch { MessageBox.Show("There was an error sending the massage.\r\nPlease Make Sure That Your Credentials are Correct\r\nAnd that you have an internet conection.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
finally { button1.Enabled = true;

}