curl-users
RE: trying to list all message subjects in my inbox using cURL and an imaps url
Date: Fri, 25 Apr 2014 23:17:56 +0100
On Fri, 25 Apr 2014, Stephen Jarjoura wrote:
> My initial goal was to try and get a list of subjects of messages in an
> Inbox.
If the only way to do that is via a FETCH command then that isn't going to
be possible with the current version of curl unfortunately :(
As I mentioned in my last email we are attempting to resolve that at
present, and I appreciate that doesn't help you archive what you want now.
> But while I tried different iterations of the URL and parameters, I
> kept getting the same sort of results. cURL returns the first line the
> server responds with, which is an echo of the command submitted,
> with a byte count on the end. It does not return any of the subsequent
> lines that the server sends, which are visible with the verbose flag.
Yes - that is a known limitation of the current custom request
implementation in IMAP and unfortunately my fault !!
> While my initial goal was to see a list of subjects, I noticed that
despite
> the documentation, I never did get a listing of email messages, etc.
I would be interested to know what documentation you are referring to. I
wrote a fair amount of the email related documentation on the curl website
especially the URL syntax sections and libcurl code examples so if there are
errors in any of that then please let me know and I will correct it.
However, I wouldn't recommend you trust old threads in the archives (Prior
to January and Feburary 2013) relating to IMAP - especially those that refer
to someone's forked code, or articles on other websites that don't give curl
specific examples.
> > http://curl.haxx.se/rfc/rfc5092.txt
>
> I did not know there was an RFC on a URL syntax for IMAP, that would
> be very useful!
If you're not already aware of it, you may also find RFC3501 useful as that
describes in detail the IMAP protocol:
http://curl.haxx.se/rfc/rfc3501.txt
> Since I am just learning how to use cURL for this purpose (i.e.
> send/receive email) I am more than happy to learn whatever the
> correct usage syntax is. Part of my frustration is that the
> documentation I found reported results I could not reproduce.
As I mentioned above, if there is documentation that is incorrect or not
detailed enough then please feel free to highlight it and I will correct any
false information and try my best to add more detail where necessary.
> If one command format reports "this will list messages in a mailbox"
> and then I only get a list of flags for each message or I get a list of
> subfolders within a mailbox, but not the messages themselves,
> then I'm left scratching my head.
Unfortunately IMAP isn't as straight forward as POP3. For example: A LIST
command in POP3 will list the message IDs and size of each message for that
mailbox, as there is no concept of a folder hierarchy, but in the IMAP world
this command simply lists the folders in the root folder (mailbox) or
sub-folders of a folder.
To list messages one would typically SEARCH for them in IMAP. For example
"SEARCH NEW" or "SEARCH SUBJECT something". Once you have the result set
(list of UIDs) you can then perform the relevant FETCH commands to retrieve
those messages, however, due to the current limitation of not being able to
perform custom FETCH commands you will have to use the URL syntax to
retrieve them :(
> Thank you, Steve!
You're welcome - please feel free to post any further questions here and I
will endeavour to answer them.
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-26