×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2004
    Location
    Novi Sad, Serbia & Montenegro
    Posts
    11

    Inserting body text into new email message

    Hi all,

    I've created a program that creates new SMS and sends it automatically, and now I'm trying to do similar with the email.

    I searched the forum and found a few very good examples, which led me to creating the email in the outbox, and setting the subject and recipient. However, when I try to set the text in the message body, nothing happens!

    I'll paste the code so maybe someone can figure out what I'm doing wrong

    Code:
        TMsvEntry msvEntry = iMtm->Entry().Entry();
        
        // set iRecipient into the Details of the entry
        //msvEntry.iDetails.Set(iRecipient->Des());  // set recipient info in details
        msvEntry.SetInPreparation(EFalse);         // set inPreparation to false
    
        msvEntry.SetSendingState(KMsvSendStateWaiting);   // set the sending state (immediately)
    	msvEntry.iDate.HomeTime();                        // set time to Home Time
    
    	CSmtpClientMtm* smtpMtm = STATIC_CAST(CSmtpClientMtm*, iMtm);
    
    	// We get the message body from Mtm and insert a bodytext
        CRichText& mtmBody = smtpMtm->Body();
        mtmBody.Reset();
        mtmBody.InsertL(0, textOfSMS);   // insert our msg tag as the body text
    
    	//CImSmtpSettings  is similar to CSmsSettings
    	//CImSmtpSettings emailSendSettings = smtpMtm->Settings();
    
    	
    	CImSmtpSettings* emailSendSettings = new (ELeave)CImSmtpSettings();
    	CleanupStack::PushL(emailSendSettings);
    	emailSendSettings->CopyL( smtpMtm->Settings() );
    
    emailSendSettings->SetSendMessageOption(ESendMessageImmediately);
    	// here I can use: ESendMessageImmediately, ESendMessageOnNextConnection, ESendMessageOnRequest
    
    	smtpMtm->SetSettingsL(*emailSendSettings);
    	
    	smtpMtm->AddAddresseeL(_L("someone@somewhere.com"));
    	smtpMtm->SetSubjectL(_L("New SMS!"));
    	smtpMtm->SaveMessageL();
    
    	// Next we mark our message so later on we know which
        // message to delete from the Sent folder
        msvEntry.iMtmData3 = KUidSMSScan.iUid;     // use our app uid as an identifier
    
        // save message
        CMsvEntry& entry = smtpMtm->Entry();
        entry.ChangeL(msvEntry);                // make sure that we are handling the right entry
    	smtpMtm->SaveMessageL();                 // closes the message
    
        // This moves the message entry to outbox, we'll schedule it for sending after this. 
        TMsvId movedId = MoveMessageEntryL( KMsvGlobalOutBoxIndexEntryId );  // move message to outbox
     
        // We must create an entry selection for message copies (although now we only have one message in selection)
        CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
        CleanupStack::PushL(selection);
    
        selection->AppendL(movedId);            // add our message to the selection
        SetScheduledSendingStateL(selection);   // schedule the sending with the active scheduler
    
        CleanupStack::PopAndDestroy(); // selection
    	CleanupStack::PopAndDestroy(); // emailSendSettings

  2. #2
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    153
    Hi mucky,

    Can you plz share the code which worked for you in creating and sending of a SMS automatically?

    Thanks in Advance,

    BR,

  3. #3
    Registered User
    Join Date
    Aug 2004
    Location
    Novi Sad, Serbia & Montenegro
    Posts
    11
    Hello,

    it turned out that the procedure for deleting the buffer containing the desired text was called when it wasn't supposed to, so THIS CODE WORKS IN FACT

  4. #4
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    153
    Hi,

    I'm working with SDK 2.0 and not able to find the required header files namely,smuthdr.h and smutset.h, for making use of the CSmsSettings and CSmsHeader classes.

    Help me in this regard,

    BR,

  5. #5
    Registered User
    Join Date
    Aug 2004
    Location
    Novi Sad, Serbia & Montenegro
    Posts
    11
    Hi,

    I've downloaded following version:

    Series 60 2nd Edition SDK for Symbian OS Supporting Feature Pack 2 For C++ Supporting Microsoft Visual C++ and Borland C++BuilderX

    and those headers are in my epoc32/include directory...

Posting Permissions

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