Ok, my linq skills aren't great so im trying to do the following.
Say I have 6000 records (email address) I want to add the first 1000 add to bcc, send, take the next 1000 add to bcc, send, take the 1000 add to bcc, send, etc....
Ive started wrinting,
string[] files = System.IO.Directory.GetFiles(@"C:\Mail\ ", "*.csv");
Parallel.ForEach(files, currentFile =>
{
string filename = currentFile;
StreamReader reader = new StreamReader(filename);
var emailList = new List<String>();
while (reader.Peek() >= 0)
{
emailList.Add(reader.ReadLine());
}
\\Here is where I need to do the linq?
IEnumerable<string> list = emailList
var message = new System.Net.Mail.MailMessage();
foreach (var s in list)
{
MailAddress mailAddress = new MailAddress(s);
message.Bcc.Add(mailAddress);
}
message.Subject = txtSubject.Text;
message.From = new System.Net.Mail.MailAddress(txtFrom.Text);
message.Body = txtMessage.Text;
message.IsBodyHtml = true;
var smtp = new System.Net.Mail.SmtpClient();
smtp.Send(message);