2011-11-28 60 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