From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

huwell 在 16 Jan 2008 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 开发伙伴平台:

S60 3rd Edition

  • 详细描述

Symbian OS v9.1 提供了一个新的API,可以很方便的生成一个电子邮件帐户(POP3,IMAP4)。我们可以使用CEmailAccount API为收到的信息以及发出的信息(SMTP)生成一个账号,从而将两者糅合在一起工作。


#include <cemailaccounts.h>
TMsvId pop3Id;
TMsvId smtpId;
iPop3Mtm = static_cast<CPop3ClientMtm*>(iReg->NewMtmL(KUidMsgTypePOP3));
iSmtpMtm = static_cast<CSmtpClientMtm*>(iReg->NewMtmL(KUidMsgTypeSMTP));
CEmailAccounts* accounts = CEmailAccounts::NewLC();
// Create CImPop3Settings and CImSmtpSettings objects and insert your account settings.
// This step is omitted here for brevity.
// You also need to define a CImIAPPreferences object for the IAP to use with this account.
// This example does not show how to fill in the IAP UID into apUid. One possibility is to read this value from the
// CommsDB IAP table by a bearer.
TUint32 apUid;
// Create a new IAPChoice for the IAPPreferences object
TImIAPChoice apChoice;
apChoice.iIAP = apUid; //store IAP id
apChoice.iDialogPref = ECommDbDialogPrefPrompt; //prompt dialog
apPrefs = CImIAPPreferences::NewLC();
// Now create actual services
TPopAccount popAcc;
popAcc = accounts->CreatePopAccountL(_L("POP3 acco"), *iPOP3Settings, *apPrefs, EFalse);
TSmtpAccount smtpAcc;
smtpAcc = accounts->CreateSmtpAccountL(popAcc, *iSmtpSettings, *apPrefs, EFalse);
pop3Id = popAcc.iPopService;
smtpId = smtpAcc.iSmtpService;
// Finally, this line sets the new SMTP service as the default sending service.
This page was last modified on 15 December 2011, at 06:43.
88 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.