RSendAsMessage Class Reference

class RSendAsMessage : public RSubSessionBase

Encapsulates creating and sending a message. This class requires a connected RSendAs session.

A client application can have several RSendAsMessage objects created simultaneously. Each RSendAsMessage object corresponds to a single message.

With the RSendAsMessage class, a client application can perform the following operations:

-Creating and managing a message

-Modifying a message created using SendAs

-Sending a message

-Launching a message editor

Client applications do not require any capabilities in order to use the RSendAs and RSendAsMessage APIs. However, if an application does not have the necessary security capabilities to send a message, the SendAs server ensures that a message is only sent after the user's authorization.

A message created using RSendAsMessage can be saved, sent, or passed to the appropriate message editor. There are two types of send operation:

-A confirmed send is forwarded to the UI MTM for the message type. Typically this results in the user being asked to confirm that the message should be sent.

-An unconfirmed send fails if the client application does not have the required capabilities to use the server MTM for the message type.

There are asynchronous and synchronous forms of these sending methods. Progress information for sending is available when the asynchronous forms are used. The synchronous forms, and the methods for saving the message and for launching it in a message editor, all close the handle to the RSendAsMessage , so the message cannot be further accessed through the API.

Inherits from

Public Member Functions
IMPORT_C void AddAttachment (const TDesC &, const TDesC8 &, TUint , TRequestStatus &)
IMPORT_C void AddAttachment (const TDesC &, const TDesC8 &, TRequestStatus &)
IMPORT_C void AddAttachment (const TDesC &, TRequestStatus &)
IMPORT_C void AddAttachment ( RFile &, const TDesC8 &, TUint , TRequestStatus &)
IMPORT_C void AddAttachment ( RFile &, const TDesC8 &, TRequestStatus &)
IMPORT_C void AddAttachment ( RFile &, TRequestStatus &)
IMPORT_C void AddLinkedAttachment (const TDesC &, const TDesC8 &, TUint , TRequestStatus &)
IMPORT_C void AddLinkedAttachment (const TDesC &, const TDesC8 &, TRequestStatus &)
IMPORT_C void AddLinkedAttachment (const TDesC &, TRequestStatus &)
IMPORT_C void AddRecipientL (const TDesC &, TSendAsRecipientType )
IMPORT_C void AddRecipientL (const TDesC &, const TDesC &, TSendAsRecipientType )
IMPORT_C void Cancel ()
IMPORT_C void Close ()
IMPORT_C void CreateAttachmentL (const TDesC &, RFile &)
IMPORT_C void CreateAttachmentL (const TDesC &, RFile &, const TDesC8 &)
IMPORT_C void CreateAttachmentL (const TDesC &, RFile &, const TDesC8 &, TUint )
IMPORT_C void CreateL ( RSendAs &, TSendAsAccount )
IMPORT_C void CreateL ( RSendAs &, TUid )
IMPORT_C void LaunchEditorAndCloseL ()
IMPORT_C void ProgressL ( TSendAsProgress &)
IMPORT_C void SaveMessageAndCloseL ()
IMPORT_C void SendMessage ( TRequestStatus &)
IMPORT_C void SendMessageAndCloseL ()
IMPORT_C void SendMessageConfirmed ( TRequestStatus &)
IMPORT_C void SendMessageConfirmedAndCloseL ()
IMPORT_C void SetBioTypeL ( TUid )
IMPORT_C void SetBodyTextL (const CRichText &)
IMPORT_C void SetBodyTextL (const TDesC &)
IMPORT_C void SetCharacterSetL (const TUint )
IMPORT_C void SetSubjectL (const TDesC &)
Inherited Functions
RSubSessionBase::CloseSubSession(TInt)
RSubSessionBase::CreateAutoCloseSubSession(RSessionBase &,TInt,const TIpcArgs &)
RSubSessionBase::CreateSubSession(const RSessionBase &,TInt)
RSubSessionBase::CreateSubSession(const RSessionBase &,TInt,const TIpcArgs &)
RSubSessionBase::RSubSessionBase()
RSubSessionBase::Send(TInt)const
RSubSessionBase::Send(TInt,const TIpcArgs &)const
RSubSessionBase::SendReceive(TInt)const
RSubSessionBase::SendReceive(TInt,TRequestStatus &)const
RSubSessionBase::SendReceive(TInt,const TIpcArgs &)const
RSubSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
RSubSessionBase::Session()const
RSubSessionBase::SubSessionHandle()const
Public Member Enumerations
enum TSendAsRecipientType { ESendAsRecipientTo  = EMsvRecipientTo, ESendAsRecipientCc , ESendAsRecipientBcc }
Private Attributes
TAny * iAny

