Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: cemailaccounts.h
Link against: imcm.lib

Class CEmailAccounts

class CEmailAccounts : public CBase, public MMsvSessionObserver;

Description

Creates, loads, saves and deletes email (IMAP, POP, and SMTP) accounts.

An account encapsulates:

The class has a family of functions for each protocol to create, get, and delete accounts:

where <protocol> is either POP, IMAP, or SMTP. The Create and Get functions don't directly return settings objects, but only account identifiers.

Account identifiers are passed to the following functions to save and load the service and IAP settings for that account:

For SMTP only, there is a concept of a default account (as a client program may want to send an email, and not care which account is used.) SetDefaultSmtpAccountL(), DefaultSmtpAccountL() and DeleteDefaultSmtpAccountL() are used to handle this.

Note that an account is associated with a service entry in the message store, but account information itself is stored in the central repository.

Derivation

Members

Defined in CEmailAccounts:
CreateImapAccountL(), CreatePopAccountL(), CreateSmtpAccountL(), CreateSmtpAccountL(), CreateSmtpAccountL(), DefaultSmtpAccountL(), DeleteDefaultSmtpAccountL(), DeleteImapAccountL(), DeletePopAccountL(), DeleteSmtpAccountL(), GetImapAccountL(), GetImapAccountsL(), GetPopAccountL(), GetPopAccountsL(), GetSmtpAccountL(), GetSmtpAccountsL(), HandleSessionEventL(), IsAccountReadOnlyL(), IsAccountReadOnlyL(), IsAccountReadOnlyL(), LoadImapIapSettingsL(), LoadImapSettingsL(), LoadPopIapSettingsL(), LoadPopSettingsL(), LoadSmtpIapSettingsL(), LoadSmtpSettingsL(), NewL(), NewLC(), PopulateDefaultImapSettingsL(), PopulateDefaultPopSettingsL(), PopulateDefaultSmtpSettingsL(), SaveImapIapSettingsL(), SaveImapSettingsL(), SavePopIapSettingsL(), SavePopSettingsL(), SaveSmtpIapSettingsL(), SaveSmtpSettingsL(), SetDefaultSmtpAccountL(), ~CEmailAccounts()

Inherited from CBase:
Delete(), Extension_(), operator new()

Inherited from MMsvSessionObserver:
EMsvCloseSession, EMsvCorruptedIndexRebuilding, EMsvCorruptedIndexRebuilt, EMsvEntriesChanged, EMsvEntriesCreated, EMsvEntriesDeleted, EMsvEntriesMoved, EMsvGeneralError, EMsvMediaAvailable, EMsvMediaChanged, EMsvMediaIncorrect, EMsvMediaUnavailable, EMsvMtmGroupDeInstalled, EMsvMtmGroupInstalled, EMsvServerFailedToStart, EMsvServerReady, EMsvServerTerminated, TMsvSessionEvent

See also


Construction and destruction


NewL()

static IMPORT_C CEmailAccounts *NewL();

Description

Allocates and constructs an Email accounts object.

Initialises all member data to their default values.

Return value

CEmailAccounts *

The newly constructed Email accounts object.


NewLC()

static IMPORT_C CEmailAccounts *NewLC();

Description

Allocates and constructs an Email accounts object.

Initialises all member data to their default values.

Return value

CEmailAccounts *

The newly constructed Email accounts object.


~CEmailAccounts()

virtual IMPORT_C ~CEmailAccounts();

Description

Destructor.

[Top]


Member functions


CreatePopAccountL()

IMPORT_C TPopAccount CreatePopAccountL(const TDesC &aAccountName, const CImPop3Settings &aPopSettings, const CImIAPPreferences &aPopIAP, TBool aReadOnly);

Description

Creates a POP Account:

1. Creates a POP service entry in the message store

2. Creates settings in CenRep with values from the supplied objects

3. Returns a POP account ID

KErrOverflow if the account name is longer than 256 characters. KErrArgument if settings fields contained non-ascii printable characters.

Parameters

const TDesC &aAccountName

Account Name

const CImPop3Settings &aPopSettings

POP Service Settings

const CImIAPPreferences &aPopIAP

POP IAP preferences

TBool aReadOnly

Specify ETrue if it is a read-only account. Note: Read-only accounts should not be modified, however we don't enforce it.

Return value

TPopAccount

POP account ID of the new account

Leave codes


CreateImapAccountL()

IMPORT_C TImapAccount CreateImapAccountL(const TDesC &aAccountName, const CImImap4Settings &aImapSettings, const CImIAPPreferences &aImapIAP, TBool aReadOnly);

Description

