Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QMailMessageBody class contains the body element of a message or message part. More...
#include <QMailMessageBody>
This class is under development and is subject to change.
The QMailMessageBody class contains the body element of a message or message part.
The body of a message or message part is treated as an atomic unit by the Qt Extended messaging library. It can only be inserted into a message part container or extracted from one. It can be inserted or extracted using either a QByteArray, a QDataStream or to/from a file. In the case of unicode text data, the insertion and extraction can operate on either a QString, a QTextStream or to/from a file.
The body data must be associated with a QMailMessageContentType describing that data. When extracting body data from a message or part to unicode text, the content type description must include a parameter named 'charset'; this parameter is used to locate a QTextCodec to be used to extract unicode data from the body data octet stream.
If the Content-Type of the data is a subtype of "text", then line-ending translation will be used to ensure that the text is transmitted with CR/LF line endings. The text data supplied to QMailMessageBody must conform to the RFC 2822 restrictions on maximum line lengths: "Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF." Textual message body data decoded from a QMailMessageBody object will have transmitted CR/LF line endings converted to \n on extraction.
The body data can also be encoded from 8-bit octets to 7-bit ASCII characters for safe transmission through obsolete email systems. When creating an instance of the QMailMessageBody class, the encoding to be used must be specified using the QMailMessageBody::TransferEncoding enum.
See also QMailMessagePart, QMailMessage, and QTextCodec.
This enum type is used to describe the format in which body data should be presented.
Constant | Value | Description |
---|---|---|
QMailMessageBody::Encoded | 1 | The body data should be presented in encoded form. |
QMailMessageBody::Decoded | 2 | The body data should be presented in unencoded form. |
This enum type is used to describe the encoding status of body data.
Constant | Value | Description |
---|---|---|
QMailMessageBody::AlreadyEncoded | 1 | The body data is already encoded to the necessary encoding. |
QMailMessageBody::RequiresEncoding | 2 | The body data is unencoded, and thus requires encoding for transmission. |
This enum type is used to describe a type of binary to text encoding. Encoding types used here are documented in RFC 2045 "Format of Internet Message Bodies"
Constant | Value | Description |
---|---|---|
QMailMessageBody::NoEncoding | 0 | The encoding is not specified. |
QMailMessageBody::SevenBit | 1 | The data is not encoded, but contains only 7-bit ASCII data. |
QMailMessageBody::EightBit | 2 | The data is not encoded, but contains data using only 8-bit characters which form a superset of ASCII. |
QMailMessageBody::Base64 | 3 | A 65-character subset of US-ASCII is used, enabling 6 bits to be represented per printable character. |
QMailMessageBody::QuotedPrintable | 4 | A method of encoding that tends to leave text similar to US-ASCII unmodified for readability. |
QMailMessageBody::Binary | 5 | The data is not encoded to any limited subset of octet values. |
See also QMailCodec.
Returns the content type that the body was created with.
Returns the data of the message body as a QByteArray. If format is QMailMessageBody::Encoded, then the data is written in the transfer encoding it was created with; otherwise, it is written in unencoded form.
See also QMailCodec.
This is an overloaded member function, provided for convenience.
Returns the data of the message body as a QString, in unencoded form. Line-endings transmitted as CR/LF pairs are converted to \n on extraction.
The 'charset' parameter of the body's content type is used to locate the appropriate QTextCodec to convert the data from an octet stream to unicode, if necessary.
See also QMailCodec, QMailMessageContentType, and QTextCodec.
Creates a message body from the data contained in input, having the content type type. If status is QMailMessageBody::RequiresEncoding, the data from the file will be encoded to encoding for transmission; otherwise it must already be in that encoding, which will be reported to recipients of the data.
If type is a subtype of "text", the data will be treated as text, and line-ending translation will be employed. Otherwise, the file will be treated as containing binary data.
If encoding is QMailMessageBody::QuotedPrintable, encoding will be performed assuming conformance to RFC 2045.
See also QMailCodec and QMailQuotedPrintableCodec.
This is an overloaded member function, provided for convenience.
Creates a message body from the data contained in input, having the content type type. The data from input will be encoded to encoding for transmission, and line-ending translation will be employed. The unicode text data will be converted to an octet stream using a QTextCodec object identified by the 'charset' parameter of type.
If encoding is QMailMessageBody::QuotedPrintable, encoding will be performed assuming conformance to RFC 2045.
See also QMailCodec, QMailMessageContentType, and QTextCodec.
Creates a message body from the data contained in the file filename, having the content type type. If status is QMailMessageBody::RequiresEncoding, the data from the file will be encoded to encoding for transmission; otherwise it must already be in that encoding, which will be reported to recipients of the data.
If type is a subtype of "text", the data will be treated as text, and line-ending translation will be employed. Otherwise, the file will be treated as containing binary data. If the file contains unicode text data, it will be converted to an octet stream using a QTextCodec object identified by the 'charset' parameter of type.
If encoding is QMailMessageBody::QuotedPrintable, encoding will be performed assuming conformance to RFC 2045.
Note that the data is not actually read from the file until it is requested by another function.
See also QMailCodec, QMailQuotedPrintableCodec, QMailMessageContentType, and QTextCodec.
Creates a message body from the data read from in, having the content type type. If status is QMailMessageBody::RequiresEncoding, the data from the file will be encoded to encoding for transmission; otherwise it must already be in that encoding, which will be reported to recipients of the data.
If type is a subtype of "text", the data will be treated as text, and line-ending translation will be employed. Otherwise, the file will be treated as containing binary data.
If encoding is QMailMessageBody::QuotedPrintable, encoding will be performed assuming conformance to RFC 2045.
See also QMailCodec and QMailQuotedPrintableCodec.
This is an overloaded member function, provided for convenience.
Creates a message body from the data read from in, having the content type type. The data read from in will be encoded to encoding for transmission, and line-ending translation will be employed. The unicode text data will be converted to an octet stream using a QTextCodec object identified by the 'charset' parameter of type.
If encoding is QMailMessageBody::QuotedPrintable, encoding will be performed assuming conformance to RFC 2045.
See also QMailCodec, QMailQuotedPrintableCodec, QMailMessageContentType, and QTextCodec.
Writes the data of the message body to the file named filename. If format is QMailMessageBody::Encoded, then the data is written in the transfer encoding it was created with; otherwise, it is written in unencoded form.
If the body has a content type with a QMailMessageContentType::type() of "text", and the content type parameter 'charset' is not empty, then the unencoded data will be written as unicode text data, using the charset parameter to locate the appropriate QTextCodec.
Returns false if the operation causes an error; otherwise returns true.
See also QMailCodec, QMailMessageContentType, and QTextCodec.
Writes the data of the message body to the stream out. If format is QMailMessageBody::Encoded, then the data is written in the transfer encoding it was created with; otherwise, it is written in unencoded form.
Returns false if the operation causes an error; otherwise returns true.
See also QMailCodec.
This is an overloaded member function, provided for convenience.
Writes the data of the message body to the stream out, in unencoded form. Line-endings transmitted as CR/LF pairs are converted to \n on extraction. Returns false if the operation causes an error; otherwise returns true.
The 'charset' parameter of the body's content type is used to locate the appropriate QTextCodec to convert the data from an octet stream to unicode, if necessary.
See also QMailCodec, QMailMessageContentType, and QTextCodec.
Returns the transfer encoding type that the body was created with.
Copyright © 2009 Nokia | Trademarks | Qt Extended 4.4.3 |