c# 中收发邮件问题 求:c#中如何进行接收邮件中的内容,读取邮件的发送地址,接收地址,发送时间、标题及内容(感觉标题和内容要进行解码才可以读出),但是一直没有找到办法读取,请大家提一下意见,或有源代码最好 发送到:[email protected]中,在此先谢谢大家 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给你一个实例吧(登陆兼顾发送邮件源代码)http://download.csdn.net/source/2917877 http://download.csdn.net/source/2917877 http://topic.csdn.net/t/20040817/22/3284408.html codeproject上有例子A POP3 Client in C# .NEThttp://www.codeproject.com/KB/IP/despop3client.aspxPOP3 Client as a C# Classhttp://www.codeproject.com/KB/IP/pop3client.aspx 我自己工程里用的 //将异常日志发送到" , 25); //帐号仅输入@前的字符串 smtp.Credentials = new NetworkCredential("这里输入帐号" , "这里输入密码"); //添加附件 if (true) //仅添加最后一个异常日志 { string lastLog = attachmentPathList[attachmentPathList.Count - 1]; if (lastLog != Config.LOG_LASTSEND) { mail.Attachments.Add(new Attachment(lastLog)); Application.UserAppDataRegistry.SetValue("LOG_LASTSEND" , lastLog); Config.LOG_LASTSEND = lastLog; } } //添加所有异常日志 else foreach (string attachPath in attachmentPathList) { Attachment item = new Attachment(attachPath); mail.Attachments.Add(item); } //有日志则发送 if (mail.Attachments.Count > 0) smtp.Send(mail); } //检索指定路径dir下txt附件的方法 public static IList<string> GetAttachment(string dir) { IList<string> attachFullPathList = new List<string>(); //dir:要检索的路径 DirectoryInfo attachmentDirectory = new DirectoryInfo(dir); foreach (FileSystemInfo fsi in attachmentDirectory.GetFileSystemInfos()) { //路径下可能包含文件夹和文件,判断是否是文件 if (fsi is FileInfo) { FileInfo fi = (FileInfo) fsi; //获取完整文件名 string attachFullPath = Path.GetFullPath(fi.FullName); if (Path.GetExtension(fi.FullName) == ".txt") attachFullPathList.Add(attachFullPath); } } return attachFullPathList; } C#什么时候需要用实体类Models呢? 如何使用C#的RichTextBox控件,实现类似与新闻滚动的效果 给初学者分享用C#制作网站的视频教材(转载) C# word的一些操作问题 如何在C#中使用Javascript引擎,JavaScript脚本调用自定义的COM组件的接口? 关于收件箱的实现 C#写的桌面应用程序以命令行方式运行时如何在控制台下打印信息 如何将ACCESS 数据库所有的表一起上传至 SQL Server 数据库中 .net开发wap表单提交问题 请教这个问题 急!!! 要启用实时(JIT)调试 VS2008打断点运行后直接重启 VS2005出现异常错误自动退出
http://download.csdn.net/source/2917877
http://www.codeproject.com/KB/IP/despop3client.aspxPOP3 Client as a C# Class
http://www.codeproject.com/KB/IP/pop3client.aspx
//帐号仅输入@前的字符串
smtp.Credentials = new NetworkCredential("这里输入帐号" , "这里输入密码"); //添加附件
if (true)
//仅添加最后一个异常日志
{
string lastLog = attachmentPathList[attachmentPathList.Count - 1];
if (lastLog != Config.LOG_LASTSEND)
{
mail.Attachments.Add(new Attachment(lastLog));
Application.UserAppDataRegistry.SetValue("LOG_LASTSEND" , lastLog);
Config.LOG_LASTSEND = lastLog;
}
}
//添加所有异常日志
else
foreach (string attachPath in attachmentPathList)
{
Attachment item = new Attachment(attachPath);
mail.Attachments.Add(item);
} //有日志则发送
if (mail.Attachments.Count > 0)
smtp.Send(mail);
} //检索指定路径dir下txt附件的方法
public static IList<string> GetAttachment(string dir)
{
IList<string> attachFullPathList = new List<string>();
//dir:要检索的路径
DirectoryInfo attachmentDirectory = new DirectoryInfo(dir);
foreach (FileSystemInfo fsi in attachmentDirectory.GetFileSystemInfos())
{
//路径下可能包含文件夹和文件,判断是否是文件
if (fsi is FileInfo)
{
FileInfo fi = (FileInfo) fsi;
//获取完整文件名
string attachFullPath = Path.GetFullPath(fi.FullName);
if (Path.GetExtension(fi.FullName) == ".txt")
attachFullPathList.Add(attachFullPath);
}
}
return attachFullPathList;
}