Archived:Sending an e-mail using CSendAs
The following code demonstrates how to send an e-mail programmatically using CSendAs.
MSendAsObserver is an observer that allows the client application to receive notifications about capability checks. The client application must implement this interface in order to receive notifications.
Derive the MSendAsObserver mixin class and implement the callback function CapabilityOK():
class CMyEmailEngine : public MSendAsObserver
// from MSendAsObserver
TBool CapabilityOK(TUid aCapability, TInt aResponse);
Sending an e-mail
The following code snippet can be used to send an e-mail using CSendAs:
//For creating the content of the mail
//KBody is the content to be sent
//Create the mesage in outbox.
//Set the subject of the mail
//Add the recipient of the mail
//KRecipient is recievers mail address
//Set the text of the message
//Save the message
Note that the e-mail is not sent immediately and remains in the outbox. The e-mail is sent by smtp MTM only when a new connection has been established with the remote server. The new connection can be established as follows:
1) Opening the messaging application and using the "Send" option (which you have used)
2) If the "automatic retrieval" option in mail settings is "ON", the connection is established according to the rules specified for the automatic retrieval of e-mails.