Home · All Classes · Grouped Classes · Annotated · Functions

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

Public Types

Public Functions

Static Public Members


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.

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

Messages can be added to the QMailStore, or retrieved from the store via their QMailId identifier.

See also QMailMessagePart, QMailMessageBody, QMailStore, and QMailId.


Member Type Documentation

enum QMailMessage::AttachmentsAction

This enum type is used to describe the action that should be performed on each message attachment.

ConstantValueDescription
QMailMessage::LinkToAttachments0Add a part to the message containing a link to the supplied attachment. If the document is removed, the message will no longer have access to the data.
QMailMessage::CopyAttachments1Add a part to the message containing a copy of the data in the supplied attachment. If the document is removed, the message will still contain the data.
QMailMessage::CopyAndDeleteAttachments2Add a part to the message containing a copy of the data in the supplied attachment, then delete the document from which the data was copied.

enum QMailMessage::EncodingFormat

This enum type is used to describe the format in which a message should be serialized.

ConstantValueDescription
QMailMessage::HeaderOnlyFormat1Only the header portion of the message is serialized, to RFC 2822 form.
QMailMessage::StorageFormat2The message is serialized to RFC 2822 form, without attachments.
QMailMessage::TransmissionFormat3The entire message is serialized to RFC 2822 form, with additional header fields added if necessary, and 'bcc' header field omitted.
QMailMessage::IdentityFormat4The entire message is serialized to RFC 2822 form, with only Content-Type and Content-Transfer-Encoding headers added where required.
QMailMessage::SerializationFormat5The entire message is serialized to RFC 2822 form for internal use only.

enum QMailMessage::MailDataSelection

This enum type is used to describe the data to be loaded from the message store when constructing a QMailMessage.

ConstantValueDescription
QMailMessage::Header0Load the message header data only.
QMailMessage::HeaderAndBody1Load the message header data and body data.

enum QMailMessage::MessageStatusFlag
flags QMailMessage::Status

This enum type is used to describe the state and type of a message.

ConstantValueDescription
QMailMessage::Incoming0x0001The message is in incoming message retrieved from the network.
QMailMessage::Outgoing0x0002The message is an outgoing message intended to be delivered over the network.
QMailMessage::Sent0x0004The message has been delivered over the network.
QMailMessage::Replied0x0008A message replying to the author of this message has been created.
QMailMessage::RepliedAll0x0010A new message replying to the author and all the recipients of the message other than the user has been created.
QMailMessage::Forwarded0x0020A forwarded version of the message has been created.
QMailMessage::Downloaded0x0040The message is completed, it is not a partial message where some data has not been retrieved from the originating server.
QMailMessage::Read0x0080The message has been marked as read by the user.
QMailMessage::Removed0x0100The message has been deleted from or moved on the originating server.
QMailMessage::ReadElsewhere0x0200The message is not new, since the server has already reported its existence to some client.

The Status type is a typedef for QFlags<MessageStatusFlag>. It stores an OR combination of MessageStatusFlag values.

enum QMailMessage::MessageType

This enum type is used to describe the type of a message.

ConstantValueDescription
QMailMessage::Mms0x1The message is an MMS.
QMailMessage::Sms0x4The message is an SMS.
QMailMessage::Email0x8The message is an Email.
QMailMessage::System0x10The message is a system report.
QMailMessage::None0Indicates no message type.
QMailMessage::AnyTypeMms | Sms | Email | SystemIndicates any type of message.


Member Function Documentation

QMailMessage::QMailMessage ()

Constructs an empty message object.

QMailMessage::QMailMessage ( const QMailId & id, MailDataSelection selection = HeaderAndBody )

Constructs a message object from data stored in the message store with QMailId id, and mail data selection defined by selection.

QMailMessage::QMailMessage ( const QString & uid, const QString & account, MailDataSelection selection = HeaderAndBody )

Constructs a message object from data stored in the message store with the unique identifier uid from the account account, and mail data selection defined by selection.

QList<QMailAddress> QMailMessage::bcc () const

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

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

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

QMailTimeStamp QMailMessage::date () const

