.Net POP3 客户端

发布于 2024-09-07 15:06:34 字数 170 浏览 0 评论 0原文

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

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

呢?

.net has a SMTP client for sending mail
but no pop3 client for reading mail.
Ive used WEBDAV before, but I really want a simple pop3 or imap client thats stable

I know there seems to be 10000 of examples, but why no offical .net client if they made a SMTP client

any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一抹苦笑 2024-09-14 15:06:34

F#.NET Journal 文章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>

The F#.NET Journal article An e-mail client in F# (31st March 2010) describes how you can write your own in just a few lines of F# code, centered around the following sequence expression:

> 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>
[浮城] 2024-09-14 15:06:34

This is the library I used. It was very easy to use, didn't have any problems with it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文