#include <libmail/sync.H>
class myStoreCallback : public mail::ACCOUNT::Store {
public:
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, bool justHeader, bool justContents, storeCallback);
bool ok=mail->getMessageContent
(size_t messageNum, bool peek, const mail::mimestruct &messagePart, bool justHeader, bool justContents, storeCallback);
std::string errmsg=mail->getErrmsg();
mail::ACCOUNT::getMessagesContent reads messages in the currently open folder. There are two alternative versions of this method.
The first version receives a list of message numbers. This version is capable of returning headers and/or content of multiple messages.
msgList specifies a list of messages. Messages are numbered starting with message #0 and up to one less than mail::ACCOUNT::getFolderIndexSize(3x) (when mail::account::getFolderIndexSize returns 6, the messages are numbered 0 through 5). Only the messages that appear in msgList are processed by this request. When a message is removed from the folder, by mail::ACCOUNT::updateFolderIndexInfo(3x), the following messages are renumbered accordingly.
NOTE: | Most mail servers allow multiple applications to open the same folder. Therefore, changes to the folder's contents can occur at any time. Before making this request, the application should use mail::ACCOUNT::checkNewMail(3x) to verify that no unexpected changes have been made to the folder's contents. |
The second version receives a single message number, and a mail::mimestruct object that refers to a single MIME attachment or a section of this message. The mail::mimestruct object was previously obtained from mail::ACCOUNT::getMessageStructure(3x), for this message. This method returns a recursive tree of mail::mimestruct objects which enumerates the individual MIME sections in the message. messagePart must be a reference to one of these objects (or to a copy of these objects).
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.
justHeader requests only the header portion of a message or a MIME attachment; justContents requests the contents of a MIME section. Both the header and the contents may be requested to receive the entire message or MIME attachment. Multi-line headers are automatically folded when only the headers are requested (but not when both headers and contetn are requested).
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).
This method returns true if it succeeds, or fail if it fails. If the method fails, use mail::ACCOUNT::getErrmsg() to read a brief description of the error.
mail::ACCOUNT::getMessageContentDecoded(3x), mail::ACCOUNT::getMessageEnvelope(3x), mail::ACCOUNT::getMessageStructure(3x).
<<< Previous | Home | Next >>> |
mail::ACCOUNT::getFolderKeywordInfo | Up | mail::ACCOUNT::getMessageContentDecoded |