venkat - 2011-07-15

vmime::ref <vmime::net::session> dockMailSession = vmime::create <vmime::net::session>();
vmime::utility::url storeURL("imap://username:password@imap.gmail.com");
vmime::ref <vmime::net::store> store = dockMailSession->getStore(storeURL);
try
   {

store->connect();
// Open the INBOX
   vmime::ref <vmime::net::folder> folder = store->getDefaultFolder();
   folder->open(vmime::net::folder::MODE_READ_WRITE);

   // Get the first message in the INBOX
   vmime::ref <vmime::net::message> msg = folder->getMessage(1);

   // Construct the parsed message (a few data, header and structure,
   // is actually downloaded from the IMAP server)
   //vmime::ref <vmime::net:: body> msgBody = msg->
  
   // Here, extract() will actually download message data from the server
   vmime::utility::outputStreamAdapter out(std::cout);
   //parsedMsg->getBody()->extract(out);
   }
   catch(vmime:: exception& e)
   {
       std::cout << e.what();
   }

is giving an exception

error while connecting socket