Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: MIUTMSG.H
Link against: imcm.lib

Class CImEmailOperation

class CImEmailOperation : public CMsvOperation;

Description

Provides simple email messages creation functions, including creation of new messages, replies, forwarded messages, and receipts.

Both plain-text and HTML messages, with or without attachments, can be created.

Derivation

Members

Defined in CImEmailOperation:
CreateForwardAsAttachmentL(), CreateForwardAsAttachmentL(), CreateForwardL(), CreateForwardL(), CreateForwardL(), CreateNewL(), CreateNewL(), CreateReceiptL(), CreateReceiptL(), CreateReceiptL(), CreateReplyL(), CreateReplyL(), CreateReplyL(), DoCancel(), FinalProgress(), ProgressL(), RunL(), ~CImEmailOperation()

Inherited from CActive:
Cancel(), Deque(), EPriorityHigh, EPriorityIdle, EPriorityLow, EPriorityStandard, EPriorityUserInput, IsActive(), IsAdded(), Priority(), RunError(), SetActive(), SetPriority(), TPriority, iStatus

Inherited from CBase:
Delete(), operator new()

Inherited from CMsvOperation:
Extension_(), Id(), Mtm(), Service(), SystemProgress(), iMsvSession, iMtm, iObserverRequestStatus, iService


Construction and destruction


~CImEmailOperation()

IMPORT_C ~CImEmailOperation();

Description

Destructor.

[Top]


Member functions


CreateNewL()

static IMPORT_C CImEmailOperation *CreateNewL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType);

Description

Creates a new email message.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateNewL()

static IMPORT_C CImEmailOperation *CreateNewL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aDestination, TMsvId aSmtpServiceId, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType, TInt aPriority=EPriorityStandard);

Description

Creates a new email message with a specified priority and SMTP service.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvId aSmtpServiceId

The Id of the SMTP service entry to handle the email

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

TInt aPriority

The priority setting for the email

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateReplyL()

static IMPORT_C CImEmailOperation *CreateReplyL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TDesC &aFormatString, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType);

Description

Creates a reply email message, overriding the default subject format string.

The aFormatString parameter allows you to override the default string used in the subject field of the new message (the default is the localised string STRING_reply_formatting_string1 defined in the source file imcm.rls).

Note that if you reply to an HTML message that does not contain a text/plain alternative to the HTML, then the HTML part is copied as an attachment (still an HTML entry) into the new message even if aPartList does not specify KMsvMessagePartAttachments. This occurs because there is no other way of reading the original message unless the user switches between the editor/viewer and the application.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the message to reply to

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text is required, then set KMsvMessagePartBody; if attachments are required too, also set KMsvMessagePartAttachments. To reply to the originator only, set KMsvMessagePartOriginator, otherwise a reply will be sent to all recipients of the original message. If the subject field is not required, then do not set KMsvMessagePartDescription.

const TDesC &aFormatString

A string to be inserted into the subject field in the header before the subject, e.g. "Re: %S", sets the field to be "Re: " followed by the original subject text

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateReplyL()

static IMPORT_C CImEmailOperation *CreateReplyL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType);

Description

Creates a reply email message.

For details of how replies to HTML messages are handled, see the description above for the first overload of this function.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the message to reply to

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateReplyL()

static IMPORT_C CImEmailOperation *CreateReplyL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType, TInt aPriority);

Description

Creates a reply email message, specifying a message priority.

For details of how replies to HTML messages are handled, see the description above for the first overload of this function.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the message to reply to

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

TInt aPriority

The priority setting for the email

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateForwardL()

static IMPORT_C CImEmailOperation *CreateForwardL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TDesC &aFormatString, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType);

Description

Creates a forwarded email message, overriding the default subject format string.

The aFormatString parameter allows you to override the default string used in the subject field of the new message (the default is the localised string STRING_forward_formatting_string1 defined in the source file imcm.rls).

Note that if you forward an HTML message that does not contain a text/plain alternative to the HTML, then the HTML part is copied as an attachment (still an HTML entry) into the new message even if aPartList does not specify KMsvMessagePartAttachments. This occurs because there is no other way of reading the original message unless the user switches between the editor/viewer and the application.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the message to forward

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TDesC &aFormatString

A string to be inserted into the subject field in the header before the subject, e.g. "Fwd: %S", sets the field to be "Fwd: " followed by the original subject text

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateForwardL()

