curl-library
Re: POP3 DELE not deleting
Date: Fri, 5 Apr 2013 18:39:09 +0400
According to RFC1081:
DELE msg
Arguments: a message-id (required) This message-id
may NOT refer to a message marked as deleted.
Restrictions: may only be given in the TRANSACTION state.
Discussion:
The POP3 server marks the message as deleted. Any
future reference to the message-id associated with the
message in a POP3 command generates an error. The POP3
server does not actually delete the message until the
POP3 session enters the UPDATE state.
So you do not physically delete message, you only mark it as 'ready for
deletion' (POP3 provides RSET command to rollback deletion). As I can see,
your pop3 connection remains active, hence message is going to be deleted
only when connection is closed. To be sure that your message is deleted try
to implicitly send QUIT custom request after DELE is done.
2013/4/5 brett kaylor <bbkaylor_at_yahoo.com>
> I am using curl-7.29.0 on Windows. I can connect, list, and retrieve POP3
> emails, but cannot seem to delete them. The return value indicates
> success, but the message is still there. My code snip below
>
>
> CURL mCurl = curl_easy_init();
>
> std::string id = "1"; // test case, and id 1 is valid.
> if (mCurl)
> {
> curl_easy_setopt(mCurl, CURLOPT_WRITEDATA, (void*)this);
> curl_easy_setopt(mCurl, CURLOPT_TIMEOUT, 10); // seconds for entire
> operation
> curl_easy_setopt(mCurl, CURLOPT_CONNECTTIMEOUT, 10); // seconds for
> connection timeout
> curl_easy_setopt(mCurl, CURLOPT_USERPWD,
> popPassword->GetStringValue().c_str());
> curl_easy_setopt(mCurl, CURLOPT_URL,
> popHost->GetStringValue().c_str());
> curl_easy_setopt(mCurl, CURLOPT_VERBOSE, 1L);
> std::string url = popHost->GetStringValue() + id;
> curl_easy_setopt(mCurl, CURLOPT_URL, url.c_str());
> curl_easy_setopt(mCurl, CURLOPT_NOBODY, 1);
> curl_easy_setopt(mCurl, CURLOPT_CUSTOMREQUEST, "DELE");
> CURLcode res3 = curl_easy_perform(mCurl);
> if (res3 == 0)
> {
> std::cout << "Successfully delete message " << id << std::endl;
> }
> }
>
> Produces these resutls:
>
> * Found bundle for host mail.XXXXcom: 0x71ddb0
> * Re-using existing connection! (#0) with host mail.XXXX.com
> * Connected to mail.XXXX.com (XX.XX.XX.XX) port 110 (#0)
> > RETR 1
> < +OK 12636 octets
> * Connection #0 to host mail.XXXX.com left intact
> * Found bundle for host mail.XXXX.com: 0x71ddb0
> * Re-using existing connection! (#0) with host mail.XXXX.com
> * Connected to mail.scumfish.com (XX.XX.XX.XX) port 110 (#0)
> > DELE 1
> < +OK Message 1 deleted
> * Connection #0 to host mail.scumfish.com left intact
> Successfully delete message 1
>
>
>
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
-- Regards, Stas.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-05