Pop3 Setting Run time error
| Wed, 2006-04-05 13:23 | |
|
Hi ,
 I'm trying to do some modifications in the (pop3_Imap4) example : http://nds2.fds-forum.nokia.com/fdp/interface?fid=A1A1YMYNVEEW&st=zfQ1gzdXJdludbab47dd445901b751f5f91a9813aa7577704be7ab94e08ad7cbb794ed00ea248823b1945f126ce2d5d07187407d60d7bc6fa7a9b4c7c8a7acf709f54975c7fa1335ecb1ec52b7e01d2c31cf7cd323afcc1b9e01a5aacb0956e9c6e61c0b4c12b3b53384093ce59f8a1f06c700d0450ea5eaa0a5e03ddbfb076b3e2d586ef74e0e09850c30315ad97938d41266061ffe0bbefce8bd0618866b37d1b8dfcddca182e79a12a68e5240&lid=FN. I have some run time error in method called (CreateNewAccount) which creates a new account for pop3 protocol on this line: TMsvId smtp = CreateServiceL(KUidMsgTypeSMTP, EFalse, EFalse, KServiceName); The syntax of run-time error Is : Unhandled exception at 0x4a74c51d in epoc.exe: 0xC0000005: Access violation reading location 0x00000030. Here Is a complete code for the important methods at the project: void CInternetEmailAppUi::CreateNewAccount(TAccountPairType aAccountPairType) { // Create SMTP account first iMsvEntry->SetEntryL(KMsvRootIndexEntryId); TMsvId smtp = CreateServiceL(KUidMsgTypeSMTP, EFalse, EFalse, KServiceName); //--->Here The Run time error iMsvEntry->SetEntryL(KMsvRootIndexEntryId); TMsvId account; if (aAccountPairType==ESmtpAndPop3) account = CreateServiceL(KUidMsgTypePOP3, EFalse, ETrue, KServiceName); else account = CreateServiceL(KUidMsgTypeIMAP4, EFalse, ETrue, KServiceName); CTestActive* active = new (ELeave) CTestActive; CleanupStack::PushL(active); TMsvEntry entry; iMsvEntry->SetEntryL(smtp); entry = iMsvEntry->Entry(); entry.iRelatedId=account; active->StartL(); CMsvOperation* opert = iMsvEntry->ChangeL(entry,active->iStatus); CActiveScheduler::Start(); // operation complete delete opert; opert=NULL; iMsvEntry->SetEntryL(account); entry = iMsvEntry->Entry(); entry.iRelatedId=smtp; active->StartL(); opert = iMsvEntry->ChangeL(entry,active->iStatus); CActiveScheduler::Start(); // operation complete delete opert; opert=NULL; CleanupStack::PopAndDestroy(); // active iMsvEntry->SetEntryL(smtp); CMsvStore* store = iMsvEntry->EditStoreL(); CleanupStack::PushL(store); CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings(); CleanupStack::PushL(smtpSettings); smtpSettings->Reset(); smtpSettings->SetServerAddressL(KSMTPServer); smtpSettings->SetEmailAliasL(KSMTPEmailAlias); smtpSettings->SetEmailAddressL(KSMTPEmailAddress); smtpSettings->SetReplyToAddressL(KSMTPEmailAddress); smtpSettings->SetBodyEncoding(EMsgOutboxMIME); smtpSettings->SetReceiptAddressL(KSMTPEmailAddress); smtpSettings->SetPort(25); smtpSettings->StoreL(*store); store->CommitL(); CleanupStack::PopAndDestroy(2); // smtpSettings, store iMsvEntry->SetEntryL(account); store = iMsvEntry->EditStoreL(); CleanupStack::PushL(store); if (aAccountPairType==ESmtpAndImap4) { CImImap4Settings* settings = new (ELeave) CImImap4Settings(); CleanupStack::PushL(settings); settings->Reset(); settings->SetServerAddressL(KIMAP4Server); settings->SetLoginNameL(KIMAP4LoginName); settings->SetPasswordL(KIMAP4Password); settings->SetPort(143); settings->StoreL(*store); } else { CImPop3Settings* settings = new (ELeave) CImPop3Settings(); CleanupStack::PushL(settings); settings->Reset(); settings->SetServerAddressL(KPOP3Server); settings->SetLoginNameL(KPOP3LoginName); settings->SetPasswordL(KPOP3Password); settings->SetPort(143); settings->StoreL(*store); } store->CommitL(); CleanupStack::PopAndDestroy(2); // settings, store } TMsvId CInternetEmailAppUi::CreateServiceL(const TUid aMtm, TBool aReadOnly, TBool aVisible, const TDesC& aName) { TMsvEntry entry; entry.iMtm = aMtm; entry.iType = KUidMsvServiceEntry; entry.SetReadOnly(aReadOnly); entry.SetVisible(aVisible); entry.iDetails.Set(aName); entry.iDescription.Set(aName); CTestActive* active = new (ELeave) CTestActive; CleanupStack::PushL(active); active->StartL(); CMsvOperation* opert = iMsvEntry->CreateL(entry, active->iStatus); CActiveScheduler::Start(); // operation complete delete opert; opert=NULL; CleanupStack::PopAndDestroy(); // active return iMsvEntry->EntryId(); } void CInternetEmailAppUi::HandleCommandL(TInt aCommand) { switch ( aCommand ) { case EAknSoftkeyBack: case EEikCmdExit: { Exit(); } break; case EInternetEmailCmdFetch: { // 1. first we initiate asynchornous mailcommand iModel->RemoteFetchL(); // 2. then we show modal wait dialog to user iWaitDialog = new (ELeave) CAknWaitDialog( reinterpret_cast<CEikDialog**> (&iWaitDialog)); iWaitDialog->SetCallback(this); iWaitDialog->ExecuteLD( R_WAIT_NOTE ); //resource based dialog } break; case EInternetEmailCmdSetPop: { if( !iModel->CheckIfExistsL( EProtocolPop3 ) ) { ShowNoteL(R_NO_POP3_DEFINED); //------->Here You Should Defines Your Pop3 Setting CreateNewAccount(ESmtpAndPop3); } else { iModel->SetProtocolL( EProtocolPop3 ); //iEmSetting=new (ELeave) CEMailSettings; ESmtpAndPop3 } } break; case EInternetEmailCmdSetImap: { if( !iModel->CheckIfExistsL( EProtocolImap4 ) ) { ShowNoteL(R_NO_IMAP4_DEFINED); } else { iModel->SetProtocolL( EProtocolImap4 ); } } break; default: break; } } #include <msventry.h> #include <msvids.h> #include <miutset.h> #include <msvapi.h> #include <imapset.h> #include <pop3set.h> #include <smtpset.h> _LIT(KServiceName, "Account Name"); _LIT(KSMTPServer, "smtp.somewhere.org"); _LIT(KSMTPEmailAddress, "myname@somewhere.org"); _LIT(KSMTPEmailAlias, "My Name"); _LIT(KIMAP4Server, "imap.somewhere.org"); _LIT8(KIMAP4LoginName, "someuser"); _LIT8(KIMAP4Password, "password"); _LIT(KPOP3Server, "pop3.somewhere.org"); _LIT8(KPOP3LoginName, "someuser"); _LIT8(KPOP3Password, "password"); |
|





