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