求:c#中如何进行接收邮件中的内容,读取邮件的发送地址,接收地址,发送时间、标题及内容(感觉标题和内容要进行解码才可以读出),但是一直没有找到办法读取,请大家提一下意见,或有源代码最好 发送到:[email protected]中,在此先谢谢大家

解决方案 »

  1.   

    给你一个实例吧(登陆兼顾发送邮件源代码)
    http://download.csdn.net/source/2917877
      

  2.   

    http://download.csdn.net/source/2917877
      

  3.   

    http://topic.csdn.net/t/20040817/22/3284408.html
      

  4.   

    codeproject上有例子A POP3 Client in C# .NET
    http://www.codeproject.com/KB/IP/despop3client.aspxPOP3 Client as a C# Class
    http://www.codeproject.com/KB/IP/pop3client.aspx
      

  5.   

    我自己工程里用的 //将异常日志发送到" , 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;
    }