.Net POP3 客户端

标签 .net pop3

<分区>

.net有一个SMTP客户端用来发送邮件 但没有用于阅读邮件的 pop3 客户端。 我以前用过 WEBDAV,但我真的想要一个稳定的简单 pop3 或 imap 客户端

我知道似乎有 10000 个示例,但如果他们制作了 SMTP 客户端,为什么没有官方的 .net 客户端

有什么想法吗?

最佳答案

The F#.NET Journal文章 An e-mail client in F# (2010 年 3 月 31 日)描述了如何仅用几行 F# 代码编写您自己的代码,以以下序列表达式为中心:

> let receive =
    seq { use client = new Sockets.TcpClient(Server.pop3.addr, Server.pop3.port)
          use stream = client.GetStream()
          use reader = new System.IO.StreamReader(stream)
          let rec readToDot() =
            let line = reader.ReadLine()
            if line <> "." then line + "\n" + readToDot() else ""
          reader.ReadLine() |> ignore
          use writer = new System.IO.StreamWriter(stream)
          let write (line: string) =
            writer.Write(line + "\n")
            writer.Flush()
          write "USER myname"
          reader.ReadLine() |> ignore // +OK Password required.
          write "PASS mypassword"
          reader.ReadLine() |> ignore // +OK logged in.
          write "STAT"
          let stat = reader.ReadLine() // +OK <message count> <total size>
          for i in 1 .. int (stat.Split[|' '|]).[1] do
            write(sprintf "RETR %d" i)
            reader.ReadLine() |> ignore // +OK <message size> octets follow.
            match readToDot() |> parse with
            | Some msg -> yield msg
            | None -> ()
          write "QUIT"
          reader.ReadLine() |> ignore };;
val receive : seq<msg>

关于.Net POP3 客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3149892/

相关文章:

c# - 如何比 OpenPop.dll 更快地解析电子邮件

c# - 矩阵和向量的点积

c# - 有没有办法声明以任何 lambda 作为参数的方法?

c# - 要说自定义异常是可序列化的,最低要求是什么?

.net - 通过导入的类型库访问 COM-dll 失败

.net - 如何在不安装Oracle客户端的情况下连接Oracle与odp.net

没有 JavaMail API 的 Java POP3 消息解析器

java - 如何使用自定义 TrustManager 通过 SSL 连接到 POP3 服务器?

gmail - POP3、IMAP 和 Exchange 之间有什么区别?

java - 使用 POP3 服务器时生成消息 UID 背后的模式/逻辑是什么?