Overriding the SMTP Mobility Account Settings

This tutorial explains how to override an SMTP mobility account setting for per-bearer-type.

Introduction

The TSmtpMobilityAccount and CImSmtpMobilitySettings class are used to override the SMTP mobility account settings. The TSmtpMobilityAccount class encapsulates the name of the mobility account, and associates with a parent SMTP account; that is, the SMTP account that is to be overridden. This is associated with an array of IAPs for which this mobility account should be used. Finally, the settings for the mobility account are stored, and are recoverable as a CImSmtpMobilitySettings class.

Procedure

You can override an SMTP mobility account setting for per-bearer-type in the following ways:

Method 1

Creating an SMTP mobility account with settings to be used for specified IAPs, and associate this with an existing SMTP account. To do this, complete the following steps:

  1. Create an instance of theCEmailAccounts class.

  2. Use the CEmailAccounts::GetSmtpAccountL() function, to get the ID of the SMTP account for the mobility account used.

  3. Create an instance of the CImSmtpMobilitySettings class, and populate according appropriately for the remote server settings.

  4. Use the CEmailAccounts::PopulateDefaultSmtpMobilitySettingsL() function to populate the remote server settings, for example, server name, login, port, email address, password, SMTP authentication, and so on.

  5. Create an instance of the RArrayIAP class, and populate it with bearer access point IDs for the mobility account shall be used.

  6. Create a mobility account in the central repository using the following function:

    CEmailAccounts::(const TDesC&, const RArrayIAP&, const TSmtpAccount&, const CImSmtpMobilitySettings&, TBool)

Method 2

Creating an SMTP mobility account with settings linked to an existing SMTP account (account A) to be used for specified IAPs, and associate this with an SMTP account (account B). To do this, complete the following steps:

  1. Create an instance of the CEmailAccounts class.

  2. Using the CEmailAccounts::GetSmtpAccountL() function, obtain the ID of the SMTP account to which the SMTP mobility account’s settings are to be linked (account A).

  3. Use the CEmailAccounts::GetSmtpAccountL() function, to get the ID of the SMTP account for which the SMTP mobility account overrides the default account settings for specified IAPs (account B).

  4. Create an instance of the RArrayIAP class, and populate with bearer access point IDs for the mobility account.

  5. Create the mobility account in the central repository using the following function:

    CEmailAccounts::CreateSmtpMobilityAccountL(const TDesC&, const RArrayIAP&, const TSmtpAccount&, const TSmtpAccount& aLinkedSmtpAccount, TBool)