Reading Raw Text Emails
Class ReadMessages provides methods for reading messages from the inbox or from arbitrary folders on the server. In addition, in case of multipart/multi-content messages, the messages are parsed and the content and/or attachments are returned in appropriate array attributes of the Mail class. This behavior is useful in most cases, but not always. For scenarios that require access to raw (unparsed) content of the message, you should use class ReadRawTextMessages.
Figure: The ReadRawTextMessages Class

All methods of ReadRawTextmessages return an Array of RawTextMessage objects:

The RawTextMail class contains all attributes from Mail and MailEnvelope classes and adds an attribute for the raw message text as an instance of Blob.
Reading Specific Raw Text Messages Using Retrieval Constraints
You can specify which raw text messages to retrieve by providing a constraints object to the readRawTextMessagesWithConstraints method:

Parameters of method readMessagesWithConstraints in detail:
Name | Type | Direction | Description |
---|---|---|---|
connection | MailConnection | In | Specifies connection details such as server name, protocol etc. (see Mail Connection). |
constraints | RetrievalConstraints | In | Specifies constraints for mails to retrieve (see Mail Retrieval Constraints). |
return | Array of RawTextMail | Return | An array containing emails matching the constraints, or an empty array, if no emails were found. |
Reading All Raw Text Messages from the Inbox
To read all raw text messages from the inbox, use the readRawTextMessages method:

Parameters of method readRawTextMessages in detail:
Name | Type | Direction | Description |
---|---|---|---|
connection | MailConnection | In | Specifies connection details such as server name, protocol etc. (see Mail Connection). |
deleteOnServer | Boolean | In | When true, messages will be deleted on server after reading. |
return | Array of RawTextMail | Return | An array containing emails from the inbox folder with the corresponding message id, or an empty array, if no emails were found. |
Reading Raw Text Messages from Inbox Folder by Id
The method readRawTextMessagesById provides the means to read a message from the inbox folder by specifying the message id:

Name | Type | Direction | Description |
---|---|---|---|
connection | MailConnection | In | Specifies connection details such as server name, protocol etc. (see Mail Connection). |
id | String | In | Id of the message |
return | Array of RawTextMail | Return | An array containing emails from the inbox folder with the corresponding message id, or an empty array, if no emails were found. |
Reading Raw Text Messages from Arbitrary Folders
You can use the readRawTextMessagesByFolder method to read raw text messages from arbitrary folders on the mail server:

Name | Type | Direction | Description |
---|---|---|---|
connection | MailConnection | In | Specifies connection details such as server name, protocol etc. (see Mail Connection). |
deleteOnServer | Boolean | In | When true, messages will be deleted on server after reading. |
folder | String | In | Name of the folder to read. |
return | Array of RawTextMail | Return | An array containing emails from the inbox folder with the corresponding message id, or an empty array, if no emails were found. |