如何接收附件? 在C#中,如何使用POP3来接收邮件的附件(将邮件正文和附件分开) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.sxsky.net/it/html/20051042348.htm 感谢 anmeier,我是要用C#来写winForm,我现在能够收到邮件,但邮件内容和附件是混在一起的,请问怎么分开。 public MailMessage GetNewMessages(int nIndex) { int newcount; System.Web.Mail.MailMessage msg = new MailMessage(); try { newcount = GetNumberOfNewMessages(); Connect(); int n = nIndex+1; if(n<newcount+1) { ArrayList msglines = GetRawMessage(n); string msgsubj = GetMessageSubject(msglines); msg.Subject = msgsubj; msg.From = GetMessageFrom(msglines); msg.Body = GetMessageBody(msglines); } Disconnect(); return msg; } catch { return null; } } private string GetMessageBody(ArrayList msglines) { string body = ""; string line = " "; IEnumerator msgenum = msglines.GetEnumerator(); while(line.CompareTo("") != 0) { msgenum.MoveNext(); line = (string)msgenum.Current; } while (msgenum.MoveNext() ) { body = body + (string)msgenum.Current + "\r\n"; } return body; } c#.net里的一种写法 如何从listbox中实现删除功能 smtp 的send方法到底把文件发送到了哪里? 两维数组,随机抽两行组成一维数组 上传文件的一个问题 请问怎么才能实现将一个WAP页面的内容保存到手机上 请问C#中DataGrid可以隐藏列吗? 请进!!怎么通过设计时期的编辑器在asp.net的后置代码文件生成代码??? GetMenu不能得到菜单句柄 哪里有c#的视频教程 《c#程序设计基础》 向高手请教关于SHDocVw.InternetExplorerClass类的Navigate方法 如何获取系统的时间格式为2005-10-16?
public MailMessage GetNewMessages(int nIndex)
{
int newcount;
System.Web.Mail.MailMessage msg = new MailMessage(); try
{
newcount = GetNumberOfNewMessages();
Connect();
int n = nIndex+1; if(n<newcount+1)
{
ArrayList msglines = GetRawMessage(n);
string msgsubj = GetMessageSubject(msglines);
msg.Subject = msgsubj;
msg.From = GetMessageFrom(msglines);
msg.Body = GetMessageBody(msglines);
} Disconnect();
return msg;
}
catch
{
return null;
}
}
private string GetMessageBody(ArrayList msglines)
{
string body = "";
string line = " ";
IEnumerator msgenum = msglines.GetEnumerator(); while(line.CompareTo("") != 0)
{
msgenum.MoveNext();
line = (string)msgenum.Current;
} while (msgenum.MoveNext() )
{
body = body + (string)msgenum.Current + "\r\n";
}
return body;
}