Member Functions Documentation

AddAttachment(const TDesC &, const TDesC8 &, TUint, TRequestStatus &)

IMPORT_C void AddAttachment ( const TDesC & aFilePath,
const TDesC8 & aMimeType,
TUint aCharset,
TRequestStatus & aStatus
)

Add an attachment to this message asynchronously.

A copy of the specified file is attached to message.

Parameters

const TDesC & aFilePath The file name and path for the file being added to the message as an attachment.
const TDesC8 & aMimeType The mime type for this attachment.
TUint aCharset The charset for this attachment. The value is a standard IANA charset.
TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

AddAttachment(const TDesC &, const TDesC8 &, TRequestStatus &)

IMPORT_C void AddAttachment ( const TDesC & aFilePath,
const TDesC8 & aMimeType,
TRequestStatus & aStatus
)

Add an attachment to this message asynchronously.

A copy of the specified file is attached to message.

Parameters

const TDesC & aFilePath The file name and path for the file being added to the message as an attachment.
const TDesC8 & aMimeType The mime type for this attachment.
TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

AddAttachment(const TDesC &, TRequestStatus &)

IMPORT_C void AddAttachment ( const TDesC & aFilePath,
TRequestStatus & aStatus
)

Add an attachment to this message. The attachment is copied into the message store from the supplied filename.

Parameters

const TDesC & aFilePath The file name and path for the file being added to the message as an attachment.
TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

AddAttachment(RFile &, const TDesC8 &, TUint, TRequestStatus &)

IMPORT_C void AddAttachment ( RFile & aFile,
const TDesC8 & aMimeType,
TUint aCharset,
TRequestStatus & aStatus
)

Add an attachment to this message asynchronously.

A copy of the specified file is attached to message.

Parameters

RFile & aFile The file being added to the message as an attachment. The file is closed if attached successfully. Ownership is transferred .The caller must close the file handle.
const TDesC8 & aMimeType The mime type for this attachment.
TUint aCharset The charset for this attachment. The value is a standard IANA charset.
TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

AddAttachment(RFile &, const TDesC8 &, TRequestStatus &)

IMPORT_C void AddAttachment ( RFile & aFile,
const TDesC8 & aMimeType,
TRequestStatus & aStatus
)

Add an attachment to this message asynchronously.

A copy of the specified file is attached to message.

Parameters

RFile & aFile The file being added to the message as an attachment. Ownership is transferred .The caller must close the file handle.
const TDesC8 & aMimeType The mime type for this attachment.
TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

AddAttachment(RFile &, TRequestStatus &)

IMPORT_C void AddAttachment ( RFile & aFile,
TRequestStatus & aStatus
)

Add an attachment to this message. The attachment is copied into the message store from the supplied file.

Parameters

RFile & aFile The file being added to the message as an attachment. Ownership is transferred .The caller must close the file handle.
TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

AddLinkedAttachment(const TDesC &, const TDesC8 &, TUint, TRequestStatus &)

IMPORT_C void AddLinkedAttachment ( const TDesC & aFilePath,
const TDesC8 & aMimeType,
TUint aCharset,
TRequestStatus & aStatus
)

Add an attachment to this message. The attachment is linked to the message from the supplied filename. This file must be present when the message is sent.

Parameters

const TDesC & aFilePath The file name and path for the file being added to the message as a linked attachment.
const TDesC8 & aMimeType The mime type for this attachment.
TUint aCharset The charset for this attachment. The value is a standard IANA charset.
TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

AddLinkedAttachment(const TDesC &, const TDesC8 &, TRequestStatus &)

IMPORT_C void AddLinkedAttachment ( const TDesC & aFilePath,
const TDesC8 & aMimeType,
TRequestStatus & aStatus
)

Add an attachment to this message asynchronously.

The attachment is linked to the message from the supplied filename. This file must be present when the message is sent.

Parameters

const TDesC & aFilePath The file name and path for the file being added to the message as a linked attachment.
const TDesC8 & aMimeType The mime type for this attachment.
TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

AddLinkedAttachment(const TDesC &, TRequestStatus &)

IMPORT_C void AddLinkedAttachment ( const TDesC & aFilePath,
TRequestStatus & aStatus
)

Add an attachment to this message asynchronously.

The attachment is linked to the message from the supplied filename. This file must be present when the message is sent.

Parameters

const TDesC & aFilePath The file name and path for the file being added to the message as a linked attachment.
TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

AddRecipientL(const TDesC &, TSendAsRecipientType)

IMPORT_C void AddRecipientL ( const TDesC & aAddress,
TSendAsRecipientType aRecipientType
)

