Hello i have my code to send datagridview to email and it is running very well. The problem is that it is just sending to my email, and not to other people email , my email is the Network Credential . How can i send it to other people?
Pesquisar_Items pesquisar = new Pesquisar_Items();
var client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
client.Credentials = new NetworkCredential("jpbritopoker@gmail.com", "***");
var mail = new MailMessage();
mail.From = new MailAddress("nervir@epnervir.com");
mail.To.Add(textBox1.Text);
mail.IsBodyHtml = true;
mail.Subject = textBox2.Text;
string mailBody = "<table width='100%' style='border:Solid 1px Black;'>"; ;
foreach (DataGridViewRow row in itemDataGridView.Rows)
{
mailBody += "<tr>";
foreach (DataGridViewCell cell in row.Cells)
{
mailBody += "<td>" + cell.Value + "</td>";
}
mailBody += "</tr>";
}
mailBody += "</table>";
//your rest of the original code
mail.Body = mailBody;
client.Send(mail);
MessageBox.Show("O email foi enviado com sucesso");
this.Close();