mail::ACCOUNT::getMessageEnvelope
Prev | mail::ACCOUNT Synchronous API reference | Next

## Name

mail::ACCOUNT::getMessageEnvelope — Return message header envelope

## Synopsis

#include <libmail/sync.H>
#include <libmail/envelope.H>
mail::ACCOUNT *mail;

`bool ok=mail->getMessageEnvelope(` | const std::vector<size_t> & | msgList,
| std::vector<mail::xenvelope> & | envelopes`)`;

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

`mail::xenvelope myEnvelope=mail->getMessageEnvelope(` | size_t | messageNum`)`;

## USAGE

`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.

This function reads the message envelope header information of each message specified by `msgList`. This function initializes the `envelopes` array to the same size as `msgList`, with each array member containing the envelope header information for the corresponding message in `msgList`.

### mail::xenvelope

The mail::xenvelope structure is a subclass of mail::envelope(3x), with two additional fields:

time_t arrivalDate

  When this message was received by the mail server (or `0` if the time cannot be determined).

unsigned long messageSize

  The approximate size of the message, in bytes. This size should be considered as an estimated only, and the actual size may be slightly higher or lower.

## 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.

The second version of `mail::ACCOUNT::getMessageEnvelope` returns the envelope information of a single message, ignoring any error condition (a failure results in the returned mail::xenvelope object being completely empty).

## SEE ALSO

mail::envelope(3x), mail::ACCOUNT::getFolderIndexInfo(3x), mail::ACCOUNT::getFolderIndexSize(3x).

Prev | Up | Next
mail::ACCOUNT::getMessageContentDecoded | Home | ToC | mail::ACCOUNT::getMessageStructure