Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QMailMessage Class Reference
[QtMessagingModule, QtPimModule]

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

Public Types

  • enum AttachmentsAction { LinkToAttachments, CopyAttachments, CopyAndDeleteAttachments }
  • enum EncodingFormat { HeaderOnlyFormat, StorageFormat, TransmissionFormat, IdentityFormat }

Public Functions

  • QMailMessage ( const QMailMessageId & id )
  • QMailMessage ( const QString & uid, const QMailAccountId & accountId )
  • virtual QList<QMailAddress> bcc () const
  • virtual QList<QMailAddress> cc () const
  • virtual bool hasRecipients () const
  • virtual QString inReplyTo () const
  • 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 setInReplyTo ( const QString & messageId )
  • virtual void setReplyTo ( const QMailAddress & address )
  • QByteArray toRfc2822 ( EncodingFormat format = TransmissionFormat ) const
  • void toRfc2822 ( QDataStream & out, EncodingFormat format = TransmissionFormat ) const

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.

Messages can be added to the QMailStore, or retrieved from the store via their QMailMessageId identifier. The QMailMessage object also provides acces 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 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.


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.

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.

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

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

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

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.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment créer une fenêtre À propos

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web