The client application can request to send the created message in two ways unconfirmed and confirmed.
For a confirmed send request, the SendAs server uses the UI MTM of
the message type to confirm that the message can be sent. Typically the UI
MTM queries the user, who can accept or refuse to send it. If the send is
refused by the user, the send request completes with the error KErrPermissionDenied
.
The message remains in the Drafts folder, and can still be accessed through
the SendAs API.
For an unconfirmed send, the client must have the security capabilities required by the MTM to send messages (SMS and email, for example, require Network Services). The call leaves if the client does not have the required capabilities.
For an unconfirmed send, or a confirmed send that has been accepted by the user, the message is copied to the Outbox. The MTM for the message type is then used to send the message. The message is no longer accessible through the SendAs APIs, and the client application cannot modify or delete it.
The outcome of a successful or unsuccessful send is dependent on the MTMs for the message type. For instance, a successfully sent message may be moved to the Sent folder (for example, SMS) or deleted (for example, OBEX), while an unsuccessfully sent message may remain in the Outbox and can be rescheduled depending on the send error (for example, SMS).
Send the message using the synchronous methods or the asynchronous methods.
The synchronous methods, RSendAsMessage::SendMessageAndCloseL()
and
RSendAsMessage::SendMessageConfirmedAndCloseL()
, send
the message in the background and close the RSendAsMessage
handle.
The
asynchronous methods, RSendAsMessage::SendMessage()
and
RSendAsMessage::SendMessageConfirmed()
, require further
processing:
Any send errors are reported through the TRequestStatus
object.
The send can be cancelled using the RSendAsMessage::Cancel()
method.
Progress information can be obtained using RSendAsMessage::ProgressL()
.
This populates a progress information object TSendAsProgres
s.
The client can use this to display a progress bar.
Once the send request has completed, the client application must close
the RSendAsMessage
object to release server-side resources.
Save the message.
The message can also be saved to the message store (if one is provided by the MTM) without being sent using the following method:
IMPORT_C void SaveMessageAndCloseL();