Greetings,
the below code is a function from a "emailpop3" example application I found in SDK. I tried to get rid of the UI part and enter the e-mail address and the attachment names myself. It appears to be harder than I thought and it is even harder to debug it since I don't know where exactly it crashes and why.(the application just exits, or no message received on the server)
This is what I tried to do after the clientMtm->CreateMessage():
_LIT(myaddress, "somebody@mydomainname.com");
clientMtm->AddAddresseeL(myaddress);
it does not work. :-(
It does not even initialize the address inside the UI if I leave it.
How to send an e-mail with the given address and given attached file (image file from the cell phone, etc.)?
I don't know what to do. Please, help.
Alex
void CEpop3Engine::CreateEmailL()
{
// Set engine state to current activity
iEngineState = ECreating;
// Get a client registry for the current session
CClientMtmRegistry* mtmReg = CClientMtmRegistry::NewL( *iMsvSession );
CleanupStack::PushL( mtmReg );
// Get a new client MTM for the SMTP protocol from the registry
CSmtpClientMtm* clientMtm = (CSmtpClientMtm*)mtmReg->NewMtmL( KUidMsgTypeSMTP );
CleanupStack::PushL( clientMtm );
// Switch context to a draft entry - we are creating a new message
clientMtm->SwitchCurrentEntryL( KMsvDraftEntryId );
// Get the message server ID for a SMTP service
TMsvId service( FindServiceL( KUidMsgTypeSMTP ) );
// Create the new message
clientMtm->CreateMessageL( service );
// Get an UI MTM registry for the current session
CMtmUiRegistry* mtmUiReg = CMtmUiRegistry::NewL( *iMsvSession );
CleanupStack::PushL( mtmUiReg );
// Get a new UI MTM from the registry
CBaseMtmUi* mtmUi = mtmUiReg->NewMtmUiL( *clientMtm );
CleanupStack::PushL( mtmUi );
// Create a CMsvOperationWait object. This is used to
// run an asynchronous operation (EditL) synchronously.
CMsvOperationWait* wait = CMsvOperationWait::NewLC();
wait->iStatus = KRequestPending;
// Call the UI MTM EditL method to open the current
// message for editing
CMsvOperation* op = mtmUi->EditL( wait->iStatus );
wait->Start();
CleanupStack::PushL( op );
// Start the asynchronous operation, return when complete
CActiveScheduler::Start(); // returns when wait completes
CleanupStack::PopAndDestroy( 2 ); // op, wait
// The CMsvOperationWait section of the code ends here
CleanupStack::PopAndDestroy( 4 ); // mtmUi, mtmUiReg, clientMtm, mtmReg
// We are again in the EReady state
iEngineState = EReady;
}



