|  | Home |

# QMailMessage Class Reference

The QMailMessage class provides a convenient interface for working with messages. More...

        #include <QMailMessage>

This class is under development and is subject to change.

Inherits QMailMessageMetaData, QMailMessagePartContainer, and QMailMessageFwd.

- List of all members, including inherited members

## Public Functions

| QMailMessage ()
| QMailMessage ( const QMailMessageId & id )
| QMailMessage ( const QString & uid, const QMailAccountId & accountId )
virtual QList<QMailAddress> | bcc () const
virtual QList<QMailAddress> | cc () const
bool | contains ( const QMailMessagePart::Location & location ) const
virtual uint | contentSize () const
virtual QString | externalLocationReference () const
virtual bool | hasRecipients () const
virtual QString | inReplyTo () const
const QMailMessagePart & | partAt ( const QMailMessagePart::Location & location ) const
QMailMessagePart & | partAt ( const QMailMessagePart::Location & location )
virtual QList<QMailAddress> | recipients () const
virtual QMailAddress | replyTo () const
virtual void | setBcc ( const QList<QMailAddress> & bccList )
virtual void | setCc ( const QList<QMailAddress> & ccList )
virtual void | setContentSize ( uint size )
virtual void | setExternalLocationReference ( const QString & location )
virtual void | setInReplyTo ( const QString & messageId )
virtual void | setReplyTo ( const QMailAddress & address )
QByteArray | toRfc2822 ( EncodingFormat format = TransmissionFormat ) const
void | toRfc2822 ( QDataStream & out, EncodingFormat format = TransmissionFormat ) const
QList<QMailMessage::MessageChunk> | toRfc2822Chunks ( EncodingFormat format = TransmissionFormat ) const

## Reimplemented Public Functions

virtual void | appendHeaderField ( const QString & id, const QString & value )
virtual void | appendHeaderField ( const QMailMessageHeaderField & field )
virtual bool | contentAvailable () const
virtual uint | indicativeSize () const
virtual bool | partialContentAvailable () const
virtual void | removeHeaderField ( const QString & id )
virtual void | setDate ( const QMailTimeStamp & timeStamp )
virtual void | setFrom ( const QMailAddress & from )
virtual void | setHeaderField ( const QString & id, const QString & value )
virtual void | setHeaderField ( const QMailMessageHeaderField & field )
virtual void | setId ( const QMailMessageId & id )
virtual void | setSubject ( const QString & subject )
virtual void | setTo ( const QList<QMailAddress> & toList )
virtual void | setTo ( const QMailAddress & address )

- 57 public functions inherited from QMailMessageMetaData
- 40 public functions inherited from QMailMessagePartContainer

## Static Public Members

QMailMessage | fromRfc2822 ( const QByteArray & byteArray )
QMailMessage | fromRfc2822File ( const QString & fileName )

- 29 static public members inherited from QMailMessageMetaData
- 2 static public members inherited from QMailMessagePartContainer

## Detailed Description

The QMailMessage class provides a convenient interface for working with messages.

QMailMessage supports a number of types. These include telephony types such as SMS and MMS, and Internet email messages as defined in RFC 2822 (Internet Message Format), and RFC 2045 (Format of Internet Message Bodies) through RFC 2049 (Conformance Criteria and Examples).

The most common way to use QMailMessage is to initialize it from raw data using QMailMessage::fromRfc2822().

A QMailMessage can also be constructed piece by piece using functions such as setMessageType(), setFrom(), setTo(), setSubject(), and setBody() or appendPart(). Convenience functions such as from()/setFrom() and date()/setDate() accept and return wrapper types, to simplify the exchange of correctly-formatted data. In some cases, however, it may be simpler for clients to get and set the content of header fields directly, using the headerField() and setHeaderField() functions inherited from QMailMessagePartContainer.

Messages can be added to the QMailStore, or retrieved from the store via their QMailMessageId identifier. The QMailMessage object also provides access to any relevant meta data describing the message, using the functions inherited from QMailMessageMetaData.

A message may be serialized to a QDataStream, or returned as a QByteArray using toRfc2822().

See also QMailMessageMetaData, QMailMessagePart, QMailMessageBody, QMailStore, and QMailMessageId.

## Member Function Documentation

### QMailMessage::QMailMessage ()

Constructs an empty message object.

### QMailMessage::QMailMessage ( const QMailMessageId & id )

Constructs a message object from data stored in the message store with QMailMessageId id.

### QMailMessage::QMailMessage ( const QString & uid, const QMailAccountId & accountId )

Constructs a message object from data stored in the message store with the unique identifier uid from the account with id accountId.

### void QMailMessage::appendHeaderField ( const QString & id, const QString & value ) `[virtual]`

Reimplemented from QMailMessagePartContainer::appendHeaderField().

### void QMailMessage::appendHeaderField ( const QMailMessageHeaderField & field ) `[virtual]`

Reimplemented from QMailMessagePartContainer::appendHeaderField().

### QList<QMailAddress> QMailMessage::bcc () const `[virtual]`

Returns a list of all the bcc (blind carbon copy) recipients specified for the message.

See also setBcc(), to(), cc(), and QMailAddress.

### QList<QMailAddress> QMailMessage::cc () const `[virtual]`

Returns a list of all the cc (carbon copy) recipients specified for the message.

See also setCc(), to(), bcc(), and QMailAddress.