static IMPORT_C CImEmailOperation *CreateForwardL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType);

Description

Creates a forwarded email message.

For details of how forwarding HTML messages is handled, see the description above for the first overload of this function.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the message to forward

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateForwardL()

static IMPORT_C CImEmailOperation *CreateForwardL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvId aSmtpServiceId, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType, TInt aPriority=EPriorityStandard);

Description

Creates a forwarded email message, specifying the message priority and SMTP service with which to send the message.

For details of how forwarding HTML messages is handled, see the description above for the first overload of this function.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the message to forward

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvId aSmtpServiceId

The Id of the SMTP service with which to send the new message

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

TInt aPriority

The priority setting for the email

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateForwardAsAttachmentL()

static IMPORT_C CImEmailOperation *CreateForwardAsAttachmentL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType);

Description

Creates a forwarded email message.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the message to forward

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateForwardAsAttachmentL()

static IMPORT_C CImEmailOperation *CreateForwardAsAttachmentL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aSmtpServiceId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType, TInt aPriority=EPriorityStandard);

Description

Creates a forwarded email message, specifying the message priority and SMTP service with which to send the message.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the message to forward

TMsvId aSmtpServiceId

The Id of the folder where the new message is to be created

TMsvId aDestination

The Id of the SMTP service with which to send the new message

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

TInt aPriority

The priority setting for the email

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateReceiptL()

static IMPORT_C CImEmailOperation *CreateReceiptL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TDesC &aFormatString, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType);

Description

Creates a email receipt message, overriding the default subject format string.

The aFormatString parameter allows you to override the default string used in the subject field of the new message (the default is the localised string STRING_receipt_formatting_string1 defined in the source file imcm.rls).

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the original message for which the receipt is required

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TDesC &aFormatString

A string to be inserted into the subject field in the header before the subject, e.g. "Receipt of message: %S", sets the field to be "Receipt of message: " followed by the original subject text

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateReceiptL()

static IMPORT_C CImEmailOperation *CreateReceiptL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType);

Description

Creates a email receipt message.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the original message for which the receipt is required

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

Return value

CImEmailOperation *

Operation object by which to control the operation


CreateReceiptL()

static IMPORT_C CImEmailOperation *CreateReceiptL(TRequestStatus &aObserverRequestStatus, CMsvSession &aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList &aMsvEmailTypeList, TUid aMsgType, TInt aPriority);

Description

Creates a email receipt message, specifying the message priority.

Parameters

TRequestStatus &aObserverRequestStatus

Asynchronous status word to complete when the operation completes

CMsvSession &aMsvSession

Message server session to use

TMsvId aMessageId

The Id of the original message for which the receipt is required

TMsvId aDestination

The Id of the folder where the new message is to be created

TMsvPartList aPartList

The body parts that are required in the new message. If a message with body text and attachments is required, then the KMsvMessagePartBody and KMsvMessagePartAttachments parts have to be set.

const TMsvEmailTypeList &aMsvEmailTypeList

Creation flags. This can be 0, or a bitmask of KMsvEmailTypeListMHTMLMessage, KMsvEmailTypeListInvisibleMessage, and KMsvEmailTypeListMessageInPreparation. If KMsvEmailTypeListMHTMLMessage is not set, a plain-text message is created.

TUid aMsgType

The type of message to create e.g. KUidMsgTypeSMTP.

TInt aPriority

The priority setting for the email

Return value

CImEmailOperation *

Operation object by which to control the operation


FinalProgress()

virtual IMPORT_C const TDesC8 &FinalProgress();

Description

Gets progress information for a completed operation.

The function returns (in packaged form):

for a successfully completed operation, the Id of the new message

if there was an error/problem while creating the message, a null Id (KMsvNullIndexEntryId). The new message will also be deleted.

Return value

const TDesC8 &

A message Id as a TPckg<TMsvId>


DoCancel()

virtual void DoCancel();

Description

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel().

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel().


RunL()

virtual void RunL();

Description

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.


ProgressL()

virtual const TDesC8 &ProgressL();

Description

Gets progress information.

While the operation is in progress, a null Id (KMsvNullIndexEntryId) is returned. For a completed operation, values are as described for FinalProgress().

Return value

const TDesC8 &

A message Id as a TPckg<TMsvId>