标题:[各位大侠]谁有解析邮件的代码
只看楼主
zfl313
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2007-8-13
 问题点数:0 回复次数:0 
[各位大侠]谁有解析邮件的代码
我自己写的代码解析不出正确的邮件内容我知道怎么解析一下是我的代码.
 while (sr.Peek ()>0)
           {
               string str = sr.ReadLine();
               if(str.IndexOf ("Subjiect:")>=0)
               {
                   int start = str.IndexOf(":");
                   mail.Title = str.Substring(start+1).Trim();
               }
               else if (str.IndexOf("To") >= 0)
               {
                   int start = str.IndexOf(":");
                   mail.SendMail = str.Substring(start + 1).Trim();
               }
               else if (str.IndexOf("Cc") >= 0)
               {
                   int start = str.IndexOf(":");
                   mail.CC = str.Substring(start + 1).Trim();
               }
               else if (str.IndexOf("Date") >= 0)
               {
                   int start = str.IndexOf(":");
                   mail.DataTime = str.Substring(start + 1).Trim();
               }
               else if (str.IndexOf("From") >= 0)
               {
                   int start = str.IndexOf(":");
                   mail.ReceiveMail = str.Substring(start + 1).Trim();
               }
               else if (str.IndexOf("Message-Id:") >= 0)
               {
                   continue;
               }
               else
               {
                   mail.Body += str + "\r\n";
               }
           }
搜索更多相关主题的帖子: 邮件 代码 解析 
2008-04-15 17:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-209206-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.229528 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved