|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-BB35DBCC-FE56-547F-BADA-9EF854691ADC" xml:lang="en"><title>Pop3Example: |
|
13 An Email manager using POP3 and SMTP</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-44678B4B-8A01-566A-B8D7-8C844F85D08E"><title>Description</title> <p>This |
|
15 example application demonstrates how to create SMTP (Simple Mail Transfer |
|
16 Protocol) and POP (Post Office Protocol) accounts to send and receive emails |
|
17 respectively. The application creates dummy messages and sends them using |
|
18 SMTP. </p> <p>The application opens a session with the messaging server using <xref href="GUID-2DA04D96-F0AD-3FDC-9E36-1C27D889AF4B.dita#GUID-2DA04D96-F0AD-3FDC-9E36-1C27D889AF4B/GUID-423E2320-FB34-3249-80D9-9AA62C9DDF60"><apiname>CMsvSession::OpenSyncL()</apiname></xref> and |
|
19 gets an instance of the client MTM (Message Type Module) registry using <xref href="GUID-A0682D04-9084-3DC3-AA18-5B81A78A1DA8.dita#GUID-A0682D04-9084-3DC3-AA18-5B81A78A1DA8/GUID-DBD7038B-A0E2-3791-A4C9-3A22FFCA146A"><apiname>CClientMtmRegistry::NewL()</apiname></xref>. |
|
20 Using this registry it creates POP3 client-side MTM objects for the specified |
|
21 UID. </p> <p>After creating the client MTM objects, the application creates |
|
22 POP3 and SMTP accounts using <xref href="GUID-A7EF08E6-82AF-3577-B942-ABD532EDB7FE.dita#GUID-A7EF08E6-82AF-3577-B942-ABD532EDB7FE/GUID-5740110F-F5FD-333B-9239-1FDF9EE2E42D"><apiname>CEmailAccounts::CreatePopAccountL()</apiname></xref> and <xref href="GUID-A7EF08E6-82AF-3577-B942-ABD532EDB7FE.dita#GUID-A7EF08E6-82AF-3577-B942-ABD532EDB7FE/GUID-89066942-2526-3B2E-B6DC-FCEF9EC2EFB6"><apiname>CEmailAccounts::CreateSmtpAccountL()</apiname></xref> respectively. |
|
23 Settings and preferences for these accounts are configured using the <xref href="GUID-6A7DFCF7-7268-3013-A5B6-5B77B6233329.dita"><apiname>CImPop3Settings</apiname></xref>, <xref href="GUID-9CAB9BE5-7233-3A01-A906-756177CF4460.dita"><apiname>CImIAPPreferences</apiname></xref> and <xref href="GUID-DFE18962-0022-3833-A8F0-6E4C969177C0.dita"><apiname>CImSmtpSettings</apiname></xref>. It creates an SMTP message using the method <xref href="GUID-3F7DC1AB-D13C-31E9-967B-526AD72CD498.dita#GUID-3F7DC1AB-D13C-31E9-967B-526AD72CD498/GUID-FCDC47D2-0446-3CD7-A246-4DCED7C8A063"><apiname>CImEmailOperation::CreateNewL()</apiname></xref> and |
|
24 send it to the email address stored in the literal <codeph>KTo</codeph>. </p> <p> <b>Note</b>: |
|
25 Each email account created by the application has a pair of service entries, |
|
26 which are used to store settings required for email transport. </p> <p>The |
|
27 application also provides the <codeph>CMessAsyncWaiter</codeph> class to issue |
|
28 asynchronous requests to the messaging server and handles completed requests. |
|
29 This class implements the <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref> abstract interface. </p> </section> |
|
30 <section id="GUID-8ABB4326-8878-5F1E-B134-52DEE44C1DD7"><title>Download</title> <p>Click |
|
31 on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-4a81a474-9ff8-4d73-8712-89ea4b8f7e36.zip" scope="external">Pop3Example.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-4a81a474-9ff8-4d73-8712-89ea4b8f7e36.html" scope="peer">browse</xref> to view the example code. </p> </section> |
|
32 <section id="GUID-CB59C794-B808-509A-858E-1084220D3AE6"><title>Pre-requisites</title> <p>A |
|
33 null modem cable (NTRAS - New Technology Remote Access Services) must be connected |
|
34 to your system for the example to be functional. Also, change the values of |
|
35 literals <codeph>KSmtpServerAddress</codeph> and <codeph>KPopServer</codeph> defined |
|
36 in the <filepath>Pop3Example.cpp</filepath> file to your system address. </p> <p>In |
|
37 addition to the above mentioned changes, you must have an account with the |
|
38 messaging server. You can create an account using any messaging proxy server |
|
39 application such as Communigate-Pro, which is freely downloadable from <xref href="http://www.stalker.com/CommuniGatePro/#Current" scope="external">http://www.stalker.com/CommuniGatePro/</xref>. |
|
40 The name of the newly created account can either be the account name used |
|
41 by the application or a different one. If you choose to name the new account |
|
42 different from the account name used by the application, change the value |
|
43 of the literal <codeph>KPopLoginName</codeph> defined in the <filepath>Pop3Example.cpp</filepath> file |
|
44 to the new account name. </p> <p> <b>Note</b>: To check the messages sent |
|
45 by the application, you must configure your email client to retrieve messages |
|
46 for the newly created POP3 account. For information on how to configure your |
|
47 email client, refer its user guide. </p> </section> |
|
48 <section><title>Class Summary</title><p><xref href="GUID-A7EF08E6-82AF-3577-B942-ABD532EDB7FE.dita"><apiname>CEmailAccounts</apiname></xref></p><p> <xref href="GUID-BDE23754-4536-3AF7-8549-3B953F51167C.dita"><apiname>MMsvSessionObserver</apiname></xref></p><p> <xref href="GUID-513528C7-4741-3494-9272-4E8F6CDBF20F.dita"><apiname>TMsvSessionEvent</apiname></xref></p><p> <xref href="GUID-A0682D04-9084-3DC3-AA18-5B81A78A1DA8.dita"><apiname>CClientMtmRegistry</apiname></xref></p><p> <xref href="GUID-2DA04D96-F0AD-3FDC-9E36-1C27D889AF4B.dita"><apiname>CMsvSession</apiname></xref></p><p> <xref href="GUID-177AF50B-14EF-3C45-AE22-1FEE5678261D.dita"><apiname>CBaseMtm</apiname></xref></p><p> <xref href="GUID-AF724192-6580-3DE3-9287-3A005C0AA932.dita"><apiname>CMsvOperation</apiname></xref></p><p> <xref href="GUID-A4B1F874-27C0-3BB6-9D29-C35C75A5DB98.dita"><apiname>TMsvId</apiname></xref></p><p> <xref href="GUID-B3E0E2AF-DB48-3D53-A8A6-E5A3D0F0D754.dita"><apiname>TPopAccount</apiname></xref></p><p> <xref href="GUID-C1545507-56B1-3533-9D7D-1F17F95AB6F8.dita"><apiname>TSmtpAccount</apiname></xref></p><p> <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref> </p></section> |
|
49 <section id="GUID-866D9B76-9D9A-5EED-8220-290ECA6F2607"><title>Build</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian OS build process</xref> describes |
|
50 how to build an application. </p> <p>The POP3 example builds an executable |
|
51 called <filepath>Pop3Example.exe</filepath> in the standard location (<filepath>\epoc32\release\winscw\</filepath> <i><build_variant></i> for |
|
52 CodeWarrior). After launching the executable, depending on the emulator you |
|
53 are using, you may need to task away from the app launcher/shell screen to |
|
54 view the console. </p> </section> |
|
55 <section><title>See also</title> <p> <xref href="GUID-5B43ED43-21B4-54C6-8637-76554769E6FE.dita">POP3 |
|
56 MTM Overview</xref> </p> <p> <xref href="GUID-4F703F85-080F-5B77-B94D-5449764828F3.dita">SMTP |
|
57 MTM Overview</xref> </p> </section> |
|
58 </conbody></concept> |