private void timer1_Tick(object sender, EventArgs e) { if (Value.SendMailList != null) { if (FromMailIndex < (Value.SendMailList.Length - 1)) { FromMailIndex++; } else { FromMailIndex = 0; } if (SendIndex > (dataGridView1.RowCount - 2)) { SendIndex = 0; timer1.Enabled = false; button3.Text = "顺序发送"; } toolStripProgressBar3.Maximum = dataGridView1.RowCount; MailInfor MI = new MailInfor(); MI.MailFrom = Value.SendMailList[FromMailIndex].Mail; MI.Password = Value.SendMailList[FromMailIndex].Password; MI.MailTo = dataGridView1[1, SendIndex].Value.ToString(); MI.Title = textBox1.Text; MI.Msg = webBrowser1.DocumentText.ToString(); MI.AddPath = Ini.Read("附件路径"); MIThreadSend MITS = new MIThreadSend(MI, SendIndex); MITS.OnReceivedData += new MIThreadSend.ReceivedData(NewWork_OnReceivedData); new Thread(new ThreadStart(MITS.Send)).Start(); toolStripProgressBar3.Value = SendIndex++; } }
private void button2_Click(object sender, EventArgs e) { if (Value.SendMailList != null) { if (FromMailIndex < (Value.SendMailList.Length - 1)) { FromMailIndex++; } else { FromMailIndex = 0; } MailInfor MI = new MailInfor(); MI.MailFrom = Value.SendMailList[FromMailIndex].Mail; MI.Password = Value.SendMailList[FromMailIndex].Password; MI.MailTo = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); MI.Title = textBox1.Text; MI.Msg = webBrowser1.DocumentText.ToString(); MI.AddPath = Ini.Read("附件路径"); MIThreadSend MITS = new MIThreadSend(MI, dataGridView1.SelectedRows[0].Index); MITS.OnReceivedData += new MIThreadSend.ReceivedData(NewWork_OnReceivedData); new Thread(new ThreadStart(MITS.Send)).Start(); } }