Add a recipient to this message. The recipient's address is held in a descriptor, and is in the correct format for the message type.

The recipient type is one of the TSendAsRecipientType constants, currently one of: ESendAsRecipientTo - The recipient goes in the 'To' field. ESendAsRecipientCc - The recipient goes in the 'Cc' field. ESendAsRecipientBcc - The recipient goes in the 'Bcc' field.

If the 'Cc' field is not supported, the recipient will instead be added to the 'To' field since these are functionally equivalent. If the 'Bcc' field is not supported, this method will return KErrNotSupported.

Parameters

const TDesC & aAddress A descriptor holding the address of the recipient to add.
TSendAsRecipientType aRecipientType The recipient type of the address being added. See above.

AddRecipientL(const TDesC &, const TDesC &, TSendAsRecipientType)

IMPORT_C void AddRecipientL ( const TDesC & aAddress,
const TDesC & aAlias,
TSendAsRecipientType aRecipientType
)

Add a recipient with an alias to this message. The recipient's address is held in a descriptor, and is in the correct format for the message type. The alias is the displayed recipient name.

The recipient type is one of the TSendAsRecipientType constants, currently one of: ESendAsRecipientTo - The recipient goes in the 'To' field. ESendAsRecipientCc - The recipient goes in the 'Cc' field. ESendAsRecipientBcc - The recipient goes in the 'Bcc' field.

If the 'Cc' field is not supported, the recipient will instead be added to the 'To' field since these are functionally equivalent. If the 'Bcc' field is not supported, this method will return KErrNotSupported.

Parameters

const TDesC & aAddress A descriptor holding the address of the recipient to add.
const TDesC & aAlias A descriptor holding the address alias of the recipient to add.
TSendAsRecipientType aRecipientType The recipient type of the address being added. See above.

Cancel()

IMPORT_C void Cancel ( )

Cancels any asynchronous request.

Only a single asynchronous request is supported at any one time. This method cancels the current requests if any.

Close()

IMPORT_C void Close ( )

Close an open message and delete it from the Drafts folder.

CreateAttachmentL(const TDesC &, RFile &)

IMPORT_C void CreateAttachmentL ( const TDesC & aFileName,
RFile & aAttachmentFile
)

Create an attachment to this message. The RFile object should not be open when this method is called. On return, the supplied RFile is able to write into the file.

Parameters

const TDesC & aFileName The filename to assign to the newly create attachment file.
RFile & aAttachmentFile The RFile which on return will be opened on the newly created attachment.Ownership is transferred .The caller must close the file handle.

CreateAttachmentL(const TDesC &, RFile &, const TDesC8 &)

IMPORT_C void CreateAttachmentL ( const TDesC & aFileName,
RFile & aAttachmentFile,
const TDesC8 & aMimeType
)

Create an attachment to this message. The RFile object should not be open when this method is called. On return, the supplied RFile is able to write into the file.

Parameters

const TDesC & aFileName The filename to assign to the newly create attachment file.
RFile & aAttachmentFile The RFile which on return will be opened on the newly created attachment.Ownership is transferred . The caller must close the file handle.
const TDesC8 & aMimeType The mime type for this attachment.

CreateAttachmentL(const TDesC &, RFile &, const TDesC8 &, TUint)

IMPORT_C void CreateAttachmentL ( const TDesC & aFileName,
RFile & aAttachmentFile,
const TDesC8 & aMimeType,
TUint aCharset
)

Create an attachment to this message. The RFile object should not be open when this method is called. On return, the supplied RFile is able to write into the file.

Parameters

const TDesC & aFileName The filename to assign to the newly create attachment file.
RFile & aAttachmentFile The RFile which on return will be opened on the newly created attachment. Ownership is transferred .The caller must close the file handle.
const TDesC8 & aMimeType The mime type for this attachment.
TUint aCharset The charset for this attachment. The value is a standard IANA charset.

CreateL(RSendAs &, TSendAsAccount)

IMPORT_C void CreateL ( RSendAs & aSendAs,
TSendAsAccount aAccount
)

Create a new message in the Drafts folder.

The message type is implied by the type of the account used. The message can be modified or deleted by this object at any time up until the message is sent, deleted or opened in an editor.

Parameters

RSendAs & aSendAs The connection to the SendAs server. This RSendAs object must be connected.
TSendAsAccount aAccount An account obtained from the CSendAsAccounts helper class.

CreateL(RSendAs &, TUid)

IMPORT_C void CreateL ( RSendAs & aSendAs,
TUid aMessageType
)

Create a new message in the Drafts folder.

The message type is specified. The message can be modified or deleted by this object at any time up until the message is sent, deleted or opened in an editor.

Parameters

