Select from a List of Available MTMs and Accounts


  1. Get a list of MTMs available on the device that could send your message by specifying the features that the MTMs must have.

    Once a filter has been set, the available MTMs can be retrieved using the RSendAs::FilteredMessageTypes against which populates a CSendAsMessageTypes object.

    Creates a SendAs message
    @param aMessage An RSendAsMessage reference, used to create a message
    void CSendAs2Example::CreateL( RSendAsMessage& aMessage)
        CSendAsMessageTypes* messageTypes = CSendAsMessageTypes::NewL();
        // Filter all MTMs that can send messages. 
        // This list can be refined by applying filters using FilterAgainstCapability.
        TUid sendAsMtmUid;
        // Returning the message UID based on the message type 
        // such as 0 for SMTP Client, 1 for SMS Client
        // 2 for Infrared client MTM and 3 for Bluetooth client MTM.
        sendAsMtmUid = messageTypes->UidFromNameL(KSmsClient);
        iConsole->Printf ( KTextCreate );
        TInt count = iSelection->Count();
  2. Get a list of available accounts using RSendAs::AvailableAccountsL() hich populates a CSendAsAccounts object.

    The MTM for which to get the services is specified by the message type UID, which can be obtained from the CSendAsMessageTypes object.

    Once an account has been selected by the user, the ID of the service can be obtained to use it when creating a message.

    Displays the names of all the available accounts.
    Creates accounts, if not already created.
    void CSendAs2Example::DisplayAccountL()
        CSendAsAccounts* accounts = CSendAsAccounts::NewL();
        // Append 3 new accounts and associated name pair.
            accounts->AppendAccountL(KAccount1, 0xaaaaaaaa);    
            accounts->AppendAccountL(KAccount2, 0x55555555);    
            accounts->AppendAccountL(KAccount3, 0x22222222);    
        iConsole->Printf( KAccountNames );
        iConsole->Printf ( KPressAnyKey );
        iConsole->Getch ();
        // Display the array of names of accounts for this message type
        for(TInt I = 0; I < 3; I++)
            TPtrC array = accounts->AccountNames().MdcaPoint(I);
            iConsole->Printf( array ); 


Result of carrying out the task