gpt4 book ai didi

c++ - 如何使用 libcurl 和 POP3 删除电子邮件?

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:46:44 24 4
gpt4 key购买 nike

可以吗?我知道自定义请求;所以我发送带有文本“DELE”的自定义请求,并设置我要删除的消息 ID。结果,curl_easy_perform 挂起,直到出现超时。在网络论坛上,人们建议在“DELE”之后发送“QUIT”命令;但是如果 libcurl 挂起,我该如何发送“QUIT”命令呢?

libcurl 调试输出如下:

* Connected to pop-mail.outlook.com (157.55.1.215) port 995 (#2)
* SSL connection using DES-CBC3-SHA
* Server certificate:
* subject: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; CN=*.
hotmail.com
* start date: 2013-04-24 20:35:09 GMT
* expire date: 2016-04-24 20:35:09 GMT
* issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Organization Validation
CA - G2
* SSL certificate verify result: unable to get local issuer certificate (
20), continuing anyway.
< +OK DUB0-POP132 POP3 server ready
> CAPA
< -ERR unrecognized command
> USER ************@hotmail.com
< +OK password required
> PASS ******************
< +OK mailbox has 1 messages
> DELE 1
< +OK message deleted
* Operation too slow. Less than 1000 bytes/sec transferred the last 10 seconds
> QUIT
* Operation too slow. Less than 1000 bytes/sec transferred the last 10 seconds
* Closing connection 2

因此,消息被删除,但 libcurl 挂起,直到速度限制强制它断开连接,这是个坏主意。如何在删除消息后强制停止而不等到超时?

最佳答案

如果您查看 libcurl 文档,CURLOPT_CUSTOMREQUEST说:

POP3

When you tell libcurl to use a custom request it will behave like a LIST or RETR command was sent where it expects data to be returned by the server. As such CURLOPT_NOBODY should be used when specifying commands such as DELE and NOOP for example.

这就是 libcurl 挂起的原因 - 它正在等待服务器实际上没有发送的更多数据。所以添加 CURLOPT_NOBODY 来停止等待。

关于c++ - 如何使用 libcurl 和 POP3 删除电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21116374/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com