Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: rsendasmessage.h
Link against: sendas2.lib

Class RSendAsMessage

class RSendAsMessage : public RSubSessionBase;

Description

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.

Derivation

Members

Defined in RSendAsMessage:
AddAttachment(), AddAttachment(), AddAttachment(), AddAttachment(), AddAttachment(), AddAttachment(), AddLinkedAttachment(), AddLinkedAttachment(), AddLinkedAttachment(), AddRecipientL(), AddRecipientL(), Cancel(), Close(), CreateAttachmentL(), CreateAttachmentL(), CreateAttachmentL(), CreateL(), CreateL(), ESendAsRecipientBcc, ESendAsRecipientCc, ESendAsRecipientTo, LaunchEditorAndCloseL(), ProgressL(), SaveMessageAndCloseL(), SendMessage(), SendMessageAndCloseL(), SendMessageConfirmed(), SendMessageConfirmedAndCloseL(), SetBioTypeL(), SetBodyTextL(), SetBodyTextL(), SetSubjectL(), TSendAsRecipientType

Inherited from RSubSessionBase:
CloseSubSession(), CreateAutoCloseSubSession(), CreateSubSession(), Send(), SendReceive(), Session(), SubSessionHandle()

See also


Member functions


CreateL()

IMPORT_C void CreateL(RSendAs &aSendAs, TSendAsAccount aAccount);

Description

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

IMPORT_C void CreateL(RSendAs &aSendAs, TUid aMessageType);

Description

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.


SendMessage()

IMPORT_C void SendMessage(TRequestStatus &aStatus);

Description

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

Description

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

IMPORT_C void SendMessageConfirmed(TRequestStatus &aStatus);

Description

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

Description

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.


LaunchEditorAndCloseL()

IMPORT_C void LaunchEditorAndCloseL();

Description

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.


SaveMessageAndCloseL()

IMPORT_C void SaveMessageAndCloseL();

Description

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


ProgressL()

IMPORT_C void ProgressL(TSendAsProgress &aProgress);

Description

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.


SetBodyTextL()

IMPORT_C void SetBodyTextL(const CRichText &aBody);

Description

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

IMPORT_C void SetBodyTextL(const TDesC &aBody);

Description

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.


SetSubjectL()

IMPORT_C void SetSubjectL(const TDesC &aSubject);

Description

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.


SetBioTypeL()

IMPORT_C void SetBioTypeL(TUid aBioType);

Description

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.


AddRecipientL()

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

Description

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

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

Description

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.


AddAttachment()

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

Description

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

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

Description

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

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

Description

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

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

Description

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

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

Description

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

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

Description

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

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

Description

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

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

Description

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

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

Description

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.


CreateAttachmentL()

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

Description

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

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

Description

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

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

Description

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.


Cancel()

IMPORT_C void Cancel();

Description

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

Description

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

[Top]


Member enumerations


Enum TSendAsRecipientType

TSendAsRecipientType

Description

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

ESendAsRecipientTo

Designates a 'To' recipient.

ESendAsRecipientCc

Designates a 'Cc' recipient.

ESendAsRecipientBcc

Designates a 'Bcc' recipient.