cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: trying to list all message subjects in my inbox using cURL and an imaps url

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Thu, 24 Apr 2014 21:06:27 +0100

On Wed, 23 Apr 2014, Stephen Jarjoura wrote:

> I only recently learned that cURL supports both SMTP(S) and IMAP(S)
> and have some ideas for using it in my scripting.

Curl has supported IMAP, POP3 and SMTP since 7.20.0 (February 2010),
however, its IMAP implementation has been quite lacking until about 12
months ago and even now there are still things missing!

> While I've gotten the SMTPS to work well, I'm having some problems
> with the IMAPS, specifically, it echoes back the command and a byte count
> instead of returning the requested data.
>
> Here are some examples:

Are you simply trying to obtain a list of subject lines for all the messages
in the Inbox or are you wanting to do other things as well as you gave a few
different examples - so I started to get a little lost with what you are
trying to achieve :(

For example:

* FETCH a specific message (or range of messages)
* LIST the contents of a mailbox
* SEARCH for new messages, or
* SEARCH for messages that match a certain criteria

> I generated this command line: C:\>curl -u me_at_my.domain:password
> --url imaps://email.my.domain/Inbox -X "FETCH 1:3 BODY.PEEK[HEADER.
> FIELDS (SUBJECT)]"

Custom commands in IMAP "currently" override a list command so only untagged
responses are returned to the user. There is presently some discussion,
about this, going on over on the libcurl mailing list:

http://curl.haxx.se/mail/lib-2014-04/0067.html

As such this will be possible in the future but isn't with v7.36.0 :(

> This website: http://curl.haxx.se/mail/lib-2010-06/0019.html
> reports that "Download all email in INBOX for this user with IMAP:
> imap://user:password_at_mail.candelatech.com/INBOX?ALL"
>
> But that doesn't work for me, either.

Unfortunately, and this is before my involvement with curl, but I believe
that was Ben's own fork and I must admit I haven't looked at his work there
:(

The query string isn't something that is currently supported in v7.36.0,
however, I have added basic support for it in v7.37.0 - as of commit
84c0aabe65 in the repo.

However, I would be interested to know what you are expecting such a URL to
do? For example: return a list of messages that match the query string or
fetch those messages as well as I may need to expand that support?

I appreciate with that URL Ben's example downloaded all messages but that
syntax isn't (as far as I know) mentioned in RFC5092 which is what we are
now trying to follow for our IMAP URL syntax:

http://curl.haxx.se/rfc/rfc5092.txt

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-04-24