Reputation: 1
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:
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("[email protected]");
mail.To.Add("[email protected]");
// 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("[email protected]", "PasswordNotBeingGivenHere");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.EnableSsl = true;
try
{
smtp.Send(mail);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Picture of full help screen:
Upvotes: 0
Views: 61
Reputation: 4810
You create your network credentials and don't associate them with the smtp client.
Try adding the line:
smtp.Credentials = Info;
Upvotes: 0
Reputation: 63065
NetworkCredential info = new NetworkCredential("[email protected]", "PasswordNotBeingGivenHere");
smtp.Credentials =info ; // add this line
Upvotes: 3