Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <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.) CEmailAccounts::SetDefaultSmtpAccountL(const TSmtpAccount &), CEmailAccounts::DefaultSmtpAccountL(TSmtpAccount &) and CEmailAccounts::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:

Inherited from CBase:

Inherited from MMsvSessionObserver:

Related Topics


Construction and destruction


NewL()

IMPORT_C static 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()

IMPORT_C static 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()

IMPORT_C virtual ~CEmailAccounts();

Description

Destructor.

[Top]


Member functions


CreatePopAccountL(const TDesC &,const CImPop3Settings &,const CImIAPPreferences &,TBool)

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 TDesC16 &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(const TDesC &,const CImImap4Settings &,const CImIAPPreferences &,TBool)

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 TDesC16 &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(TPopAccount &,const CImSmtpSettings &,const CImIAPPreferences &,TBool)

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(TImapAccount &,const CImSmtpSettings &,const CImIAPPreferences &,TBool)

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(const TDesC &,const CImSmtpSettings &,const CImIAPPreferences &,TBool)

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 TDesC16 &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(RArray< TPopAccount > &)

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(TMsvId,TPopAccount &)

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(const TPopAccount &)

IMPORT_C void DeletePopAccountL(const TPopAccount &aAccount);

Description

Deletes the specified POP account.

Parameters

const TPopAccount &aAccount

POP account ID


GetImapAccountsL(RArray< TImapAccount > &)

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(TMsvId,TImapAccount &)

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(const TImapAccount &)

IMPORT_C void DeleteImapAccountL(const TImapAccount &aAccount);

Description

Deletes the specified IMAP account.

Parameters

const TImapAccount &aAccount

IMAP account ID


GetSmtpAccountsL(RArray< TSmtpAccount > &)

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(TMsvId,TSmtpAccount &)

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(const TSmtpAccount &)

IMPORT_C void DeleteSmtpAccountL(const TSmtpAccount &aAccount);

Description

Deletes the specified SMTP account.

Parameters

const TSmtpAccount &aAccount

SMTP account ID

Leave codes

KErrNotFound

Account specified is a SMTP mobility account


DeleteDefaultSmtpAccountL()

IMPORT_C void DeleteDefaultSmtpAccountL();

Description

Deletes the default SMTP account information from repository.


PopulateDefaultPopSettingsL(CImPop3Settings &,CImIAPPreferences &)

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(CImImap4Settings &,CImIAPPreferences &)

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(CImSmtpSettings &,CImIAPPreferences &)

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(TSmtpAccount &)

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(const TSmtpAccount &)

IMPORT_C void SetDefaultSmtpAccountL(const TSmtpAccount &aAccount);

Description

Sets the default smtp account.

Parameters

const TSmtpAccount &aAccount

Account ID to set as default


LoadPopSettingsL(const TPopAccount &,CImPop3Settings &)

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(const TPopAccount &,CImIAPPreferences &)

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(const TImapAccount &,CImImap4Settings &)

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(const TImapAccount &,CImIAPPreferences &)

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(const TSmtpAccount &,CImSmtpSettings &)

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

Leave codes

KErrNotFound

Account specified is a SMTP mobility account


LoadSmtpIapSettingsL(const TSmtpAccount &,CImIAPPreferences &)

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(const TPopAccount &,const CImPop3Settings &)

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(const TPopAccount &,const CImIAPPreferences &)

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(const TImapAccount &,const CImImap4Settings &)

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(const TImapAccount &,const CImIAPPreferences &)

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(const TSmtpAccount &,const CImSmtpSettings &)

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(const TSmtpAccount &,const CImIAPPreferences &)

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(const TPopAccount &)

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(const TImapAccount &)

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(const TSmtpAccount &)

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(TMsvSessionEvent,TAny *,TAny *,TAny *)

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

MMsvSessionObserver::TMsvSessionEvent

Indicates the event type.

TAny *

TAny *

TAny *