cURL / Mailing Lists / curl-library / Single Mail

curl-library

Reading gmail with imap unsuccessful on Win32

From: Mark Hessling <mark_at_rexx.org>
Date: Sat, 26 Oct 2013 11:29:22 +1000

I've been trying to use libcurl to read email on GMail via imap using
Rexx/CURL. Under Linux this works without problems, however under
Windows it fails.

The curl executable exhibits the same behaviour as Rexx/CURL so I'm
confident it's not Rexx/CURL, but it still may be a user error :-)

Below is the comparitive verbose output from listing new email messages
on my GMail account.

The certificate file I specified for Windows used was copied from my
Linux machine, and I've also tried specifying the cacert.pem file
downloaded from curl.haxx.se.

Any help appreciated.

Cheers, Mark

Ubuntu 12.04
============
% curl -V
curl 7.30.0 (x86_64-unknown-linux-gnu) libcurl/7.30.0 OpenSSL/1.0.1
zlib/1.2.3.4 libidn/1.23 libssh2/1.2.8 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps
pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

% curl --verbose -u '*myusername:mypassword*' -X "SEARCH UNSEEN"
imaps://imap.gmail.com:993/INBOX
* About to connect() to imap.gmail.com port 993 (#0)
* Trying 2607:f8b0:400e:c01::6d...
* Adding handle: conn: 0x67c4b0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x67c4b0) send_pipe: 1, recv_pipe: 0
* Connected to imap.gmail.com (2607:f8b0:400e:c01::6d) port 993 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
   CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-RC4-SHA
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc;
CN=imap.gmail.com
* start date: 2013-09-10 07:59:51 GMT
* expire date: 2014-09-10 07:59:51 GMT
* subjectAltName: imap.gmail.com matched
* issuer: C=US; O=Google Inc; CN=Google Internet Authority G2
* SSL certificate verify ok.
< * OK Gimap ready for requests from *suppressed*
> A001 CAPABILITY
< * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN
X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2 AUTH=PLAIN
AUTH=PLAIN-CLIENTTOKEN
< A001 OK Thats all she wrote! *suppresed*
> A002 AUTHENTICATE PLAIN *suppressed*
< * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN
X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH
< A002 OK *myusername *my Name authenticated (Success)
> A003 SELECT INBOX
< * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
< * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)]
Flags permitted.
< * OK [UIDVALIDITY 1] UIDs valid.
< * 69 EXISTS
< * 0 RECENT
< * OK [UIDNEXT 99] Predicted next UID.
< * OK [HIGHESTMODSEQ 11367]
< A003 OK [READ-WRITE] INBOX selected. (Success)
> A004 SEARCH UNSEEN
< * SEARCH 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 44 45
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
* SEARCH 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 44 45 46
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
< A004 OK SEARCH completed (Success)
* Connection #0 to host imap.gmail.com left intact

Windows 7
=========
c:\> curl -V
curl 7.33.0 (i386-pc-win32) libcurl/7.33.0 OpenSSL/1.0.0k zlib/1.2.8
libidn/1.18 libssh2/1.4.3 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3
pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN Largefile NTLM SPNEGO SSL SSPI libz

c:\> curl --verbose -u '*myusername:mypassword*' -X "SEARCH UNSEEN"
--cacert .\ca-certificates.crt imaps://imap.gmail.com:993/INBOX
* Adding handle: conn: 0x1d3aa38
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1d3aa38) send_pipe: 1, recv_pipe: 0
* About to connect() to imap.gmail.com port 993 (#0)
* Trying 74.125.129.108...
* Connected to imap.gmail.com (74.125.129.108) port 993 (#0)
> A001 LOGOUT
* response reading failed
* Closing connection 0
curl: (3) response reading failed

-- 
------------------------------------------------------------------------
* Mark Hessling, mark@rexx.org http://www.rexx.org/
* Author of THE, a Free XEDIT/KEDIT editor and, Rexx/SQL, Rexx/CURL, etc.
* Maintainer of Regina Rexx interpreter
* Use Rexx? join the Rexx Language Association: http://www.rexxla.org/
------------------------------------------------------------------------
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-10-26