Read decoded message contents


#include <libmail/mail.H>
#include <libmail/envelope.H>
#include <libmail/structure.H>

class myCallbackMessage : public mail::callback::message {
    void success(std::string msg);
    void fail(std::string msg);

    void messageEnvelopeCallback(size_t messageNumber,
                                 const mail::envelope &envelopeArg);

    void messageReferencesCallback(size_t messageNumber,
                                   const std::vector<std::string> &referencesArg);

    void messageArrivalDateCallback(size_t messageNumber,
                                    time_t datetime);

    void messageSizeCallback(size_t messageNumber,
                             unsigned long size);

    void messageStructureCallback(size_t messageNumber,
                                  const mail::mimestruct &messageStructure);
    void messageTextCallback(size_t messageNumber, std::string text);

std::cout << (float)myMessageCallback.messageTextCompleted /
             (float)myMessageCallback.messageTextEstimatedSize * 100
          << "% completed." << endl;
mail::account *account;

account->readMessageContentDecoded(size_t messageNum, bool peek, mail::mimestruct &msgInfo, bool justHeader, bool justContents, myCallbackMessage &callback);


This function is similar to mail::account::readMessageContent(3x), with one difference: quoted-printable and base64 MIME content is automatically decoded. The mail::callback::message::messageTextCallback function receives the decoded, binary, content.

Return Codes

The application must wait until callback's success or fail method is invoked. The success method is invoked when this request is succesfully processed. The fail method is invoked if this request cannot be processed. The application must not destroy callback until either the success or fail method is invoked.


callback's fail method may be invoked even after other callback methods were invoked. This indicates that the request was partially completed before the error was encountered.


Multiple applications may have the same account and folder opened at the same time. It is possible that a message referenced by this request was already deleted by another application. Depending on the underlying server implementation this will result in either a failed request, invoking, or the request completing (callback.success invoked) but without invoking any callback function that refer to the message.

See Also

mail::account::readMessageAttributes(3x), mail::account::readMessageContent(3x).


Sam Varshavchik


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