Couldn't get UID list

Anonymous
2011-01-10
2013-04-25

  • Anonymous
    2011-01-10

    I have the following code snippet.

        // Connect to the mail store
        m_store->connect();
        // Open the default folder in this store
        vmime::ref <vmime::net::folder> m_folder = m_store->getDefaultFolder();
        // vmime::ref <vmime::net::folder> f = st->getFolder(vmime::utility::path("a"));
        m_folder->open(vmime::net::folder::MODE_READ_WRITE);
        m_message_count = m_folder->getMessageCount();
        int options = folder::FETCH_UID | folder::FETCH_SIZE;
        m_folder->fetchMessages(m_messages, options);
        m_messages = m_folder->getMessages();
        std::cout << m_message_count << " message(s) in your inbox" << std::endl;
        for ( int i=0; i < m_message_count; i++)
        {
            vmime::ref <vmime::net::message> message = m_messages[i];
            //const vmime::net::message * message_ptr = (const vmime::net::message *)(const void*)message;
            std::string uid = message->getUniqueId();
            std::cout << i << " : "<< uid << std::endl;
        }
    

    I could get the correct message count which indicates the proper server connection and authentication. When the fetchMessages() lines was executed within a debugger, I could see on the POP3 server that the vmime sends out UIDL and LIST commands which the server responds correctly.

    Yet, message->getUniqueId(); for each message is ""

    What am I doing wrong?