This page was last modified 10:44, 8 February 2008.
TSS000814 - Sending an e-mail using CSendAs
From Forum Nokia Wiki
| ID | TSS000814 | Creation date | February 8, 2008 |
| Platform | S60 2nd Edition | Devices | |
| Category | Symbian C++ | Subcategory | Messaging |
Description
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 { ... public: // from MSendAsObserver TBool CapabilityOK(TUid aCapability, TInt aResponse); ... private: CSendAs* iSendAs; CRichText* iRichText; CParaFormatLayer* iParaLayer; CCharFormatLayer* iCharLayer; };
Sending an e-mail
The following code snippet can be used to send an e-mail using CSendAs:
iParaLayer=CParaFormatLayer::NewL(); iCharLayer=CCharFormatLayer::NewL(); //For creating the content of the mail iRichText=CRichText::NewL(iParaLayer,iCharLayer); //KBody is the content to be sent iRichText->InsertL(0,KBody); iSendAs->SetMtmL(KUidMsgTypeSMTP); //Create the mesage in outbox. iSendAs->CreateMessageL(KMsvGlobalOutBoxIndexEntryId); //Set the subject of the mail iSendAs->SetSubjectL(_L("First Email")); //Add the recipient of the mail //KRecipient is recievers mail address iSendAs->AddRecipientL(KRecepient); //Set the text of the message iSendAs->SetBodyL(*iRichText); //Save the message iSendAs->SaveMessageL(ETrue);
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.
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CSendUi: what capabilities? | borquist | Symbian Networking & Messaging | 4 | 2006-04-05 11:29 |
| Sending Emails | rriveroll | General Messaging | 1 | 2002-08-08 11:17 |
| Creating new mail mesg. using MTM in 9210 | Nokia_Archive | General Symbian C++ | 2 | 2007-09-20 11:24 |
| Problem send SMS in Nokia 7650 | SL57J | Smart Messaging | 0 | 2003-05-19 09:08 |
| Syncml, after replacement of vCard on Nokia not delete some information | super2006 | OMA DM/DS/CP | 4 | 2006-01-22 17:47 |