RSendAs & aSendAs The connection to the SendAs server. This RSendAs object must be connected.
TUid aMessageType A message type obtained from the CSendAsMessageTypes helper class.

LaunchEditorAndCloseL()

IMPORT_C void LaunchEditorAndCloseL ( )

Opens the message in the associated message editor for the message type. The RSendAsMessage handle is closed, so that the message cannot be futher accessed through the object.

ProgressL(TSendAsProgress &)

IMPORT_C void ProgressL ( TSendAsProgress & aProgress )

Retrieve the progress information for this message. This method can be called at any time after message creation.

Parameters

TSendAsProgress & aProgress Progress information on current asynchronous operation.

SaveMessageAndCloseL()

IMPORT_C void SaveMessageAndCloseL ( )

Close an open message and save it in the Drafts folder.

SendMessage(TRequestStatus &)

IMPORT_C void SendMessage ( TRequestStatus & aStatus )

Asynchronously send this message. This method requests that the SendAs server send the message without prompting the user. This will only be allowed to happen if the caller holds sufficient capabilities to perform this action. If the caller does not hold these capabilities, then the message send will be automatically demoted to a confirmed send. The RSendAsMessage API cannot modify the message if this method fails.

Parameters

TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

SendMessageAndCloseL()

IMPORT_C void SendMessageAndCloseL ( )

Sends this message in the background without confirmation and close the handle. This is a synchronous operation. This will only be allowed to happen if the caller holds sufficient capabilities to perform this action. If the caller does not hold these capabilities, then the message send will be automatically demoted to a confirmed send. The RSendAsMessage API cannot modify or resend the message if this method fails. No progress information is available after calling this API.

SendMessageConfirmed(TRequestStatus &)

IMPORT_C void SendMessageConfirmed ( TRequestStatus & aStatus )

Asynchronously send this message. This method requests that the SendAs server send the message, prompting the user for confirmation. This functionality must be supported by the UI MTM for the selected message type. The RSendAsMessage API cannot modify the message if this method fails.

Parameters

TRequestStatus & aStatus Asynchronous status object (TRequestStatus) that is signalled when the operation completes. aStatus should be checked by the caller to ensure that the operation was successful.

SendMessageConfirmedAndCloseL()

IMPORT_C void SendMessageConfirmedAndCloseL ( )

Sends this message in the background and close the handle to it. This is a synchronous operation. This method requests that the SendAs server send the message, prompting the user for confirmation. This functionality must be supported by the UI MTM for the selected message type. The RSendAsMessage API cannot modify or resend the message if this method fails.

SetBioTypeL(TUid)

IMPORT_C void SetBioTypeL ( TUid aBioType )

Set the BIO type of this message. The object must have an open message to use this method.

Parameters

TUid aBioType The biotype for this message.

SetBodyTextL(const CRichText &)

IMPORT_C void SetBodyTextL ( const CRichText & aBody )

Set the body text of this message using a CRichText object. The object must have an open message to use this method.

Parameters

const CRichText & aBody A CRichText object containing the body to add to the message being constructed.

SetBodyTextL(const TDesC &)

IMPORT_C void SetBodyTextL ( const TDesC & aBody )

Set the body text of this message using a plain descriptor. The object must have an open message to use this method.

Parameters

const TDesC & aBody A descriptor containing the body to add to the message being constructed.

SetCharacterSetL(const TUint)

IMPORT_C void SetCharacterSetL ( const TUint aCharset )

Sets the character encoding value. The character encoding value options are 7-bit, 8-bit and 16-Bit Unicode. By default the character set encoding is 7 bit encoding.

Sets the character encoding value. The character encoding value options are 7-bit, 8-bit and 16-Bit Unicode. If this functionality is not supported by the sending MTM (currently for SMS it is supported), it will leave with KErrExtensionNotSupported
leave
KErrExtensionNotSupported If the message is other than SMS.
leave
Other Standard system-wide error codes.

Parameters

const TUint aCharset TUint, indicating the enocding value.

SetSubjectL(const TDesC &)

IMPORT_C void SetSubjectL ( const TDesC & aSubject )

Set the subject of this message using a plain descriptor. The object must have an open message to use this method.

Parameters

const TDesC & aSubject A descriptor containing the subject for the message.

Member Enumerations Documentation

Enum TSendAsRecipientType

Defines the recipient types available when adding a recipient to a message

Enumerators

ESendAsRecipientTo = EMsvRecipientTo

Designates a 'To' recipient.

ESendAsRecipientCc

Designates a 'Cc' recipient.

ESendAsRecipientBcc

Designates a 'Bcc' recipient.

Member Data Documentation

TAny * iAny

TAny * iAny [private]