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. Thanks for all your past and future contributions.
How to fetch the configured Email id
This article explains how to fetch the configured Email id from the device , whether configured manually or through code.
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.
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();
TInt icountAccnt = accountsSmtp.Count();
iSmtpSettings = new(ELeave)CImSmtpSettings; // in class header : CImSmtpSettings*iSmtpSettings;
const TSmtpAccount &iSmtpAccount= accountsSmtp.operator (0); /// pass here the index
iUserEmailId.Copy(iSmtpSettings->EmailAddress()); // iUserEmailId will contain the mail id as configured by the user
/// do your error handling here