With these codes I can send one email to someone without problem. But I need to learn how to send multiple emails with email's addresses itens into my combobox. Mean into my combobox I have three (3) emails address:
I would like to know how can I send one by one all these three emails once. Then to help user to be sure that its sending. I need a label showing the number and counting the number of emails that its inside of my combobox. Or just showing a barchart counting from 0% until 100% when finish.
Please let see my codes and its works perfectly but only sending one email from a textbox. Now I need your help how sending three item's emails addresses from my combobox oneby one once:
SmtpClient client1 = new SmtpClient("smtp.live.com", 25); //smtp.gmail.com // For Gmail
//smtp.live.com // Windows live / Hotmail
//smtp.mail.yahoo.com // Yahoo
//smtp.aim.com // AIM
//my.inbox.com // Inbox
//Authentication.
//This is where the valid email account comes into play. You must have a valid email account(with password) to give our program a place to send the mail from.
NetworkCredential cred = new NetworkCredential("
[email protected]", "12345");
//To send an email we must first create a new mailMessage(an email) to send.
MailMessage Msg = new MailMessage();
// Sender e-mail address.
Msg.From = new MailAddress(textBox2.Text);//Nothing But Above Credentials or your credentials (*******@gmail.com)
// Recipient e-mail address.
Msg.To.Add(textBox2.Text);
// Assign the subject of our message.
Msg.Subject = "Accounting Report";
// Create the content(body) of our message.
Msg.Body = txtEmailContent.Text;
/*System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment("c:/Scaner1.jpg");
Msg.Attachments.Add(attachment);*/
// Send our account login details to the client.
client1.Credentials = cred;
//Enabling SSL(Secure Sockets Layer, encyription) is reqiured by most email providers to send mail
client1.EnableSsl = true;
//Confirmation After Click the Button
//label1.Text = "Mail Sended Succesfully";
// Send our email.
client1.Send(Msg);
//}
//catch
//{
// If Mail Doesnt Send Error Mesage Will Be Displayed
//label1.Text = "Error";