### bool QMailMessage::contains ( const QMailMessagePart::Location & location ) const

Returns true if the message contains a part with the location location.

### bool QMailMessage::contentAvailable () const `[virtual]`

Reimplemented from QMailMessageMetaData::contentAvailable().

### uint QMailMessage::contentSize () const `[virtual]`

Returns the size of the message content excluding any meta data, in bytes.

See also setContentSize().

### QString QMailMessage::externalLocationReference () const `[virtual]`

Returns a value by which the external location of the message can be referenced, if available.

See also setExternalLocationReference().

### QMailMessage QMailMessage::fromRfc2822 ( const QByteArray & byteArray ) `[static]`

Constructs a mail message from the RFC 2822 data contained in byteArray.

### QMailMessage QMailMessage::fromRfc2822File ( const QString & fileName ) `[static]`

Constructs a mail message from the RFC 2822 data contained in the file fileName.

### bool QMailMessage::hasRecipients () const `[virtual]`

Returns true if there are any recipients (either To, CC or BCC addresses) defined for this message; otherwise returns false.

### QString QMailMessage::inReplyTo () const `[virtual]`

Returns the message ID specified by the RFC 2822 'In-Reply-To' field for the message, if present.

See also setInReplyTo().

### uint QMailMessage::indicativeSize () const `[virtual]`

Reimplemented from QMailMessageMetaData::indicativeSize().

### const QMailMessagePart & QMailMessage::partAt ( const QMailMessagePart::Location & location ) const

Returns a const reference to the part at the location location within the message.

### QMailMessagePart & QMailMessage::partAt ( const QMailMessagePart::Location & location )

Returns a non-const reference to the part at the location location within the message.

### bool QMailMessage::partialContentAvailable () const `[virtual]`

Reimplemented from QMailMessageMetaData::partialContentAvailable().

### QList<QMailAddress> QMailMessage::recipients () const `[virtual]`

Returns a list of all the recipients specified for the message, either as To, CC, or BCC addresses.

See also to(), cc(), bcc(), and hasRecipients().

### void QMailMessage::removeHeaderField ( const QString & id ) `[virtual]`

Reimplemented from QMailMessagePartContainer::removeHeaderField().

### QMailAddress QMailMessage::replyTo () const `[virtual]`

Returns the address specified by the RFC 2822 'Reply-To' field for the message, if present.

See also setReplyTo().

### void QMailMessage::setBcc ( const QList<QMailAddress> & bccList ) `[virtual]`

Set the list of bcc (blind carbon copy) recipients for the message to bccList.

See also bcc(), setTo(), and setCc().

### void QMailMessage::setCc ( const QList<QMailAddress> & ccList ) `[virtual]`

Set the list of cc (carbon copy) recipients for the message to ccList.

See also setTo() and setBcc().

### void QMailMessage::setContentSize ( uint size ) `[virtual]`

Sets the size of the message content excluding any meta data to size, in bytes.

See also contentSize().

### void QMailMessage::setDate ( const QMailTimeStamp & timeStamp ) `[virtual]`

Reimplemented from QMailMessageMetaData::setDate().

### void QMailMessage::setExternalLocationReference ( const QString & location ) `[virtual]`

Returns the value by which the external location of the message can be referenced to location.

See also externalLocationReference().

### void QMailMessage::setFrom ( const QMailAddress & from ) `[virtual]`

Reimplemented from QMailMessageMetaData::setFrom().

### void QMailMessage::setHeaderField ( const QString & id, const QString & value ) `[virtual]`

Reimplemented from QMailMessagePartContainer::setHeaderField().

### void QMailMessage::setHeaderField ( const QMailMessageHeaderField & field ) `[virtual]`

Reimplemented from QMailMessagePartContainer::setHeaderField().

### void QMailMessage::setId ( const QMailMessageId & id ) `[virtual]`

Reimplemented from QMailMessageMetaData::setId().

### void QMailMessage::setInReplyTo ( const QString & messageId ) `[virtual]`

Sets the RFC 2822 'In-Reply-To' field for the message to messageId.

See also inReplyTo().

### void QMailMessage::setReplyTo ( const QMailAddress & address ) `[virtual]`

Sets the RFC 2822 'Reply-To' address of the message to address.

See also replyTo().

### void QMailMessage::setSubject ( const QString & subject ) `[virtual]`

Reimplemented from QMailMessageMetaData::setSubject().

### void QMailMessage::setTo ( const QList<QMailAddress> & toList ) `[virtual]`

Reimplemented from QMailMessageMetaData::setTo().

### void QMailMessage::setTo ( const QMailAddress & address ) `[virtual]`

Reimplemented from QMailMessageMetaData::setTo().

### QByteArray QMailMessage::toRfc2822 ( EncodingFormat format = TransmissionFormat ) const

Returns the message in RFC 2822 format. The encoded content will vary depending on the value of format.

### void QMailMessage::toRfc2822 ( QDataStream & out, EncodingFormat format = TransmissionFormat ) const

Writes the message to the output stream out, in RFC 2822 format. The encoded content will vary depending on the value of format.

### QList<QMailMessage::MessageChunk> QMailMessage::toRfc2822Chunks ( EncodingFormat format = TransmissionFormat ) const

Returns the message in RFC 2822 format, separated into chunks that can be individually transferred by a mechanism such as that defined by RFC 3030. The encoded content will vary depending on the value of format.