curl-users
trying to list all message subjects in my inbox using cURL and an imaps url
Date: Wed, 23 Apr 2014 18:38:04 -0400
Hello;
I only recently learned that cURL supports both SMTP(S) and IMAP(S)
and have some ideas for using it in my scripting. 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.
I'm running cURL on my Win7 desktop.
curl 7.36.0 (x86_64-pc-win32) libcurl/7.36.0 OpenSSL/1.0.1g zlib/1.2.8
WinIDN libssh2/1.4.3
Here are some examples:
This is what I get when I send the command to an Exchange 2010 mail server.
C:\>curl imaps://email.my.domain/Inbox -u me_at_my.domain:password
* LIST (\Marked \HasNoChildren) "/" INBOX
From this page: http://curl.haxx.se/mail/lib-2013-03/0104.html
which reports "--url imap://mail.example.com -X "EXAMINE INBOX" -
Performs a message list on the user's inbox"
But here's what I get:
C:\>curl -u me_at_my.domain:password --url imaps://email.my.domain/ -X
"EXAMINE INBOX"
* 88 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK [PERMANENTFLAGS ()] Permanent flags
* OK [UIDVALIDITY 1373] UIDVALIDITY value
* OK [UIDNEXT 332593] The next unique identifier value
From this website:
http://stackoverflow.com/questions/12490648/imap-fetch-subject
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)]"
* 1 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {23}
* 2 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {44}
* 3 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {23}
Notice how I'm seeing my command echoed back with the byte count of
the answer, but not the answer itself (i.e. not the subjects being
requested). Here's the results with the verbose "-v" switch, which
shows that the server is responding with the requested subjects!
> A004 FETCH 1:3 BODY.PEEK[HEADER.FIELDS (SUBJECT)]
< * 1 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {23}
* 1 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {23}
< Subject: Re: Script
<
< )
< * 2 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {44}
* 2 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {44}
< Subject: RE: Exchange - Storage juggling
<
< )
< * 3 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {23}
* 3 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {23}
< Subject: Re: Script
<
< )
< A004 OK FETCH completed.
* Connection #0 to host email.my.domain left intact
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.
C:\>curl -u me_at_my.domain:password --url imaps://email.my.domain/INBOX?ALL
* LIST (\Marked \HasNoChildren) "/" INBOX
My question is, other than using verbose output, how do I get curl to
return the actual fields requested not just the echo of my request
with the byte count of the result?
-- runester ------------------------------------------------------------------- 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.htmlReceived on 2014-04-24