Creates an IMAP Account:

1. Creates an IMAP service entry in the message store

2. Creates settings in CenRep with values from the supplied objects

3. Returns an IMAP account ID

KErrOverflow if the account name is longer than 256 characters. KErrArgument if settings fields contained non-ascii printable characters.

Parameters

const TDesC &aAccountName

Account Name

const CImImap4Settings &aImapSettings

IMAP Service Settings

const CImIAPPreferences &aImapIAP

IMAP IAP preferences

TBool aReadOnly

Specify ETrue if it is a read-only account Note: Read-only accounts should not be modified, however we don't enforce it.

Return value

TImapAccount

IMAP account ID

Leave codes


CreateSmtpAccountL()

IMPORT_C TSmtpAccount CreateSmtpAccountL(TPopAccount &aPopAccount, const CImSmtpSettings &aSmtpSettings, const CImIAPPreferences &aSmtpIAP, TBool aReadOnly);

Description

Creates a SMTP Account:

1. Creates a SMTP service entry in the message store

2. Creates settings in CenRep with values from the supplied objects

3. Relates this account with the supplied POP account

4. Returns a SMTP account ID

KErrArgument if settings fields contained non-ascii printable characters.

Parameters

TPopAccount &aPopAccount

POP Account Id

const CImSmtpSettings &aSmtpSettings

SMTP Service Settings

const CImIAPPreferences &aSmtpIAP

SMTP IAP preferences

TBool aReadOnly

Specify ETrue if it is a read-only account Note: Read-only accounts should not be modified, however we don't enforce it.

Return value

TSmtpAccount

SMTP account ID

Leave codes


CreateSmtpAccountL()

IMPORT_C TSmtpAccount CreateSmtpAccountL(TImapAccount &aImapAccount, const CImSmtpSettings &aSmtpSettings, const CImIAPPreferences &aSmtpIAP, TBool aReadOnly);

Description

Creates a SMTP Account:

1. Creates a SMTP service entry in the message store

2. Creates settings in CenRep with values from the supplied objects

3. Relates this account with the supplied IMAP account

4. Returns a SMTP account ID

KErrArgument if settings fields contained non-ascii printable characters.

Parameters

TImapAccount &aImapAccount

IMAP account ID

const CImSmtpSettings &aSmtpSettings

SMTP Service Settings

const CImIAPPreferences &aSmtpIAP

SMTP IAP preferences

TBool aReadOnly

Specify ETrue if it is a read-only account Note: Read-only accounts should not be modified, however we don't enforce it.

Return value

TSmtpAccount

SMTP account ID

Leave codes


CreateSmtpAccountL()

IMPORT_C TSmtpAccount CreateSmtpAccountL(const TDesC &aAccountName, const CImSmtpSettings &aSmtpSettings, const CImIAPPreferences &aSmtpIAP, TBool aReadOnly);

Description

Creates an SMTP Account:

1. Creates an SMTP service entry in the message store

2. Creates settings in CenRep with values from the supplied objects

3. Returns an SMTP account ID

KErrOverflow if the account name is longer than 256 characters. KErrArgument if settings fields contained non-ascii printable characters.

Parameters

const TDesC &aAccountName

Account Name

const CImSmtpSettings &aSmtpSettings

SMTP Service Setting

const CImIAPPreferences &aSmtpIAP

SMTP IAP preferences

TBool aReadOnly

Specify ETrue if it is a read-only account Note: Read-only accounts should not be modified, however we don't enforce it.

Return value

TSmtpAccount

SMTP account ID

Leave codes


GetPopAccountsL()

IMPORT_C void GetPopAccountsL(RArray< TPopAccount > &aAccounts);

Description

Gets a list of POP account IDs that exists in the current message store.

Parameters

RArray< TPopAccount > &aAccounts

On return, an array of POP account IDs


GetPopAccountL()

IMPORT_C void GetPopAccountL(TMsvId aServiceId, TPopAccount &aAccount);

Description

Gets a POP account ID for the specified service.

Parameters

TMsvId aServiceId

Service ID

TPopAccount &aAccount

POP account ID


DeletePopAccountL()

IMPORT_C void DeletePopAccountL(const TPopAccount &aAccount);

Description

Deletes the specified POP account.

Parameters

const TPopAccount &aAccount

POP account ID


GetImapAccountsL()

IMPORT_C void GetImapAccountsL(RArray< TImapAccount > &aAccounts);

Description

Gets a list of IMAP account IDs that exists in the current message store.

Parameters

RArray< TImapAccount > &aAccounts

On return, an array of IMAP account IDs


GetImapAccountL()

