cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: Curl cmd line pop email delete

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Thu, 6 Mar 2014 14:02:18 +0000

On Thu, 6 Mar 2014, Config wrote:

>> Can someone tell me what command parameter I would send to cause the
>> mail to be deleted upon downloading?
>>
> I found out how to supposedly do this in a telnet examplt on the
> web. It is done like this.
>
> C:\Curl\curl_735_0_ssl\curl.exe -O C:\mail.txt -v -u user:password
> pop3://mail.myips.net/1 --request dele 1

That's correct... However you don't need to specify the email id on both the URL and the custom request.

So either of the following will work:

curl -v -u user:password pop3://mail.myips.net/1 --request dele --list-only
curl -v -u user:password pop3://mail.myips.net --request dele 1 --list-only
curl -O C:\mail.txt -v -u user:password pop3://mail.myips.net/1 --request dele
curl -O C:\mail.txt -v -u user:password pop3://mail.myips.net/1 --request dele
> However, curl gets back a message that the mail was marked for delete,
> but the dos window hangs at that point and after closing, the mail has
> not been deleted.

That's because curl, by default, is expecting to perform a transfer.

As such you will note I have included the --list-only argument in my example above - the short version of which is -l.

It is also worth noting that in curl v7.35.0 you need to retrieve an email and delete an email in separate calls to curl. In the upcoming release of curl you will be able to perform this in one call as follows, which saves on establishing separate connections that log in etc:

curl -v pop3://mail.myips.net/1 -u user:password -O C:\mail.txt --next pop3://mail.myips.net/1 -u user:password --request dele --list-only

Kind Regards

Steve
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-03-06