System.IndexOutOfRangeException: 索引超出了数组界限。
ArrayListalist=newArrayList();for(inti=0;i<listBox1.Items.Count;i++){stringmail;if(i<...
ArrayList alist = new ArrayList();
for (int i = 0; i < listBox1.Items.Count; i++)
{
string mail;
if (i < listBox2.Items.Count)
{
mail = listBox1.Items[i].ToString() + "," + listBox2.Items[i].ToString();
}
else
{
mail = listBox1.Items[i].ToString() + "," + listBox2.Items[i % listBox2.Items.Count].ToString();
}
}
for (int j = 0; j < alist.Count; j++)
{
string senderStr = alist[j].ToString();
string[] str = senderStr.Split(new char[] { ',', ',', ',' });
string stmpStr = str[1];
string fromStr = str[2];
string pwdStr = str[3];
string toMail = str[0];
MailTo.mailunit mu = new MailTo.mailunit(stmpStr, fromStr, pwdStr, toMail, textBox7.Text, textBox8.Text, paths);
Thread mythread = new Thread(new ThreadStart(mu.SendMail2));
mythread.Start();
}
////多线程群发
for (int i = 0; i < listBox1.Items.Count; i++)
{
for (int j = 0; j < listBox2.Items.Count; j++)
{
string senderStr = listBox2.Items[j].ToString();
string[] str = senderStr.Split(new char[] { ',', ','});
string stmpStr = str[1];
string fromStr = str[2];
string pwdStr = str[3];
string toMail = str[0];
MailTo.mailunit mu = new MailTo.mailunit(stmpStr, fromStr, pwdStr, listBox1.Items[i].ToString(), textBox7.Text, textBox8.Text, paths);
Thread mythread = new Thread(new ThreadStart(mu.SendMail2));
mythread.Start();
}
} 展开
for (int i = 0; i < listBox1.Items.Count; i++)
{
string mail;
if (i < listBox2.Items.Count)
{
mail = listBox1.Items[i].ToString() + "," + listBox2.Items[i].ToString();
}
else
{
mail = listBox1.Items[i].ToString() + "," + listBox2.Items[i % listBox2.Items.Count].ToString();
}
}
for (int j = 0; j < alist.Count; j++)
{
string senderStr = alist[j].ToString();
string[] str = senderStr.Split(new char[] { ',', ',', ',' });
string stmpStr = str[1];
string fromStr = str[2];
string pwdStr = str[3];
string toMail = str[0];
MailTo.mailunit mu = new MailTo.mailunit(stmpStr, fromStr, pwdStr, toMail, textBox7.Text, textBox8.Text, paths);
Thread mythread = new Thread(new ThreadStart(mu.SendMail2));
mythread.Start();
}
////多线程群发
for (int i = 0; i < listBox1.Items.Count; i++)
{
for (int j = 0; j < listBox2.Items.Count; j++)
{
string senderStr = listBox2.Items[j].ToString();
string[] str = senderStr.Split(new char[] { ',', ','});
string stmpStr = str[1];
string fromStr = str[2];
string pwdStr = str[3];
string toMail = str[0];
MailTo.mailunit mu = new MailTo.mailunit(stmpStr, fromStr, pwdStr, listBox1.Items[i].ToString(), textBox7.Text, textBox8.Text, paths);
Thread mythread = new Thread(new ThreadStart(mu.SendMail2));
mythread.Start();
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询