0

I've been making a Real Time Modding Tool for Call of Duty and am trying to make a report bug system, but I'm getting this error:

enter image description here

the codes that I'm using for this are as follows:

private void button4_Click(object sender, EventArgs e)
{
    // Create the mail message
    MailMessage mail = new MailMessage();

    // Set The Addresses
    mail.From = new MailAddress("brinkerzbhtests@gmail.com");
    mail.To.Add("brinkerzbhtests@gmail.com");

    // Login to that email

    // Set The Content
    mail.Subject = "RTM Tool Bug";
    mail.Body = textBox1.Text;

    // Send The Message
    SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
    NetworkCredential info = new NetworkCredential("brinkerzbhtests@gmail.com", "PasswordNotBeingGivenHere");
    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
    smtp.EnableSsl = true;

    try
    {
        smtp.Send(mail);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Picture of full help screen:

enter image description here

Lee Taylor
  • 7,761
  • 16
  • 33
  • 49

2 Answers2

3
NetworkCredential info = new NetworkCredential("brinkerzbhtests@gmail.com", "PasswordNotBeingGivenHere");
smtp.Credentials  =info ; // add this line
Damith
  • 62,401
  • 13
  • 102
  • 153
0

You create your network credentials and don't associate them with the smtp client.

Try adding the line: smtp.Credentials = Info;

Squid
  • 4,560
  • 1
  • 12
  • 8