IMPORT_C void GetImapAccountL(TMsvId aServiceId, TImapAccount &aAccount);

Description

Gets a IMAP account ID for the specified service.

Parameters

TMsvId aServiceId

Service ID

TImapAccount &aAccount

IMAP account ID


DeleteImapAccountL()

IMPORT_C void DeleteImapAccountL(const TImapAccount &aAccount);

Description

Deletes the specified IMAP account.

Parameters

const TImapAccount &aAccount

IMAP account ID


GetSmtpAccountsL()

IMPORT_C void GetSmtpAccountsL(RArray< TSmtpAccount > &aAccounts);

Description

Gets a list of SMTP account IDs that exists in the current message store.

Parameters

RArray< TSmtpAccount > &aAccounts

On return, an array of SMTP account IDs


GetSmtpAccountL()

IMPORT_C void GetSmtpAccountL(TMsvId aServiceId, TSmtpAccount &aAccount);

Description

Gets a SMTP account ID for the specified service.

Parameters

TMsvId aServiceId

Service ID

TSmtpAccount &aAccount

SMTP account ID


DeleteSmtpAccountL()

IMPORT_C void DeleteSmtpAccountL(const TSmtpAccount &aAccount);

Description

Deletes the specified SMTP account.

Parameters

const TSmtpAccount &aAccount

SMTP account ID


DeleteDefaultSmtpAccountL()

IMPORT_C void DeleteDefaultSmtpAccountL();

Description

Deletes the default SMTP account information from repository.


PopulateDefaultPopSettingsL()

IMPORT_C void PopulateDefaultPopSettingsL(CImPop3Settings &aPopSettings, CImIAPPreferences &aPopIap);

Description

Populates the supplied setting objects with default values.

Parameters

CImPop3Settings &aPopSettings

POP Service Setting

CImIAPPreferences &aPopIap

POP IAP preferences


PopulateDefaultImapSettingsL()

IMPORT_C void PopulateDefaultImapSettingsL(CImImap4Settings &aImapSettings, CImIAPPreferences &aImapIap);

Description

Populates the supplied setting objects with default values.

Parameters

CImImap4Settings &aImapSettings

IMAP Service Setting

CImIAPPreferences &aImapIap

IMAP IAP preferences


PopulateDefaultSmtpSettingsL()

IMPORT_C void PopulateDefaultSmtpSettingsL(CImSmtpSettings &aSmtpSettings, CImIAPPreferences &aSmtpIap);

Description

Populates the supplied setting objects with default values.

Parameters

CImSmtpSettings &aSmtpSettings

SMTP Service Settings

CImIAPPreferences &aSmtpIap

SMTP IAP preferences


DefaultSmtpAccountL()

IMPORT_C TInt DefaultSmtpAccountL(TSmtpAccount &aAccount);

Description

Returns the default SMTP account.

Parameters

TSmtpAccount &aAccount

Default account ID

Return value

TInt

KErrNone if default account found, KErrNotFound if not found


SetDefaultSmtpAccountL()

IMPORT_C void SetDefaultSmtpAccountL(const TSmtpAccount &aAccount);

Description

Sets the default smtp account.

Parameters

const TSmtpAccount &aAccount

Account ID to set as default


LoadPopSettingsL()

IMPORT_C void LoadPopSettingsL(const TPopAccount &aAccount, CImPop3Settings &aPopSettings);

Description

Loads POP service settings for the specified account.

Parameters

const TPopAccount &aAccount

POP account ID

CImPop3Settings &aPopSettings

POP service settings


LoadPopIapSettingsL()

IMPORT_C void LoadPopIapSettingsL(const TPopAccount &aAccount, CImIAPPreferences &aIAP);

Description

Loads POP IAP settings for the specified account.

Parameters

const TPopAccount &aAccount

POP account ID

CImIAPPreferences &aIAP

POP IAP Pref settings


LoadImapSettingsL()

IMPORT_C void LoadImapSettingsL(const TImapAccount &aAccount, CImImap4Settings &aImapSettings);

Description

Loads IMAP service settings for the specified account.

Parameters

const TImapAccount &aAccount

IMAP account ID

CImImap4Settings &aImapSettings

IMAP service settings


LoadImapIapSettingsL()

IMPORT_C void LoadImapIapSettingsL(const TImapAccount &aAccount, CImIAPPreferences &aIAP);

Description

Loads IMAP IAP settings for the specified account.

Parameters

const TImapAccount &aAccount

IMAP account ID

CImIAPPreferences &aIAP

IMAP IAP Pref settings


LoadSmtpSettingsL()

