2011-11-28 26 views
0

我有一个托管在我的服务器上的应用程序。此应用程序将电子邮件发送到用户列表。可以说这个列表有10000个用户。我将列表分成三部分,并分配给每个单独的线程发送电子邮件。问题是当我去服务器托管我的应用程序并运行应用程序时,它会将电子邮件发送到我创建的所有3个列表,但是当我在本地PC上远程浏览应用程序时。电子邮件没有发送。asp.net中的多线程问题

任何人可以帮助我什么问题,如何解决它。

在此先感谢 问候

+0

您是否收到任何错误? –

+1

也许你需要定义这样的smtp或类似东西? –

+0

错误,屏幕截图,代码?请更好地描述情况。 –

回答

0

你好这里是代码。

# region /////Split Users List in 3 Parts//// 
       ArrayList thList1 = new ArrayList(); 
       ArrayList thList2 = new ArrayList(); 
       ArrayList thList3 = new ArrayList(); 
       ArrayList thListId1 = new ArrayList(); 
       ArrayList thListId2 = new ArrayList(); 
       ArrayList thListId3 = new ArrayList(); 
       int countList = arlistuid.Count/3; 
       int count; 
       for (count = 0; count < arlistuid.Count; count++) 
       { 
        if (count < countList) 
        { 
         thList1.Add(arlistuid[count]); 
         thListId1.Add(arlistid[count]); 
        } 
        else if (count >= countList && (count < countList + countList)) 
        { 
         thList2.Add(arlistuid[count]); 
         thListId2.Add(arlistid[count]); 
        } 
        else 
        { 
         thList3.Add(arlistuid[count]); 
         thListId3.Add(arlistid[count]); 
        } 

       } 

       # endregion 

       # region ///Send Email using 3 threads 
       if (thList1.Count > 0) 
       { 
        object thdargs = new object[2] { thList1, thListId1 }; 
        Thread thd1 = new Thread(new ParameterizedThreadStart(SplitListEmail)); 
        thd1.IsBackground = true; 
        thd1.Name = "Thread1"; 
        thd1.Start(thdargs); 
       } 
       if (thList2.Count > 0) 
       { 
        object thd2args = new object[2] { thList2, thListId2 }; 
        Thread thd2 = new Thread(new ParameterizedThreadStart(SplitListEmail)); 
        thd2.IsBackground = true; 
        thd2.Name = "Thread2"; 
        thd2.Start(thd2args); 
       } 
       if (thList3.Count > 0) 
       { 
        object thd3args = new object[2] { thList3, thListId3 }; 
        Thread thd3 = new Thread(new ParameterizedThreadStart(SplitListEmail)); 
        thd3.IsBackground = true; 
        thd3.Name = "Thread3"; 
        thd3.Start(thd3args); 
       } 
       # endregion