#include <mw/rsendasmessage.h>
Link against: sendas2.lib
class RSendAsMessage : public RSubSessionBase |
Public Member Enumerations | |
---|---|
enum | TSendAsRecipientType { ESendAsRecipientTo, ESendAsRecipientCc, ESendAsRecipientBcc } |
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.
Defines the recipient types available when adding a recipient to a message
Enumerator | Value | Description |
---|---|---|
ESendAsRecipientTo | EMsvRecipientTo |
Designates a 'To' recipient. |
ESendAsRecipientCc |
Designates a 'Cc' recipient. | |
ESendAsRecipientBcc |
Designates a 'Bcc' recipient. |
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 | |
---|---|
aFilePath | The file name and path for the file being added to the message as an attachment. |
aMimeType | The mime type for this attachment. |
aCharset | The charset for this attachment. The value is a standard IANA charset. |
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. |
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 | |
---|---|
aFilePath | The file name and path for the file being added to the message as an attachment. |
aMimeType | The mime type for this attachment. |
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. |
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 | |
---|---|
aFilePath | The file name and path for the file being added to the message as an attachment. |
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. |
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 | |
---|---|
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. |
aMimeType | The mime type for this attachment. |
aCharset | The charset for this attachment. The value is a standard IANA charset. |
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. |
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 | |
---|---|
aFile | The file being added to the message as an attachment. Ownership is transferred .The caller must close the file handle. |
aMimeType | The mime type for this attachment. |
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. |
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 | |
---|---|
aFile | The file being added to the message as an attachment. Ownership is transferred .The caller must close the file handle. |
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. |
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 | |
---|---|
aFilePath | The file name and path for the file being added to the message as a linked attachment. |
aMimeType | The mime type for this attachment. |
aCharset | The charset for this attachment. The value is a standard IANA charset. |
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. |
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 | |
---|---|
aFilePath | The file name and path for the file being added to the message as a linked attachment. |
aMimeType | The mime type for this attachment. |
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. |
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 | |
---|---|
aFilePath | The file name and path for the file being added to the message as a linked attachment. |
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. |
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 | |
---|---|
aAddress | A descriptor holding the address of the recipient to add. |
aRecipientType | The recipient type of the address being added. See above. |
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 | |
---|---|
aAddress | A descriptor holding the address of the recipient to add. |
aAlias | A descriptor holding the address alias of the recipient to add. |
aRecipientType | The recipient type of the address being added. See above. |
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.
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 | |
---|---|
aFileName | The filename to assign to the newly create attachment file. |
aAttachmentFile | The RFile which on return will be opened on the newly created attachment.Ownership is transferred .The caller must close the file handle. |
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 | |
---|---|
aFileName | The filename to assign to the newly create attachment file. |
aAttachmentFile | The RFile which on return will be opened on the newly created attachment.Ownership is transferred . The caller must close the file handle. |
aMimeType | The mime type for this attachment. |
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 | |
---|---|
aFileName | The filename to assign to the newly create attachment file. |
aAttachmentFile | The RFile which on return will be opened on the newly created attachment. Ownership is transferred .The caller must close the file handle. |
aMimeType | The mime type for this attachment. |
aCharset | The charset for this attachment. The value is a standard IANA charset. |
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 | |
---|---|
aSendAs | The connection to the SendAs server. This RSendAs object must be connected. |
aAccount | An account obtained from the CSendAsAccounts helper class. |
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 | |
---|---|
aSendAs | The connection to the SendAs server. This RSendAs object must be connected. |
aMessageType | A message type obtained from the CSendAsMessageTypes helper class. |
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.
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 | |
---|---|
aProgress | Progress information on current asynchronous operation. |
IMPORT_C void | SaveMessageAndCloseL | ( | ) |
Close an open message and save it in the Drafts folder.
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 | |
---|---|
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. |
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.
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 | |
---|---|
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. |
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.
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 | |
---|---|
aBioType | The biotype for this message. |
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 | |
---|---|
aBody | A CRichText object containing the body to add to the message being constructed. |
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 | |
---|---|
aBody | A descriptor containing the body to add to the message being constructed. |
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.
Parameters | |
---|---|
aCharset | TUint, indicating the enocding value. |
Leave Codes | |
---|---|
KErrExtensionNotSupported | If the message is other than SMS. |
Other | Standard system-wide error codes. |
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 | |
---|---|
aSubject | A descriptor containing the subject for the message. |