/** Gets the default SMTP service. @return The default service @leave KErrNotFound If default service setting does not exist. */ EXPORT_C TMsvId CSmtpClientMtm::DefaultServiceL() const { // Get default service Id from CenRep CEmailAccounts* account = CEmailAccounts::NewLC(); TSmtpAccount id; TInt error = account->DefaultSmtpAccountL(id); if (error == KErrNotFound) { User::Leave(error); } CleanupStack::PopAndDestroy(account); return id.iSmtpService; }
LOCAL_C void SetDefaultServiceL(TMsvId smtpService) { CEmailAccounts* accounts = CEmailAccounts::NewLC(); TSmtpAccount smtpAccount; accounts->GetSmtpAccountL(smtpService, smtpAccount); accounts->SetDefaultSmtpAccountL(smtpAccount); // is default service ?? TSmtpAccount defaultAccount; accounts->DefaultSmtpAccountL(defaultAccount); if (smtpService != defaultAccount.iSmtpService) { User::Leave(KErrNotFound); } CleanupStack::PopAndDestroy(accounts); }