Location:
sendas.h
Link against: send.lib
CSendAs
Supported from 5.0
Encapsulates the Send-As functionality provided by the Messaging Architecture.
It allows applications simply to package data into outgoing messages without using directly the MTM interfaces.
The class is failure-safe in that if it gets deleted before the client application commits the message, the message is abandoned rather than saved in a potentially indeterminate state, which could later cause problems in the Message Server.
If the MTM requires the data to be rendered (i.e. printed), then,
when saving the message, the CSendAs
class calls back to the
application using the mixin observer, and give the UID of the printer driver to
use and the filename the printer should produce.
|
Defined in CSendAs
:
AbandonMessageL()
, AddMtmCapabilityL()
, AddRecipientL()
, AvailableMtms()
, AvailableServices()
, ClientMtm()
, ClientRegistry()
, CreateAttachmentL()
, CreateMessageL()
, DeleteAttachmentL()
, NewL()
, QueryMessageCapability()
, RecipientList()
, RemoveRecipient()
, ResetMtmCapabilitiesL()
, SaveMessageL()
, SetAttachmentL()
, SetBioTypeL()
, SetBodyL()
, SetMtmL()
, SetService()
, SetSubjectL()
, ValidateMessage()
, ~CSendAs()
Inherited from CActive
:
Cancel()
,
Deque()
,
DoCancel()
,
EPriorityHigh
,
EPriorityIdle
,
EPriorityLow
,
EPriorityStandard
,
EPriorityUserInput
,
IsActive()
,
IsAdded()
,
Priority()
,
RunError()
,
RunL()
,
SetActive()
,
SetPriority()
,
TPriority
,
iStatus
Inherited from CBase
:
operator new()
Inherited from MMsvSessionObserver
:
EMsvCloseSession
,
EMsvCorruptedIndexRebuilding
,
EMsvCorruptedIndexRebuilt
,
EMsvGeneralError
,
EMsvMediaAvailable
,
EMsvMediaChanged
,
EMsvMediaIncorrect
,
EMsvMediaUnavailable
,
EMsvMtmGroupDeInstalled
,
EMsvMtmGroupInstalled
,
EMsvServerFailedToStart
,
EMsvServerReady
,
EMsvServerTerminated
,
EMsvStoreCommitted
,
EMsvStoreCreated
,
EMsvStoreDeleted
,
EmsvEntriesChanged
,
EmsvEntriesDeleted
,
EmsvEntriesMoved
,
EmsvEntryCreated
,
HandleSessionEvent()
,
HandleSessionEventL()
,
TMsvSessionEvent
static CSendAs* NewL(MSendAsObserver& aObserver);
Allocates and constructs a Send-As object.
It returns a pointer to an instance of a CSendAs
object. The Send-As object creates a session against the Message Server and can
access the client-side MTM registry. The call returns immediately since any
initialisation occurs asynchronously.
|
|
const CDesCArray& AvailableMtms() const
Gets an array of MTMs that satisfy the current capability requirements.
The array could change after every call to
AddRequiredCapabilityL()
and ResetCapabilitiesL()
.
The array never contains MTMs that do not have the capability to send
messages.
|
void AddMtmCapabilityL(TUid aCapabilityId, TBool aResponseExpected=EFalse)
Adds a capability requirement.
All MTMs that do not have this capability are removed from the
current array of available MTMs, initialised by AvailableMtms()
.
This allows the client to filter out any unsuitable MTMs before presenting a
list to the user. A client can make repeated calls to
AvailableMtms()
to specify different criteria.
Some clients may wish to perform additional checking of a
capability response, which they can do by setting
aResponseExpected
to ETrue
. This causes the function
to call back the client’s MSendAsObserver::CapabilityOK()
function, which can evaluates the capability further. For example, if the
KUidMtmQueryMaxBodySize
capability (maximum message body size) is
specified, and aResponseExpected
is ETrue
, the
function calls back MSendAsObserver::CapabilityOK()
with the
maximum message body size. That function can then check if the maximum size is
large enough — returning ETrue
if it is.
AddMtmCapabilityL()
then checks this return value: if it is not
ETrue
, then the MTM is removed from the available MTM
array.
|
|
void ResetMtmCapabilitiesL();
Resets all capability requirements.
The MTM array then contains all the installed MTMs that can send messages.
|
void SetMtmL(TInt aMtmIndex);
Sets which MTM to use to create the message by referencing the available MTM array.
If the function leaves, then the MTM array is unchanged and a message cannot be created.
|
|
void SetMtmL(TUid aMtmUid);
Sets which MTM to use to create the message by specifying a known MTM UID.
If the function leaves, then the MTM array is unchanged and a message cannot be created.
|
|
const CDesCArray& AvailableServices() const;
Gets a list of the available services.
It panics if an MTM has not been set.
|
void SetService(TInt aServiceIndex);
Sets the service to use for the message.
The function panics if the index is out of range or an MTM has not been set.
|
void CreateMessageL();
Creates a new message.
The message is created by default in the Draft folder.
An MTM must have been set before calling this function. It panics if an MTM has not been set or a message has already been created.
If the function leaves, then the internal state of the
CSendAs
instance is unchanged.
|
void CreateMessageL(TMsvId aId);
Creates a new message, specifying the location in which to store it.
An MTM must have been set before calling this function. It panics if an MTM has not been set or a message has already been created.
If the function leaves, then the internal state of the
CSendAs
instance is unchanged.
|
|
void AbandonMessageL();
Deletes a message in progress and any attachments from the Message Server.
If an MTM object has been selected, then it the selection is cancelled. It panics if the message has already been saved.
|
void SaveMessageL(TBool aMakeVisible=ETrue);
void SaveMessageL(TRequestStatus& aStatus, TBool aMakeVisible=ETrue);
Commits the current message to the Message Server.
When the CSendAs
object is deleted by the client
application, it issues an AbandonMessage()
call on itself —
so to ensure that a message is sent, a client application must invoke this
function before closing the Send-As API. It panics if no message has been
created.
When the message requires rendering (e.g. fax), some applications might use the asynchronous version.
|
|
const CDesCArray& RecipientList() const;
Gets a list of recipients after they have been added to the message.
It panics if no message has been created.
|
void AddRecipientL(const TDesC& aRealAddress);
Adds a recipient to the message.
|
|
TInt AddRecipientL(const TDesC& aRealAddress, const TDesC& aAlias);
Adds a recipient to the message.
Both the true address and the name or alias are specified (e.g., “an-other@somewhere.co.uk” and “A.N. Other”).
|
|
void RemoveRecipient(TInt aIndex);
Removes a recipient from the message.
It panics if no message has been created.
|
void SetSubjectL(const TDesC& aSubject);
Sets the subject of the current message.
It panics if no message has been created.
|
|
void SetBodyL(const CRichText& aMessageBody);
Sets the body of the new message.
The outgoing message may legally be left with an empty body if
the client application cannot provide the contents of its document as a
CRichText
object. Alternatively, the client application may wish
to define a default message body, and create an attachment for the document
being sent. It panics if no message has been created.
|
|
TMsvPartList ValidateMessage();
Checks that the message is correctly formatted for the chosen message type.
In particular, the client application is able to determine whether the recipient list is valid within the addressing syntax of the message type. Any defective part or parts are identified by the return value.
The call panics if no message has been created.
|
TInt QueryMessageCapability(TUid aCapabilityId, TBool aResponseExpected=EFalse);
Tests if the chosen MTM message supports a capability.
If aResponseExpected
is ETrue
, then
the function call backs the client’s
MSendAsObserver::CapabilityOK()
that can evaluate the capability
further.
|
|
void CreateAttachmentL(TMsvId& aAttachmentId, TFileName& aDirectory);
Creates an entry for an attachment in the Message Server index.
Once an entry has been created, the client application can save the attachment file in the directory whose name is returned. It panics if no message has been created.
|
|
void DeleteAttachmentL(TMsvId aAttachmentId);
Deletes an attachment from the message.
The attachment directory and any files in it are also deleted. It panics if no message has been created.
|
|
void SetAttachmentL(TMsvId aAttachmentId, const TDesC& aAttachmentName);
Supported from 5.1
Makes an attachment added by CreateAttachmentL()
visible in the user interface of an e-mail application. By default, attachments
are not be shown.
The function can be called before or after
SaveMessageL()
, but will be more efficient if called
before.
|
CClientMtmRegistry& ClientRegistry();
Gets direct access to Messaging’s client registry.
|
CBaseMTM& ClientMtm();
Gets direct access to the class providing protocol-specific messaging functionality (a client MTM).
|
void SetBioTypeL(TUid aBioTypeUid);
Supported from 6.0
Sets the BIO type for the message.
|