Symbian3/SDK/Source/GUID-BB35DBCC-FE56-547F-BADA-9EF854691ADC.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-BB35DBCC-FE56-547F-BADA-9EF854691ADC" xml:lang="en"><title>Pop3Example:
An Email manager using POP3 and SMTP</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-44678B4B-8A01-566A-B8D7-8C844F85D08E"><title>Description</title> <p>This
example application demonstrates how to create SMTP (Simple Mail Transfer
Protocol) and POP (Post Office Protocol) accounts to send and receive emails
respectively. The application creates dummy messages and sends them using
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
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>.
Using this registry it creates POP3 client-side MTM objects for the specified
UID. </p> <p>After creating the client MTM objects, the application creates
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.
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
send it to the email address stored in the literal <codeph>KTo</codeph>. </p> <p> <b>Note</b>:
Each email account created by the application has a pair of service entries,
which are used to store settings required for email transport. </p> <p>The
application also provides the <codeph>CMessAsyncWaiter</codeph> class to issue
asynchronous requests to the messaging server and handles completed requests.
This class implements the <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref> abstract interface. </p> </section>
<section id="GUID-8ABB4326-8878-5F1E-B134-52DEE44C1DD7"><title>Download</title> <p>Click
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>
<section id="GUID-CB59C794-B808-509A-858E-1084220D3AE6"><title>Pre-requisites</title> <p>A
null modem cable (NTRAS - New Technology Remote Access Services) must be connected
to your system for the example to be functional. Also, change the values of
literals <codeph>KSmtpServerAddress</codeph> and <codeph>KPopServer</codeph> defined
in the <filepath>Pop3Example.cpp</filepath> file to your system address. </p> <p>In
addition to the above mentioned changes, you must have an account with the
messaging server. You can create an account using any messaging proxy server
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>.
The name of the newly created account can either be the account name used
by the application or a different one. If you choose to name the new account
different from the account name used by the application, change the value
of the literal <codeph>KPopLoginName</codeph> defined in the <filepath>Pop3Example.cpp</filepath> file
to the new account name. </p> <p> <b>Note</b>: To check the messages sent
by the application, you must configure your email client to retrieve messages
for the newly created POP3 account. For information on how to configure your
email client, refer its user guide. </p> </section>
<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>
<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
how to build an application. </p> <p>The POP3 example builds an executable
called <filepath>Pop3Example.exe</filepath> in the standard location (<filepath>\epoc32\release\winscw\</filepath> <i>&lt;build_variant&gt;</i> for
CodeWarrior). After launching the executable, depending on the emulator you
are using, you may need to task away from the app launcher/shell screen to
view the console. </p> </section>
<section><title>See also</title> <p> <xref href="GUID-5B43ED43-21B4-54C6-8637-76554769E6FE.dita">POP3
MTM Overview</xref>  </p> <p> <xref href="GUID-4F703F85-080F-5B77-B94D-5449764828F3.dita">SMTP
MTM Overview</xref>  </p> </section>
</conbody></concept>