×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2008
    Location
    Italy
    Posts
    7

    CSmtpClientMtm + AddAttachmentL() NO WAY OUT

    Here I send an email with attachment on 2nd with no problem.
    But on 3rd I must use a different call: AddAttachmentL()
    The rest of the engine code is the same .
    On 3rd it works well only with the first mail.
    Than, memory leak I think...
    This is my (confused) code:

    Code:
    void CMailEngine::CreateDraftMailL(const TDesC& aAddress, const TDesC& aSubject,
                                       const TDesC& aBody, const TDesC& aAttach )
    {
      /*-------protezione engine fermo---------------------------------*/
      if( !iReady )
          PopError(_L("MailServer not ready")) ;
      ResetNewMtmL() ; 
      /*-------MI TROVA IL SERVIZIO SMTP DELLA PRIMA MAILBOX-----------*/
      //iServiceId= FindServiceByTypeL( KUidMsgTypeSMTP ); // COSTANTE
      /*-------CONTESTO CREAZIONE MSG SU GRUPPO OUTBOX-----------------*/
      /*-------interfaccia mtm creata prima di tipo smtp---------------*/
      iMailMtm->SwitchCurrentEntryL( KMsvGlobalOutBoxIndexEntryId );
      //iMailMtm->SwitchCurrentEntryL( KMsvDraftEntryId ); // BOZZE
      /*-------creo email IN USCITA in outbox-------Security-3rd-------*/
      iMailMtm->CreateMessageL( iServiceId );
      DebugMail("creato scheletro");
      /*------------carico trasmissione immediata---solo x smtp--------*/
      CImSmtpSettings* set= new (ELeave)CImSmtpSettings();
      CleanupStack::PushL( set );
      set->CopyL( iMailMtm->Settings() );
      set->SetSendMessageOption(ESendMessageImmediately); // solo per alzare questo flag
      /*------------questo la incasina e non la emette?----------------*/
      iMailMtm->SetSettingsL( *set );
      CleanupStack::PopAndDestroy( set );
      /*------------carico messaggio------.it obbligatorio-------------*/
      iMailMtm->AddAddresseeL(aAddress);   // _L("xxxxxx.nokia@email.it")
      iMailMtm->SetSubjectL(aSubject);     // _L("Storico Registrazioni")
      iMailMtm->Body().InsertL(0, aBody);  // _L("File del 04/10/2007")
      /*------------prova uscita prematura-----------------------------*/
      //iMailMtm->SaveMessageL();            // se esco qui tutto ok
      //return ;                             // no crash emulatore 3rd
      /*------------ATTENZIONE--INCOMPATIBILITA--PORTING---------------*/
    #ifndef EKA2
      /*------------VERSIONE 2ND---------------------------------------*/
      TParse Dest;
      TFileName aDirectory(aAttach) ;     // inizializzarlo cosi'! - problemi linker!
      TMsvId aAttachmentId ;              // verra' caricato
      iMailMtm->CreateAttachmentL( aAttachmentId, aDirectory ); // torna dove copiare file 2nd
      Dest.Set( aDirectory, &aAttach, NULL );
      EikFileUtils::CopyFile( aAttach, Dest.FullName() );
      DebugMailS( aAttach ) ;
    #else  
      /*------------VERSIONE 3RD---------------------------------------*/
      iAttached.Copy( aAttach ) ;   // pubblico piu' sicuro
      CMsvOperationActiveSchedulerWait* waiter= CMsvOperationActiveSchedulerWait::NewLC();
      DebugMail("attacchero':");
      DebugMailS( iAttached ) ;
      /*------------SIMILI---ADDATTACHMENTL---PIU'--USATO--------------*/
      iMailMtm->AddLinkedAttachmentL( iAttached, _L8(""),0, waiter->iStatus); // _L8("text")
      //iMailMtm->AddAttachmentL( iAttached, _L8(""),0, waiter->iStatus); // _L8("text")
      //DebugMail("sto per partire");
      waiter->Start();
      /*------------lancio e distruggo evento sospensvo----------------*/
      DebugMail("attaccato file");
      CleanupStack::PopAndDestroy(waiter);
    #endif
      /*------------salvo tutto-----COMPARE-IN-BOX-USCITA-(IN CODA)----*/
      /*------------sposto save piu' avanti vedi dopo------------------*/
      //iMailMtm->SaveMessageL();     // posso inviarlo manualmente....
      /*------------esempi cartelle di lavoro emissione email--2nd-----*/
      //   DebugMailS( aDirectory ) ;
      //   C:\System\Mail\00001001_S\b\0010029b_F\
      //   C:\System\Mail\00001001_S\f\0010029f_F\
    }
    
    
    /*--------------------------Invio Immediato---------------------------------------------*/
    /*-------CON CHIAMATE ACCAVALLATE L'ULTIMA MAIL RIMANE IN CODA--------------------------*/
    void CMailEngine::SendMailL()
    {
      /*---------Set context to the Mail message---(SMTP)----------------------*/
      //iMailMtm->SwitchCurrentEntryL( iServiceId ); // COLPEVOLE CRASH SE CON ALLEGATO (?)
      /*---------precedente passo inutile e sbagliato--------------------------*/
      /*----SISTEMO NODO DESCRIZIONE GENERALE DELL'MTM CORRENTE---(ENTRY)------*/
      TMsvEntry indexEntry= iMailMtm->Entry().Entry();
      indexEntry.SetInPreparation(EFalse);           // DICO CHE E' PRONTO
      /*---------questo mi mostra la casella @ in uscita su 6600, strano-------*/
      indexEntry.SetReadOnly(EFalse);                    // da manuale
      indexEntry.SetScheduled(ETrue);                    // non fa male
      indexEntry.SetSendingState(KMsvSendStateWaiting);  // non fa male
      indexEntry.iMtmData3= KBTermUid;             // marco x cancellarlo dopo
      indexEntry.SetVisible(ETrue);                      // rimesso
      iMailMtm->Entry().ChangeL(indexEntry);       // rinfresca flags del nodo
      /*---------due save mi duplica il recipient, due addresse uguali----??---*/
      /*---------sposto il save qui in fondo come da user guide----------------*/
      iMailMtm->SaveMessageL();                    // nel dubbio risalvo tutto
      /*---------EVENTUALE RESET PREDISPONGO PARAMETRI-------------------------*/
      /*---------il primo entry deve essere il servizio-----------smtpcmds.h---*/
      /*---------nel caso smtp non ci devono essere altre entry----------------*/
      Cancel();                                    // preparo iOp for use
      iEntrySelection->Reset();                    // preparo parametro
      iEntrySelection->AppendL( iServiceId );      // puntatore al servizio ORIG
      //iEntrySelection->AppendL(indexEntry.Id()); // puntatore al nodo msg NO!
      //TBuf8<1> dummyParams;                      // sposta in classe, e' temp
      /*--------KPOP3MTMConnectAndMoveAllMailAndDisconnect=NonSupportato-------*/
      /*--------KPOP3MTMConnectAndMoveMailSelectionAndDisconnect=NonSuppor-----*/
      /*--------KSMTPMTMSendOnNextConnection=FUNZIONA!INVIO!SUBITO!------------*/
      iOp= iMailMtm->InvokeAsyncFunctionL(KSMTPMTMSendOnNextConnection,
                                          *iEntrySelection, dummyParams, iStatus);
      /*--------run callback on al completamento trasmissione------------------*/
      DebugMail("lancio invio");
      SetActive();
    }

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: CSmtpClientMtm + AddAttachmentL() NO WAY OUT

    You could use Hooklogger to track the source of the leak try searching hooklogger in the forum nokia search tab.
    Regards,
    Sriky

  3. #3
    Registered User
    Join Date
    Apr 2008
    Location
    Italy
    Posts
    7

    Re: CSmtpClientMtm + AddAttachmentL() NO WAY OUT

    Quote Originally Posted by sriky27 View Post
    You could use Hooklogger to track the source of the leak try searching hooklogger in the forum nokia search tab.
    Thank you, I will try to better debug, but I would need to know if this is the correct way to attach with AddLinkedAttachmentL.
    I can't find a working attach example over the web.
    Do exist a better way to create an email and attach a file to it ??
    Spent dozens of hours over this matter...

  4. #4
    Registered User
    Join Date
    Apr 2008
    Location
    Italy
    Posts
    7

    Re: CSmtpClientMtm + AddAttachmentL() NO WAY OUT

    anybody can help me about attachments on 3rd ?

Similar Threads

  1. E-Mail (CSmtpClientMtm) CreateMeesageL Problem
    By shebin in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-10-18, 10:55
  2. send email with attachment by CSmtpClientMtm
    By sam_jason in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-05-14, 10:05
  3. CSmtpClientMtm
    By nkraghunandan in forum Symbian
    Replies: 3
    Last Post: 2003-12-12, 09:47

Posting Permissions

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