IMPORT_C void LoadSmtpSettingsL(const TSmtpAccount &aAccount, CImSmtpSettings &aSmtpSettings);

Description

Loads SMTP service settings for the specified account.

Parameters

const TSmtpAccount &aAccount

SMTP account ID

CImSmtpSettings &aSmtpSettings

SMTP service settings


LoadSmtpIapSettingsL()

IMPORT_C void LoadSmtpIapSettingsL(const TSmtpAccount &aAccount, CImIAPPreferences &aIAP);

Description

Loads SMTP IAP settings for the specified account.

Parameters

const TSmtpAccount &aAccount

SMTP account ID

CImIAPPreferences &aIAP

SMTP IAP Pref settings


SavePopSettingsL()

IMPORT_C void SavePopSettingsL(const TPopAccount &aAccount, const CImPop3Settings &aPopSettings);

Description

Saves POP service settings for the specified account.

Parameters

const TPopAccount &aAccount

POP account ID, if the account name is zero-length, the account name is not updated

const CImPop3Settings &aPopSettings

POP service settings


SavePopIapSettingsL()

IMPORT_C void SavePopIapSettingsL(const TPopAccount &aAccount, const CImIAPPreferences &aIAP);

Description

Saves POP IAP settings for the specified account.

Parameters

const TPopAccount &aAccount

POP account ID, if the account name is zero-length, the account name is not updated

const CImIAPPreferences &aIAP

POP IAP Pref settings


SaveImapSettingsL()

IMPORT_C void SaveImapSettingsL(const TImapAccount &aAccount, const CImImap4Settings &aImapSettings);

Description

Saves IMAP service settings for the specified account.

Parameters

const TImapAccount &aAccount

IMAP account ID, if the account name is zero-length, the account name is not updated

const CImImap4Settings &aImapSettings

IMAP service settings


SaveImapIapSettingsL()

IMPORT_C void SaveImapIapSettingsL(const TImapAccount &aAccount, const CImIAPPreferences &aIAP);

Description

Saves IMAP IAP settings for the specified account.

Parameters

const TImapAccount &aAccount

IMAP account ID, if the account name is zero-length, the account name is not updated

const CImIAPPreferences &aIAP

IMAP IAP Pref settings


SaveSmtpSettingsL()

IMPORT_C void SaveSmtpSettingsL(const TSmtpAccount &aAccount, const CImSmtpSettings &aSmtpSettings);

Description

Saves SMTP service settings for the specified account.

Parameters

const TSmtpAccount &aAccount

SMTP account ID, if the account name is zero-length, the account name is not updated

const CImSmtpSettings &aSmtpSettings

SMTP service settings


SaveSmtpIapSettingsL()

IMPORT_C void SaveSmtpIapSettingsL(const TSmtpAccount &aAccount, const CImIAPPreferences &aIAP);

Description

Saves SMTP IAP settings for the specified account.

Parameters

const TSmtpAccount &aAccount

SMTP account ID, if the account name is zero-length, the account name is not updated

const CImIAPPreferences &aIAP

SMTP IAP Pref settings


IsAccountReadOnlyL()

IMPORT_C TBool IsAccountReadOnlyL(const TPopAccount &aAccount);

Description

Checks if the account is read-only

Parameters

const TPopAccount &aAccount

POP account Id

Return value

TBool

ETrue if it is a read-only account Note: Read-only accounts should not be modified, however we don't enforce it.


IsAccountReadOnlyL()

IMPORT_C TBool IsAccountReadOnlyL(const TImapAccount &aAccount);

Description

Checks if the account is read-only

Parameters

const TImapAccount &aAccount

IMAP account Id

Return value

TBool

ETrue if it is a read-only account Note: Read-only accounts should not be modified, however we don't enforce it.


IsAccountReadOnlyL()

IMPORT_C TBool IsAccountReadOnlyL(const TSmtpAccount &aAccount);

Description

Checks if the account is read-only

Parameters

const TSmtpAccount &aAccount

SMTP account Id

Return value

TBool

ETrue if it is a read-only account Note: Read-only accounts should not be modified, however we don't enforce it.


HandleSessionEventL()

private: virtual void HandleSessionEventL(TMsvSessionEvent, TAny *, TAny *, TAny *);

Description

Indicates an event has occurred.

The type of event is indicated by the value of aEvent. The interpretation of the TAny arguments depends on this type.

For most event types, the action that is taken, for example, updating the display, is client-specific. All clients though should respond to EMsvCloseSession and EMsvServerTerminated events.

Parameters

TMsvSessionEvent

Indicates the event type.

TAny *

TAny *

TAny *