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 voidAddAttachment(const TDesC &, const TDesC8 &, TUint, TRequestStatus &)
IMPORT_C voidAddAttachment(const TDesC &, const TDesC8 &, TRequestStatus &)
IMPORT_C voidAddAttachment(const TDesC &, TRequestStatus &)
IMPORT_C voidAddAttachment(RFile &, const TDesC8 &, TUint, TRequestStatus &)
IMPORT_C voidAddAttachment(RFile &, const TDesC8 &, TRequestStatus &)
IMPORT_C voidAddAttachment(RFile &, TRequestStatus &)
IMPORT_C voidAddLinkedAttachment(const TDesC &, const TDesC8 &, TUint, TRequestStatus &)
IMPORT_C voidAddLinkedAttachment(const TDesC &, const TDesC8 &, TRequestStatus &)
IMPORT_C voidAddLinkedAttachment(const TDesC &, TRequestStatus &)
IMPORT_C voidAddRecipientL(const TDesC &, TSendAsRecipientType)
IMPORT_C voidAddRecipientL(const TDesC &, const TDesC &, TSendAsRecipientType)
IMPORT_C voidCancel()
IMPORT_C voidClose()
IMPORT_C voidCreateAttachmentL(const TDesC &, RFile &)
IMPORT_C voidCreateAttachmentL(const TDesC &, RFile &, const TDesC8 &)
IMPORT_C voidCreateAttachmentL(const TDesC &, RFile &, const TDesC8 &, TUint)
IMPORT_C voidCreateL(RSendAs &, TSendAsAccount)
IMPORT_C voidCreateL(RSendAs &, TUid)
IMPORT_C voidLaunchEditorAndCloseL()
IMPORT_C voidProgressL(TSendAsProgress &)
IMPORT_C voidSaveMessageAndCloseL()
IMPORT_C voidSendMessage(TRequestStatus &)
IMPORT_C voidSendMessageAndCloseL()
IMPORT_C voidSendMessageConfirmed(TRequestStatus &)
IMPORT_C voidSendMessageConfirmedAndCloseL()
IMPORT_C voidSetBioTypeL(TUid)
IMPORT_C voidSetBodyTextL(const CRichText &)
IMPORT_C voidSetBodyTextL(const TDesC &)
IMPORT_C voidSetCharacterSetL(const TUint)
IMPORT_C voidSetSubjectL(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
enumTSendAsRecipientType { ESendAsRecipientTo = EMsvRecipientTo, ESendAsRecipientCc, ESendAsRecipientBcc }
Private Attributes
TAny *iAny

Member Functions Documentation

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

IMPORT_C voidAddAttachment(const TDesC &aFilePath,
const TDesC8 &aMimeType,
TUintaCharset,
TRequestStatus &aStatus
)

Add an attachment to this message asynchronously.

A copy of the specified file is attached to message.

Parameters

const TDesC & aFilePathThe file name and path for the file being added to the message as an attachment.
const TDesC8 & aMimeTypeThe mime type for this attachment.
TUint aCharsetThe charset for this attachment. The value is a standard IANA charset.
TRequestStatus & aStatusAsynchronous 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 voidAddAttachment(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 & aFilePathThe file name and path for the file being added to the message as an attachment.
const TDesC8 & aMimeTypeThe mime type for this attachment.
TRequestStatus & aStatusAsynchronous 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 voidAddAttachment(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 & aFilePathThe file name and path for the file being added to the message as an attachment.
TRequestStatus & aStatusAsynchronous 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 voidAddAttachment(RFile &aFile,
const TDesC8 &aMimeType,
TUintaCharset,
TRequestStatus &aStatus
)

Add an attachment to this message asynchronously.

A copy of the specified file is attached to message.

Parameters

RFile & aFileThe 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 & aMimeTypeThe mime type for this attachment.
TUint aCharsetThe charset for this attachment. The value is a standard IANA charset.
TRequestStatus & aStatusAsynchronous 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 voidAddAttachment(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 & aFileThe file being added to the message as an attachment. Ownership is transferred .The caller must close the file handle.
const TDesC8 & aMimeTypeThe mime type for this attachment.
TRequestStatus & aStatusAsynchronous 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 voidAddAttachment(RFile &aFile,
TRequestStatus &aStatus
)

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

Parameters

RFile & aFileThe file being added to the message as an attachment. Ownership is transferred .The caller must close the file handle.
TRequestStatus & aStatusAsynchronous 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 voidAddLinkedAttachment(const TDesC &aFilePath,
const TDesC8 &aMimeType,
TUintaCharset,
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 & aFilePathThe file name and path for the file being added to the message as a linked attachment.
const TDesC8 & aMimeTypeThe mime type for this attachment.
TUint aCharsetThe charset for this attachment. The value is a standard IANA charset.
TRequestStatus & aStatusAsynchronous 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 voidAddLinkedAttachment(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 & aFilePathThe file name and path for the file being added to the message as a linked attachment.
const TDesC8 & aMimeTypeThe mime type for this attachment.
TRequestStatus & aStatusAsynchronous 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 voidAddLinkedAttachment(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 & aFilePathThe file name and path for the file being added to the message as a linked attachment.
TRequestStatus & aStatusAsynchronous 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 voidAddRecipientL(const TDesC &aAddress,
TSendAsRecipientTypeaRecipientType
)

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 & aAddressA descriptor holding the address of the recipient to add.
TSendAsRecipientType aRecipientTypeThe recipient type of the address being added. See above.

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

IMPORT_C voidAddRecipientL(const TDesC &aAddress,
const TDesC &aAlias,
TSendAsRecipientTypeaRecipientType
)

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 & aAddressA descriptor holding the address of the recipient to add.
const TDesC & aAliasA descriptor holding the address alias of the recipient to add.
TSendAsRecipientType aRecipientTypeThe recipient type of the address being added. See above.

Cancel()

IMPORT_C voidCancel()

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

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

CreateAttachmentL(const TDesC &, RFile &)

IMPORT_C voidCreateAttachmentL(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 & aFileNameThe filename to assign to the newly create attachment file.
RFile & aAttachmentFileThe 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 voidCreateAttachmentL(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 & aFileNameThe filename to assign to the newly create attachment file.
RFile & aAttachmentFileThe RFile which on return will be opened on the newly created attachment.Ownership is transferred . The caller must close the file handle.
const TDesC8 & aMimeTypeThe mime type for this attachment.

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

IMPORT_C voidCreateAttachmentL(const TDesC &aFileName,
RFile &aAttachmentFile,
const TDesC8 &aMimeType,
TUintaCharset
)

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 & aFileNameThe filename to assign to the newly create attachment file.
RFile & aAttachmentFileThe RFile which on return will be opened on the newly created attachment. Ownership is transferred .The caller must close the file handle.
const TDesC8 & aMimeTypeThe mime type for this attachment.
TUint aCharsetThe charset for this attachment. The value is a standard IANA charset.

CreateL(RSendAs &, TSendAsAccount)

IMPORT_C voidCreateL(RSendAs &aSendAs,
TSendAsAccountaAccount
)

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 & aSendAsThe connection to the SendAs server. This RSendAs object must be connected.
TSendAsAccount aAccountAn account obtained from the CSendAsAccounts helper class.

CreateL(RSendAs &, TUid)

IMPORT_C voidCreateL(RSendAs &aSendAs,
TUidaMessageType
)

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 & aSendAsThe connection to the SendAs server. This RSendAs object must be connected.
TUid aMessageTypeA message type obtained from the CSendAsMessageTypes helper class.

LaunchEditorAndCloseL()

IMPORT_C voidLaunchEditorAndCloseL()

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 voidProgressL(TSendAsProgress &aProgress)

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

Parameters

TSendAsProgress & aProgressProgress information on current asynchronous operation.

SaveMessageAndCloseL()

IMPORT_C voidSaveMessageAndCloseL()

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

SendMessage(TRequestStatus &)

IMPORT_C voidSendMessage(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 & aStatusAsynchronous 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 voidSendMessageAndCloseL()

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 voidSendMessageConfirmed(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 & aStatusAsynchronous 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 voidSendMessageConfirmedAndCloseL()

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 voidSetBioTypeL(TUidaBioType)

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

Parameters

TUid aBioTypeThe biotype for this message.

SetBodyTextL(const CRichText &)

IMPORT_C voidSetBodyTextL(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 & aBodyA CRichText object containing the body to add to the message being constructed.

SetBodyTextL(const TDesC &)

IMPORT_C voidSetBodyTextL(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 & aBodyA descriptor containing the body to add to the message being constructed.

SetCharacterSetL(const TUint)

IMPORT_C voidSetCharacterSetL(const TUintaCharset)

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 aCharsetTUint, indicating the enocding value.

SetSubjectL(const TDesC &)

IMPORT_C voidSetSubjectL(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 & aSubjectA 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]