Saturday, June 19, 2010

Add E-mail To from ListBox in C#


This piece of code adds To from a ListBox to an e-mail SMTP Client in C#.  I wrote this segment as part of my SMS E-mailer app. (See Screenshot above)



55
56 MailMessage message = new MailMessage(
57 FromEmail,
58 listNumbers.Items[0].ToString(),
59 "",
60 message1);
61
62 foreach (string strAddress in listNumbers.Items)
63 {
64 message.To.Add(strAddress);
65 }
66

No comments:

Post a Comment