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

Reply With Quote


