×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Problem in creating IMAP account

    Hello,
    i wanted to create an IMAP account in code, using 3rd Ed MR (N91).

    I started from:
    http://wiki.forum.nokia.com/index.ph...counts_in_code

    and from the example found in SDK FP2:
    9.3/.../Examples/Messaging/Imap4Example

    I modified a simple hello world adding the class that performs the task.
    It crates a mailbox, that is listed under the Messaging application of N91; when I chose Options->Settings->E-mail, the new mailbox is set as the mailbox in use and is listed under Mailboxes.
    But when i try to edit the settings of the newly created mailbox, Messaging app dies...

    Could please helpmein understanding why? Maybe i'm missing something obvious?
    Here is the code i use:

    void CImapAccountManager::ConstructL()
    {
    iSession=CMsvSession::OpenSyncL(*this);
    CleanupStack::PushL(iSession);
    iSession->InstallMtmGroup(KDataComponentFileName);

    // Create a client-side MTM registry
    iClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32);
    if (iClientRegistry != NULL && iClientRegistry->IsPresent(KUidMsgTypeIMAP4))
    {
    CleanupStack::PushL(iClientRegistry);
    }
    // Create a Client-side MTM object for the specified MTM UID.
    iImap4Mtm = static_cast<CImap4ClientMtm*>(iClientRegistry->NewMtmL(KUidMsgTypeIMAP4));
    iSmtpMtm = static_cast<CSmtpClientMtm*>(iClientRegistry->NewMtmL(KUidMsgTypeSMTP));
    CleanupStack::Pop(2,iSession);
    }

    void CImapAccountManager::CreateAccountL(const TDesC& aAccountName,const TDesC& aImapServer,const TDesC8& aImapLogin,const TDesC8& aImapPassword,const TDesC& aSmtpServerAddress,const TDesC& aEmailAlias)
    {

    CEmailAccounts* emailAccounts = CEmailAccounts::NewL();
    CleanupStack::PushL(emailAccounts);

    // add an IAP to the email IAP preferences
    TImIAPChoice iap;
    iap.iIAP = 15; // to be changed when working
    iap.iDialogPref = ECommDbDialogPrefDoNotPrompt; // do not prompt user
    CImIAPPreferences* prefs = CImIAPPreferences::NewLC();
    prefs->AddIAPL(iap);

    // set IMAP settings
    // first populate with default settings
    CImImap4Settings *imap4Settings = new(ELeave)CImImap4Settings;
    CleanupStack::PushL(imap4Settings);
    emailAccounts->PopulateDefaultImapSettingsL(*imap4Settings, *prefs);
    // then overwrite specific settings
    imap4Settings->SetServerAddressL(aImapServer);
    imap4Settings->SetLoginNameL(aImapLogin);
    imap4Settings->SetPasswordL(aImapPassword);
    imap4Settings->SetPort(143);
    // create IMAP account
    iImapAccount = emailAccounts->CreateImapAccountL(aAccountName, *imap4Settings,*prefs,EFalse);

    // set SMTP settings
    CImSmtpSettings *smtpSettings = new (ELeave) CImSmtpSettings();
    CleanupStack::PushL(smtpSettings);
    // first populate with default settings
    emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings, *prefs);
    // then overwrite specific settings
    smtpSettings->SetServerAddressL(aSmtpServerAddress);
    smtpSettings->SetEmailAliasL(aEmailAlias);
    smtpSettings->SetEmailAddressL(KSmtpEmailAddress);
    smtpSettings->SetReplyToAddressL(KSmtpEmailAddress);
    smtpSettings->SetReceiptAddressL(KSmtpEmailAddress);
    smtpSettings->SetPort(25);

    // Create SMTP account
    iSmtpAccount= emailAccounts->CreateSmtpAccountL(iImapAccount, *smtpSettings, *prefs, EFalse);
    // set it as default
    emailAccounts->SetDefaultSmtpAccountL(iSmtpAccount);


    emailAccounts->GetSmtpAccountL(iSmtpAccount.iSmtpService, iSmtpAccount);
    emailAccounts->SaveSmtpSettingsL(iSmtpAccount,*smtpSettings);
    emailAccounts->SaveSmtpIapSettingsL(iSmtpAccount, *prefs);

    CleanupStack::PopAndDestroy(4,emailAccounts);
    }


    thank you in advance
    pg

  2. #2
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Problem in creating IMAP account - solved

    Hi,
    i solved.

    Messaging application requires some settings and prefs to be set, even if you call PopulateDefaultSmtpSettingsL.

    pg

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    2

    Re: Problem in creating IMAP account

    Hey can you share the info of how to fixed the issue ?

  4. #4
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Problem in creating IMAP account

    I 've just written a reply to the mail you sent me.
    Please mind that this solution is not working on all 3rd ed devices as reported in other posts on this forum. Using DM for creating the account isn't working well too on some devices....

    best regards
    pg

Similar Threads

  1. Creating SIS for N70 - Problem
    By EdenN70 in forum Symbian Tools & SDKs
    Replies: 14
    Last Post: 2008-05-05, 08:38
  2. Replies: 0
    Last Post: 2008-01-29, 12:53
  3. Problem in creating the sis using a dll file
    By amitnema in forum General Development Questions
    Replies: 3
    Last Post: 2007-12-28, 12:35
  4. Problem in build with S60 1FP
    By Manuelito_ in forum Symbian Tools & SDKs
    Replies: 14
    Last Post: 2007-09-18, 12:08
  5. Problem with video file while creating an mms message.
    By pehyun in forum General Messaging
    Replies: 0
    Last Post: 2004-03-14, 16:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •