mail::ACCOUNT::getMessageContent.3x - Man Page

Read message content


#include <libmail/sync.H>

class myStoreCallback : public mail::ACCOUNT::Store {

    void search(size_t messageNumber, std::string messageContents);

myStoreCallback storeCallback;
mail::ACCOUNT *mail;

bool ok=mail->getMessageContent(const std::vector<size_t> &msgList, bool peek, mail::readMode requestType, storeCallback);

bool ok=mail->getMessageContent(size_t messageNum, bool peek, const mail::mimestruct &messagePart, mail::readMode requestType, storeCallback);

std::string errmsg=mail->getErrmsg();


mail::ACCOUNT::getMessagesContent reads messages in the currently open folder. There are two alternative versions of this method.

Setting peek to true does not reset the unread message status flag for this message. Otherwise the unread message status flag will be reset.

storeCallback's store method receives the requested content, which is determined by the remaining parameters.

requestType identifies the type of information to return from the selected MIME section, and must be set to one of the following values:


Return only the headers of the MIME section. Folded headers are unfolded (the newline and the leading space on the next line are replaced with a single space character).


Return only the headers of the MIME section. The headers are returned as-is, without unfolding them.


Return the content of the MIME section.

The MIME section is not decoded. Check the Content-Transfer-Encoding header to know what you're getting.


Return the entire MIME section, as is: its headers, a blank line, then the contents.

The callback method may not receive the entire requested content at once. Typically the method will be invoked multiple times; each time the method receives the next portion of the requested content. When requesting headers and/or content of multiple messages, they may be returned in any order, and the messageNumber parameter indicates which message's contents are being returned (note, however, that the entire contents of a given message are returned in their entirety, even when the callback method gets invoked multiple times for that message, before content from the next message are returned).

Return Codes

This method returns true if it succeeds, or false if it fails. If the method fails, use mail::ACCOUNT::getErrmsg() to read a brief description of the error.

See Also

mail::ACCOUNT::getMessageContentDecoded(3x), mail::ACCOUNT::getMessageEnvelope(3x), mail::ACCOUNT::getMessageStructure(3x).


Sam Varshavchik


08/25/2016 Cone© Cone: COnsole Newsreader And E