Returns the timestamp contained in the origination date header field of the message, if present; otherwise returns an empty string.

See also setDate().

QMailAddress QMailMessage::from () const

Returns the originating address of the message.

See also setFrom().

QString QMailMessage::fromAccount () const

Returns the name of the originating account for the message.

See also setFromAccount().

QString QMailMessage::fromMailbox () const

Returns the name of the originating mailbox for the message.

See also setFromMailbox().

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

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

QMailId QMailMessage::id () const

Returns the Qtopia unique QMailId of the message.

See also setId().

QString QMailMessage::inReplyTo () const

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

Returns an indication of the size of the message. This measure should be used only in comparing the relative size of messages with respect to transmission.

MessageType QMailMessage::messageType () const

Returns the MessageType of the message.

See also setMessageType().

QMailId QMailMessage::parentFolderId () const

Return the QMailId of the parent of the folder that contains the message.

See also setParentFolderId().

QList<QMailAddress> QMailMessage::recipients () const

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().

QMailAddress QMailMessage::replyTo () const

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

See also setReplyTo().

QString QMailMessage::serverUid () const

Returns the identifier for the message on the originating server.

See also setServerUid().

void QMailMessage::setBcc ( const QList<QMailAddress> & bccList )

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 )

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

See also setTo() and setBcc().

void QMailMessage::setDate ( const QMailTimeStamp & timeStamp )

Sets the origination date header field specifying the timestamp of the message to timeStamp.

See also date().

void QMailMessage::setFrom ( const QMailAddress & from )

Sets the from address, that is the originating address of the message to from.

See also from().

void QMailMessage::setFromAccount ( const QString & account )

Sets the name of the originating account for the message to account.

See also fromAccount().

void QMailMessage::setFromMailbox ( const QString & mailBox )

Sets the name of the originating mailbox for the message to mailBox.

See also fromMailbox().

void QMailMessage::setId ( QMailId id )

Sets the QMailId of the message to id. id should be different for each message known to Qtopia.

See also id().

void QMailMessage::setInReplyTo ( const QString & messageId )

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

See also inReplyTo().

void QMailMessage::setMessageType ( MessageType type )

Sets the MessageType of the message to type.

See also messageType().

void QMailMessage::setParentFolderId ( QMailId id )

Sets the QMailId of the parent of the folder that contains the message to id.

See also parentFolderId().

void QMailMessage::setReplyTo ( const QMailAddress & address )

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

See also replyTo().

void QMailMessage::setServerUid ( const QString & server )

Sets the originating server identifier for the message to server. The identifier specified should be unique.

See also serverUid().

void QMailMessage::setSize ( uint size )

Sets the complete size of the message as found on the server to size.

See also size().

void QMailMessage::setStatus ( Status flags )

Sets the status flags for the message to the given flags.

See also status().

void QMailMessage::setStatus ( MessageStatusFlag flag, bool set )

This is an overloaded member function, provided for convenience.

If set is true, sets the individual status flag; otherwise the flag is cleared.

void QMailMessage::setSubject ( const QString & subject )

Sets the subject of the message to subject.

See also subject().

void QMailMessage::setTo ( const QList<QMailAddress> & toList )

Sets the list of primary recipients for the message to toList.

See also to(), setCc(), and setBcc().

void QMailMessage::setTo ( const QMailAddress & address )

This is an overloaded member function, provided for convenience.

Sets the list of primary recipients for the message to contain address.

See also setCc() and setBcc().

uint QMailMessage::size () const

Returns the complete size of the message as indicated on the originating server.

See also setSize().

Status QMailMessage::status () const

Returns the status flags for the message.

See also setStatus().

QString QMailMessage::subject () const

Returns the subject of the message, if present; otherwise returns an empty string.

See also setSubject().

QList<QMailAddress> QMailMessage::to () const

Returns the list of primary recipients for the message.

See also setTo(), cc(), bcc(), and QMailAddress.

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

This is an overloaded member function, provided for convenience.

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


Copyright © 2008 Nokia Trademarks
Qtopia 4.3.3