I have a textbox(textBox2
) where are the email:
thisemail@gmail.com,hello@yahoo.it,YesOrNo@gmail.com,etc..
I have a function that sends an email:
private void button1_Click(object sender, EventArgs e)
{
var mail = new MailMessage();
var smtpServer = new SmtpClient(textBox5.Text);
mail.From = new MailAddress(textBox1.Text);
mail.To.Add(textBox2.Text);
mail.Subject = textBox6.Text;
mail.Body = textBox7.Text;
mail.IsBodyHtml = checkBox1.Checked;
mail.Attachments.Add(new Attachment(textBox9.Text));
var x = int.Parse(textBox8.Text);
smtpServer.Port = x;
smtpServer.Credentials = new System.Net.NetworkCredential(textBox3.Text, textBox4.Text);
smtpServer.EnableSsl = checkBox2.Checked;
smtpServer.Send(mail);
}
I want you send an email to each email separately.
That is, when I press the button1
to take him an email at a time and send the email until you end up. How can I do?