To.Text=""金先生"<[email protected]>;"Admin1"<[email protected]>" //若这样附值会出现,不知为何?名字只能用单引号但格式又不对。string split = ";"; 
 string[] toList = To.Text.Trim().Split(split.ToCharArray());
 for(int i = 0; i < toList.Length; i++)
 {
   mailMsg.To.Add(toList[i].Trim());
   Response.Write(toList[i]);
  
  }
这时用Response.Write(toList[i])调试只能显示出来:"金先生""admin1" .
为何不能显示出来:toList[1]="金先生"<[email protected]
toList[2]="Admin1"<[email protected]>
即: "金先生"<[email protected]
     "Admin1"<[email protected]>
邮件地址所示别的格式呢?

解决方案 »

  1.   

    谢谢!
    问题出在这里转数组的时候string[] toList = To.Text.Trim().Split(split.ToCharArray());如下:我用好多方法都测试不通过。 
    char[]dell ={';'};
            string a=  "jin1<[email protected]>;king1<[email protected]>";
            string[] words=a.Split(dell);
            foreach (string substr in words)
            {
                 Response.Write(substr+"@");
            } 显示:jin1@king1@    
    不知怎么才能让他折分成这个格式:jin1<[email protected]>
    king1<[email protected]>