Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How to fetch the configured Email id

From Wiki
Jump to: navigation, search

This article explains how to fetch the configured Email id from the device , whether configured manually or through code.

Article Metadata
Tested with
Devices(s): N82, N97
Compatibility
Platform(s): S60 3rd Edition, FP1,FP2, S60 5th Edition
Platform Security
Signing Required: DevCert
Capabilities: ReadDeviceData
Article
Created: vineet.jain (31 Aug 2011)
Last edited: kiran10182 (21 Feb 2012)

Introduction

The Email id as configured by the user is required sometimes in the applications for e.g. which require to set the Email as pre-filled field in an editor or form etc.


Summary

Headers required:

#include "cemailaccounts.h"
#include "SMTPSET.H"

Link Against:

LIBRARY imcm.lib

Get the Count of SMTP accounts configured on device & fetch the default one or if there are more then one then pass the index

  CEmailAccounts* mailAccount = CEmailAccounts::NewLC(); 
RArray<TSmtpAccount> accountsSmtp(3);
TBuf8<60>iUserEmailId;
mailAccount->GetSmtpAccountsL(accountsSmtp);
TInt icountAccnt = accountsSmtp.Count();
if(icountAccnt>0)
{
iSmtpSettings = new(ELeave)CImSmtpSettings; // in class header : CImSmtpSettings*iSmtpSettings;
 
TSmtpAccount iSmtpAccount;
mailAccount->DefaultSmtpAccountL(iSmtpAccount);
 
or
 
const TSmtpAccount &iSmtpAccount= accountsSmtp.operator [](0); /// pass here the index
 
mailAccount->LoadSmtpSettingsL(iSmtpAccount,*iSmtpSettings);
iUserEmailId.Copy(iSmtpSettings->EmailAddress()); // iUserEmailId will contain the mail id as configured by the user
}
 
else
{
/// do your error handling here
}
This page was last modified on 21 February 2012, at 08:42.
44 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×