您好,我有将 datagridview 发送到电子邮件的代码,并且运行良好。问题是它只是发送到我的电子邮件,而不是发送给其他人的电子邮件,我的电子邮件是网络凭据。我怎样才能将它发送给其他人?
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();