Added smoketest for email
authorMaciej Seroka <maciejs@symbian.org>
Fri, 30 Oct 2009 09:36:23 +0000
changeset 719 d5603c08781b
parent 718 b18be44be852
child 720 44dd64cfb32b
Added smoketest for email
common/tools/ats/smoketest/Group/bld.inf
common/tools/ats/smoketest/Group/smoketest.pl
common/tools/ats/smoketest/Group/smoketest.xml
common/tools/ats/smoketest/email/email/group/MachineName.txt
common/tools/ats/smoketest/email/email/group/bld.inf
common/tools/ats/smoketest/email/email/group/machinename.pl
common/tools/ats/smoketest/email/email/pop/group/T_PopServer.mmp
common/tools/ats/smoketest/email/email/pop/group/bld.inf
common/tools/ats/smoketest/email/email/pop/inc/CExpMailInfo.h
common/tools/ats/smoketest/email/email/pop/inc/CExpMailInfo.inl
common/tools/ats/smoketest/email/email/pop/inc/T_CheckChildrenCountPop.h
common/tools/ats/smoketest/email/email/pop/inc/T_CheckPop3AccessPoint.h
common/tools/ats/smoketest/email/email/pop/inc/T_CheckPopBMSetting.h
common/tools/ats/smoketest/email/email/pop/inc/T_CheckPopSNAPSetting.h
common/tools/ats/smoketest/email/email/pop/inc/T_ComparePopEmailMsgs.h
common/tools/ats/smoketest/email/email/pop/inc/T_ComparePopSettings.h
common/tools/ats/smoketest/email/email/pop/inc/T_ConnectPop3Server.h
common/tools/ats/smoketest/email/email/pop/inc/T_CopyPopSelection.h
common/tools/ats/smoketest/email/email/pop/inc/T_CreatePopAccount.h
common/tools/ats/smoketest/email/email/pop/inc/T_CreatePopAccountWithoutSmtp.h
common/tools/ats/smoketest/email/email/pop/inc/T_DeleteAllPopChildren.h
common/tools/ats/smoketest/email/email/pop/inc/T_DeletePopAccount.h
common/tools/ats/smoketest/email/email/pop/inc/T_DisConnectPop3Server.h
common/tools/ats/smoketest/email/email/pop/inc/T_ModifyPopSettings.h
common/tools/ats/smoketest/email/email/pop/inc/T_ModifyPopSettings2.h
common/tools/ats/smoketest/email/email/pop/inc/T_MsgAsyncStepPOP.h
common/tools/ats/smoketest/email/email/pop/inc/T_MsgSharedDataPop.h
common/tools/ats/smoketest/email/email/pop/inc/T_MsgSyncStepPop.h
common/tools/ats/smoketest/email/email/pop/inc/T_PopInvokeAsyncFunction.h
common/tools/ats/smoketest/email/email/pop/inc/T_PopServer.h
common/tools/ats/smoketest/email/email/pop/inc/T_RemovePopSNAPSetting.h
common/tools/ats/smoketest/email/email/pop/inc/T_SharedDataPop.h
common/tools/ats/smoketest/email/email/pop/inc/T_StartRamUsageTimer.h
common/tools/ats/smoketest/email/email/pop/inc/T_StopRamUsageTimer.h
common/tools/ats/smoketest/email/email/pop/inc/T_VerfiyPopSettings.h
common/tools/ats/smoketest/email/email/pop/inc/T_VerifyPopAccountsCount.h
common/tools/ats/smoketest/email/email/pop/scripts/plainbody/setup_smoketest_email.script
common/tools/ats/smoketest/email/email/pop/scripts/plainbody/smoketest_email.script
common/tools/ats/smoketest/email/email/pop/src/T_CheckChildrenCountPop.cpp
common/tools/ats/smoketest/email/email/pop/src/T_CheckPop3AccessPoint.cpp
common/tools/ats/smoketest/email/email/pop/src/T_CheckPopBMSetting.cpp
common/tools/ats/smoketest/email/email/pop/src/T_CheckPopSNAPSetting.cpp
common/tools/ats/smoketest/email/email/pop/src/T_ComparePopEmailMsgs.cpp
common/tools/ats/smoketest/email/email/pop/src/T_ComparePopSettings.cpp
common/tools/ats/smoketest/email/email/pop/src/T_ConnectPop3Server.cpp
common/tools/ats/smoketest/email/email/pop/src/T_CopyPopSelection.cpp
common/tools/ats/smoketest/email/email/pop/src/T_CreatePopAccount.cpp
common/tools/ats/smoketest/email/email/pop/src/T_CreatePopAccountWithoutSmtp.cpp
common/tools/ats/smoketest/email/email/pop/src/T_DeleteAllPopChildren.cpp
common/tools/ats/smoketest/email/email/pop/src/T_DeletePopAccount.cpp
common/tools/ats/smoketest/email/email/pop/src/T_DisconnectPop3Server.cpp
common/tools/ats/smoketest/email/email/pop/src/T_ModifyPopSettings.cpp
common/tools/ats/smoketest/email/email/pop/src/T_ModifyPopSettings2.cpp
common/tools/ats/smoketest/email/email/pop/src/T_MsgAsyncStepPOP.cpp
common/tools/ats/smoketest/email/email/pop/src/T_MsgSharedDataPop.cpp
common/tools/ats/smoketest/email/email/pop/src/T_MsgSyncStepPOP.cpp
common/tools/ats/smoketest/email/email/pop/src/T_PopInvokeAsyncFunction.cpp
common/tools/ats/smoketest/email/email/pop/src/T_PopServer.cpp
common/tools/ats/smoketest/email/email/pop/src/T_RemovePopSNAPSetting.cpp
common/tools/ats/smoketest/email/email/pop/src/T_SharedDataPop.cpp
common/tools/ats/smoketest/email/email/pop/src/T_StartRamUsageTimer.cpp
common/tools/ats/smoketest/email/email/pop/src/T_StopRamUsageTimer.cpp
common/tools/ats/smoketest/email/email/pop/src/T_VerifyPopAccountsCount.cpp
common/tools/ats/smoketest/email/email/pop/src/T_VerifyPopSettings.cpp
common/tools/ats/smoketest/email/email/pop/testdata/EmailMessage/20KBody.txt
common/tools/ats/smoketest/email/email/pop/testdata/EmailSettings/POPSettings_test908.txt
common/tools/ats/smoketest/email/email/pop/testdata/plainbody/smoketest_email.ini
common/tools/ats/smoketest/email/email/smtp/group/T_SmtpServer.mmp
common/tools/ats/smoketest/email/email/smtp/group/bld.inf
common/tools/ats/smoketest/email/email/smtp/inc/ImCltCvRecv.h
common/tools/ats/smoketest/email/email/smtp/inc/ImCltCvRecv.inl
common/tools/ats/smoketest/email/email/smtp/inc/Local_imcvrecv.h
common/tools/ats/smoketest/email/email/smtp/inc/T_CheckSmtpBMSetting.h
common/tools/ats/smoketest/email/email/smtp/inc/T_CheckSmtpSNAPSetting.h
common/tools/ats/smoketest/email/email/smtp/inc/T_CreateSmtpAccount.h
common/tools/ats/smoketest/email/email/smtp/inc/T_CreateSmtpMessageFromEmailFile.h
common/tools/ats/smoketest/email/email/smtp/inc/T_CreateSmtpMobilityAccount.h
common/tools/ats/smoketest/email/email/smtp/inc/T_ModifySmtpSettings.h
common/tools/ats/smoketest/email/email/smtp/inc/T_MsgAsyncStepSMTP.h
common/tools/ats/smoketest/email/email/smtp/inc/T_MsgSharedDataSmtp.h
common/tools/ats/smoketest/email/email/smtp/inc/T_MsgSyncStepSMTP.h
common/tools/ats/smoketest/email/email/smtp/inc/T_RemoveSmtpSNAPSetting.h
common/tools/ats/smoketest/email/email/smtp/inc/T_RetrievePlainBodyTextAndCompare.h
common/tools/ats/smoketest/email/email/smtp/inc/T_SendSmtpMessage.h
common/tools/ats/smoketest/email/email/smtp/inc/T_SmtpCreateForwardMessage.h
common/tools/ats/smoketest/email/email/smtp/inc/T_SmtpCreateReplyMessage.h
common/tools/ats/smoketest/email/email/smtp/inc/T_SmtpSendEmail.h
common/tools/ats/smoketest/email/email/smtp/inc/T_SmtpServer.h
common/tools/ats/smoketest/email/email/smtp/inc/T_StartRamUsageTimer.h
common/tools/ats/smoketest/email/email/smtp/inc/T_StopRamUsageTimer.h
common/tools/ats/smoketest/email/email/smtp/inc/T_UtilsSendEmail.h
common/tools/ats/smoketest/email/email/smtp/inc/local_imcvrecv.inl
common/tools/ats/smoketest/email/email/smtp/inc/local_imutdll.h
common/tools/ats/smoketest/email/email/smtp/inc/t_smtpcreatenewmessagewithplainbodytext.h
common/tools/ats/smoketest/email/email/smtp/src/ImCltCvRecv.cpp
common/tools/ats/smoketest/email/email/smtp/src/Local_imcvrecv.cpp
common/tools/ats/smoketest/email/email/smtp/src/Local_imutdll.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_CheckSmtpBMSetting.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_CheckSmtpSNAPSetting.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_CreateSmtpAccount.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_CreateSmtpMessageFromEmailFile.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_CreateSmtpMobilityAccount.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_ModifySmtpSettings.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_MsgAsyncStepSMTP.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_MsgSharedDataSmtp.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_MsgSyncStepSMTP.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_RemoveSmtpSNAPSetting.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_RetrievePlainBodyTextAndCompare.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_SendSmtpMessage.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_SmtpCreateForwardMessage.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_SmtpCreateNewMessageWithPlainBodyText.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_SmtpCreateReplyMessage.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_SmtpSendEmail.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_SmtpServer.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_StartRamUsageTimer.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_StopRamUsageTimer.cpp
common/tools/ats/smoketest/email/email/smtp/src/T_UtilsSendEmail.cpp
common/tools/ats/smoketest/email/framework/group/T_MsgFramework.mph
common/tools/ats/smoketest/email/framework/inc/T_MsgActive.h
common/tools/ats/smoketest/email/framework/inc/T_MsgAsyncStep.h
common/tools/ats/smoketest/email/framework/inc/T_MsgServer.h
common/tools/ats/smoketest/email/framework/inc/T_MsgSharedDataBase.h
common/tools/ats/smoketest/email/framework/inc/T_MsgStep.h
common/tools/ats/smoketest/email/framework/inc/T_MsgTimer.h
common/tools/ats/smoketest/email/framework/inc/T_RecordCurrentTime.h
common/tools/ats/smoketest/email/framework/inc/T_ShutDown.h
common/tools/ats/smoketest/email/framework/inc/T_StartUp.h
common/tools/ats/smoketest/email/framework/src/T_MsgActive.cpp
common/tools/ats/smoketest/email/framework/src/T_MsgAsyncStep.cpp
common/tools/ats/smoketest/email/framework/src/T_MsgServer.cpp
common/tools/ats/smoketest/email/framework/src/T_MsgSharedDataBase.cpp
common/tools/ats/smoketest/email/framework/src/T_MsgStep.cpp
common/tools/ats/smoketest/email/framework/src/T_MsgTimer.cpp
common/tools/ats/smoketest/email/framework/src/T_RecordCurrentTime.cpp
common/tools/ats/smoketest/email/framework/src/T_ShutDown.cpp
common/tools/ats/smoketest/email/framework/src/T_StartUp.cpp
common/tools/ats/smoketest/email/group/bld.inf
common/tools/ats/smoketest/email/mobilitytestframework/EABI/mobilitytestframeworku.def
common/tools/ats/smoketest/email/mobilitytestframework/bwins/mobilitytestframeworku.def
common/tools/ats/smoketest/email/mobilitytestframework/group/bld.inf
common/tools/ats/smoketest/email/mobilitytestframework/group/mobilitytestframework.mmp
common/tools/ats/smoketest/email/mobilitytestframework/inc/cimmobilitytestframework.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/cimmobilitytesttls.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/cmsgtestpropertymappair.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/cmsgtestpropertywatcher.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/mmsgtestpropertywatcher.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/mobilitytestmtmapi.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/mobilitytestpropertymap.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/mobilitytestpropertyvalue.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/msgnetteststub.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/timmobilitytestmtmstate.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/tmobilitytestpropertymapaccess.h
common/tools/ats/smoketest/email/mobilitytestframework/inc/tmsgtestpropertymapentry.h
common/tools/ats/smoketest/email/mobilitytestframework/src/cimmobilitytestframework.cpp
common/tools/ats/smoketest/email/mobilitytestframework/src/cimmobilitytesttls.cpp
common/tools/ats/smoketest/email/mobilitytestframework/src/cmsgtestpropertymappair.cpp
common/tools/ats/smoketest/email/mobilitytestframework/src/cmsgtestpropertywatcher.cpp
common/tools/ats/smoketest/email/mobilitytestframework/src/msgnetteststub.cpp
common/tools/ats/smoketest/email/mobilitytestframework/src/tmobilitytestpropertymapaccess.cpp
common/tools/ats/smoketest/email/testutils/bwins/T_MsgUtilityServerU.DEF
common/tools/ats/smoketest/email/testutils/bwins/messagingtestutility2u.def
common/tools/ats/smoketest/email/testutils/eabi/T_MsgUtilityServerU.DEF
common/tools/ats/smoketest/email/testutils/eabi/messagingtestutility2u.def
common/tools/ats/smoketest/email/testutils/group/T_Utils.mmp
common/tools/ats/smoketest/email/testutils/group/bld.inf
common/tools/ats/smoketest/email/testutils/inc/T_TimerUtils.h
common/tools/ats/smoketest/email/testutils/inc/T_Utils.h
common/tools/ats/smoketest/email/testutils/inc/T_UtilsCentralRepository.h
common/tools/ats/smoketest/email/testutils/inc/T_UtilsConfigFileMachineName.h
common/tools/ats/smoketest/email/testutils/inc/T_UtilsConfigFileParserUtility.h
common/tools/ats/smoketest/email/testutils/inc/T_UtilsDeleteAllChildren.h
common/tools/ats/smoketest/email/testutils/inc/T_UtilsEnumConverter.h
common/tools/ats/smoketest/email/testutils/inc/T_UtilsReadEmailSettingsFromConfigFile.h
common/tools/ats/smoketest/email/testutils/inc/t_testinstrumentation.h
common/tools/ats/smoketest/email/testutils/src/T_TimerUtils.cpp
common/tools/ats/smoketest/email/testutils/src/T_Utils.cpp
common/tools/ats/smoketest/email/testutils/src/T_UtilsCentralRepository.cpp
common/tools/ats/smoketest/email/testutils/src/T_UtilsConfigFileMachineName.cpp
common/tools/ats/smoketest/email/testutils/src/T_UtilsConfigFileParserUtility.cpp
common/tools/ats/smoketest/email/testutils/src/T_UtilsDeleteAllChildren.cpp
common/tools/ats/smoketest/email/testutils/src/T_UtilsEnumConverter.cpp
common/tools/ats/smoketest/email/testutils/src/T_UtilsReadEmailSettingsFromConfigFile.cpp
--- a/common/tools/ats/smoketest/Group/bld.inf	Thu Oct 29 14:03:35 2009 +0000
+++ b/common/tools/ats/smoketest/Group/bld.inf	Fri Oct 30 09:36:23 2009 +0000
@@ -22,3 +22,4 @@
 #include "../messaging/Group/bld.inf"
 #include "../System/Group/bld.inf"
 #include "../Timew/Group/bld.inf"
+#include "../email/group/bld.inf"
--- a/common/tools/ats/smoketest/Group/smoketest.pl	Thu Oct 29 14:03:35 2009 +0000
+++ b/common/tools/ats/smoketest/Group/smoketest.pl	Fri Oct 30 09:36:23 2009 +0000
@@ -9,6 +9,8 @@
 mkpath "temp/smoketest/general";
 mkpath "temp/smoketest/winscw_udeb";
 mkpath "temp/smoketest/sms/general";
+mkpath "temp/smoketest/emailmessage/general";
+mkpath "temp/smoketest/emailsettings/general";
 
 my $epoc=$ENV{'EPOCROOT'} . "epoc32/";
 copy("smoketest.xml",												"temp/test.xml");
@@ -26,7 +28,12 @@
 copy($epoc . "data/z/smoketest/smoketest_system.script",			"temp/smoketest/general/smoketest_system.script");
 copy($epoc . "data/z/smoketest/smoketest_timew.ini",				"temp/smoketest/general/smoketest_timew.ini");
 copy($epoc . "data/z/smoketest/smoketest_timew.script",				"temp/smoketest/general/smoketest_timew.script");
+copy($epoc . "data/z/smoketest/smoketest_email.ini",				"temp/smoketest/general/smoketest_email.ini");
+copy($epoc . "data/z/smoketest/smoketest_email.script",				"temp/smoketest/general/smoketest_email.script");
 copy($epoc . "data/z/smoketest/sms/message1.txt",					"temp/smoketest/sms/general/message1.txt");
+copy($epoc . "data/z/smoketest/MachineName.txt",					"temp/smoketest/general/MachineName.txt");
+copy($epoc . "data/z/smoketest/emailmessage/20KBody.txt",			"temp/smoketest/emailmessage/general/20KBody.txt");
+copy($epoc . "data/z/smoketest/emailsettings/popsettings_test908.txt",	"temp/smoketest/emailsettings/general/popsettings_test908.txt");
 copy($epoc . "release/winscw/udeb/SmokeTestSecureFSclient.dll",		"temp/smoketest/winscw_udeb/SmokeTestSecureFSclient.dll");
 copy($epoc . "release/winscw/udeb/SmokeTestSecureFSserver.exe",		"temp/smoketest/winscw_udeb/SmokeTestSecureFSserver.exe");
 copy($epoc . "release/winscw/udeb/Smoketest_Agenda_Server.exe",		"temp/smoketest/winscw_udeb/Smoketest_Agenda_Server.exe");
@@ -36,5 +43,8 @@
 copy($epoc . "release/winscw/udeb/Smoketest_System.exe",			"temp/smoketest/winscw_udeb/Smoketest_System.exe");
 copy($epoc . "release/winscw/udeb/Smoketest_Timew_Server.exe",		"temp/smoketest/winscw_udeb/Smoketest_Timew_Server.exe");
 copy($epoc . "release/winscw/udeb/SmokeTest_Utils.dll",				"temp/smoketest/winscw_udeb/SmokeTest_Utils.dll");
+copy($epoc . "release/winscw/udeb/t_msgutilityserver.dll",			"temp/smoketest/winscw_udeb/t_msgutilityserver.dll");
+copy($epoc . "release/winscw/udeb/t_msgpopserver.exe",				"temp/smoketest/winscw_udeb/t_msgpopserver.exe");
+copy($epoc . "release/winscw/udeb/t_msgsmtpserver.exe",				"temp/smoketest/winscw_udeb/t_msgsmtpserver.exe");
 
 system("7z a -tzip smoketest.zip ./temp/*");
--- a/common/tools/ats/smoketest/Group/smoketest.xml	Thu Oct 29 14:03:35 2009 +0000
+++ b/common/tools/ats/smoketest/Group/smoketest.xml	Fri Oct 30 09:36:23 2009 +0000
@@ -41,6 +41,24 @@
 					<step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
 						<command>install</command>
 						<params>
+							<param type="data"/>
+							<param src="20KBody.txt"/>
+							<param dst="c:/smoketest/emailmessage/20KBody.txt"/>
+							<param component-path="smoketest\emailmessage" />
+						</params>
+					</step>
+					<step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
+							<param type="data"/>
+							<param src="popsettings_test908.txt"/>
+							<param dst="c:/smoketest/emailsettings/popsettings_test908.txt"/>
+							<param component-path="smoketest\emailsettings" />
+						</params>
+					</step>
+					<step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
 							<param type="binary"/>
 							<param src="Smoketest_Agenda_Server.exe"/>
 							<param dst="c:\sys\bin\Smoketest_Agenda_Server.exe"/>
@@ -128,6 +146,33 @@
 							<param component-path="smoketest" />
 						</params>
 					</step>
+					<step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
+							<param type="binary"/>
+							<param src="t_msgutilityserver.dll"/>
+							<param dst="c:\sys\bin\t_msgutilityserver.dll"/>
+							<param component-path="smoketest" />
+						</params>
+					</step>					
+					<step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
+							<param type="binary"/>
+							<param src="t_msgpopserver.exe"/>
+							<param dst="c:\sys\bin\t_msgpopserver.exe"/>
+							<param component-path="smoketest" />
+						</params>
+					</step>					
+					<step id="" name="Test Step 1 (install)" harness="GENERIC" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
+							<param type="binary"/>
+							<param src="t_msgsmtpserver.exe"/>
+							<param dst="c:\sys\bin\t_msgsmtpserver.exe"/>
+							<param component-path="smoketest" />
+						</params>
+					</step>						
 					<step id="" name="Test Step 2 (execute)" harness="GENERIC" enabled="true" passrate="100" significant="true">
 						<command>execute</command>
 						<params>
@@ -183,6 +228,17 @@
 							<param leave-old-result="true"/>
 						</params>
 					</step>
+					<step id="" name="Test Step 2 (execute)" harness="GENERIC" enabled="true" passrate="100" significant="true">
+						<command>execute</command>
+						<params>
+							<param file="testexecute.exe"/>
+							<param parameters="c:\smoketest\smoketest_email.script"/>
+							<param result-file="c:\logs\testexecute\smoketest_email.htm"/>
+							<param timeout="600"/>
+							<param parser="TEFTestResultParser"/>
+							<param leave-old-result="true"/>
+						</params>
+					</step>
 				</case>
 			</set>
 		</session>
@@ -199,7 +255,12 @@
 		<file>smoketest/general/smoketest_mess.script</file>
 		<file>smoketest/general/smoketest_timew.ini</file>
 		<file>smoketest/general/smoketest_timew.script</file>
+		<file>smoketest/general/smoketest_email.ini</file>
+		<file>smoketest/general/smoketest_email.script</file>
 		<file>smoketest/sms/general/message1.txt</file>
+		<file>smoketest/general/MachineName.txt</file>
+		<file>smoketest/emailmessage/general/20KBody.txt</file>
+		<file>smoketest/emailsettings/general/popsettings_test908.txt</file>
 		<file>smoketest/winscw_udeb/SmokeTestSecureFSclient.dll</file>
 		<file>smoketest/winscw_udeb/SmokeTestSecureFSserver.exe</file>
 		<file>smoketest/winscw_udeb/Smoketest_Agenda_Server.exe</file>
@@ -209,5 +270,8 @@
 		<file>smoketest/winscw_udeb/Smoketest_System.exe</file>
 		<file>smoketest/winscw_udeb/Smoketest_Timew_Server.exe</file>
 		<file>smoketest/winscw_udeb/SmokeTest_Utils.dll</file>
+		<file>smoketest/winscw_udeb/t_msgutilityserver.dll</file>
+		<file>smoketest/winscw_udeb/t_msgpopserver.exe</file>
+		<file>smoketest/winscw_udeb/t_msgsmtpserver.exe</file>
 	</files>
 </test>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/group/MachineName.txt	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,1 @@
+machine-name
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/group/bld.inf	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,24 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file
+// bld.inf file for the Messaging Integration Test
+// 
+//
+
+PRJ_TESTMMPFILES
+#include "../../email/pop/group/bld.inf"
+#include "../../email/smtp/group/bld.inf"
+
+PRJ_TESTEXPORTS
+MachineName.txt    	z:/smoketest/MachineName.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/group/machinename.pl	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,27 @@
+# Copyright (c) 2005-2009 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 "Symbian Foundation License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+use Win32;
+
+my $computer;
+$computer=Win32::NodeName();
+$machineName = lc($computer);
+
+$fileName = "\\epoc32\\winscw\\c\\msgtest\\MachineName.txt";
+open(FILE, "> " . $fileName);
+
+# Write settings to output files
+print FILE "$machineName";
+close(FILE);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/group/T_PopServer.mmp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,81 @@
+// Copyright (c) 2005-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Project definition file for Pop test Server
+// 
+//
+
+	CAPABILITY 		ALL -TCB
+	TARGET			t_msgpopserver.exe
+	TARGETTYPE		exe
+	UID			0x1000007A 0x1027406F
+	VENDORID 		0x70000001
+
+// Include the Framework 
+#include "../../../framework/group/T_MsgFramework.mph"
+
+
+
+
+SYSTEMINCLUDE		/epoc32/include
+SYSTEMINCLUDE		/epoc32/include/test
+SYSTEMINCLUDE		/epoc32/include/comms-infras
+
+USERINCLUDE 	../inc
+
+SOURCEPATH	../src
+SOURCE	T_PopServer.cpp
+SOURCE	T_MsgSharedDataPop.cpp
+SOURCE	T_MsgAsyncStepPOP.cpp
+SOURCE	T_MsgSyncStepPOP.cpp
+SOURCE	T_CheckChildrenCountPop.cpp
+SOURCE	T_ComparePopEmailMsgs.cpp
+SOURCE	T_ComparePopSettings.cpp
+SOURCE	T_ConnectPop3Server.cpp
+SOURCE	T_CopyPopSelection.cpp
+SOURCE	T_CreatePopAccount.cpp
+SOURCE	T_DeleteAllPopChildren.cpp
+SOURCE	T_DeletePopAccount.cpp
+SOURCE	T_DisconnectPop3Server.cpp
+SOURCE	T_ModifyPopSettings.cpp
+SOURCE	T_PopInvokeAsyncFunction.cpp
+SOURCE	T_VerifyPopAccountsCount.cpp
+SOURCE	T_VerifyPopSettings.cpp
+SOURCE	T_StartRamUsageTimer.cpp
+SOURCE	T_StopRamUsageTimer.cpp
+SOURCE	T_CheckPop3AccessPoint.cpp
+SOURCE	T_CreatePopAccountWithoutSmtp.cpp
+SOURCE	T_ModifyPopSettings2.cpp
+SOURCE	T_CheckPopSNAPSetting.cpp
+SOURCE	T_RemovePopSNAPSetting.cpp
+SOURCE	T_CheckPopBMSetting.cpp
+
+LIBRARY 	testexecuteutils.lib
+LIBRARY		testexecutelogclient.lib
+LIBRARY		imut.lib 
+LIBRARY		bafl.lib
+LIBRARY		etext.lib
+LIBRARY		estor.lib 
+LIBRARY		msgs.lib
+LIBRARY		euser.lib
+LIBRARY		imcm.lib
+LIBRARY		efsrv.lib
+LIBRARY		charconv.lib
+LIBRARY		t_msgutilityserver.lib
+LIBRARY		hal.lib
+//LIBRARY		instrumentationhandler.lib
+LIBRARY		netmeta.lib
+EPOCHEAPSIZE 0x1000 0x800000
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/group/bld.inf	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,34 @@
+// Copyright (c) 2005-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Component description file for Pop test Server
+// 
+//
+
+PRJ_TESTMMPFILES
+T_PopServer.mmp
+
+PRJ_TESTEXPORTS
+// **** Test Suite: Messaging.Email.pop.plainbody
+../scripts/plainbody/smoketest_email.script		z:/smoketest/smoketest_email.script
+../testdata/plainbody/smoketest_email.ini		z:/smoketest/smoketest_email.ini
+../scripts/plainbody/setup_smoketest_email.script	z:/smoketest/setup_smoketest_email.script
+
+// Email Account Settings files
+../testdata/EmailSettings/POPSettings_test908.txt    	z:/smoketest/emailsettings/popsettings_test908.txt
+// Email Message files
+
+#ifndef _COMMON_EMAIL_FILES_
+#define _COMMON_EMAIL_FILES_
+../testdata/EmailMessage/20KBody.txt	z:/smoketest/EmailMessage/20KBody.txt
+#endif //End of _COMMON_EMAIL_FILES_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/CExpMailInfo.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,75 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This contains the class for CExpPop3MailInfo 
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __CEXPMAILINFO_H__
+#define __CEXPMAILINFO_H__
+
+
+// Epoc include
+#include <e32base.h>
+
+/**
+This class holds the information of number of lines, description etc... of a message.
+*/
+class CExpPop3MailInfo : public CBase
+	{
+public:
+	CExpPop3MailInfo() { }
+
+	virtual ~CExpPop3MailInfo() { }
+	
+	inline TInt GetNumLinesBodyText() const;
+	inline void SetNumLinesBodyText(TInt aLinesBodyText);
+
+	inline TInt GetNumAttachments() const;
+	inline void SetNumAttachments(TInt aNumAttachments);
+
+	inline TInt GetNumLinesHtml() const;
+	inline void SetNumLinesHtml(TInt aNumLinesHtml);
+
+	inline TBool GetFooterExpected() const;
+	inline void SetFooterExpected(TBool aFooterExpected);
+
+	inline TInt GetFooterSize() const;
+	inline void SetFooterSize(TBool aFooterSize);
+
+	inline TDesC& GetDescription();
+	inline void SetDescription(TDesC& aDesc);
+
+private:
+	TInt						iLinesBodyText;
+	TInt						iNumAttachments;
+	TInt						iNumLinesHtml;
+	TBool						iFooterExpected;
+	TBuf<64>					iDescription;
+	TInt						iFooterSize;
+	};
+
+
+#include "CExpMailInfo.inl"
+
+#endif // __CEXPMAILINFO_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/CExpMailInfo.inl	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,155 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+
+/**
+ @file
+ 
+ Gets Number Of Lines Of Body Text
+ 
+ @return
+ Returns Number Of Lines Of Body Text
+*/
+inline TInt CExpPop3MailInfo::GetNumLinesBodyText() const 
+	{
+	return iLinesBodyText;
+	}
+
+/** 
+Sets Number Of Lines Of Body Text
+
+@param aLinesBodyText
+Count of Lines of Body Text
+*/
+inline void CExpPop3MailInfo::SetNumLinesBodyText(TInt aLinesBodyText) 
+	{
+	iLinesBodyText = aLinesBodyText;
+	}
+
+/** 
+Gets Number Of Attachments
+
+@return
+Returns Number Of Attachments
+*/
+inline TInt CExpPop3MailInfo::GetNumAttachments() const 
+	{
+	return iNumAttachments;
+	}
+	
+/** 
+Sets Number Of Attachments
+
+@param aNumAttachments
+Count of Number of Attachments
+*/
+inline void CExpPop3MailInfo::SetNumAttachments(TInt aNumAttachments)
+	{
+	iNumAttachments = aNumAttachments;
+	}
+
+/** 
+Gets Number Of Html Lines
+
+@return
+Returns Number Of Html Lines
+*/
+inline TInt CExpPop3MailInfo::GetNumLinesHtml() const 
+	{
+	return iNumLinesHtml;
+	}
+
+/** 
+Sets Number Of Lines Of HTML
+
+@param aLinesHtml
+Count of Lines of HTML
+*/
+inline void CExpPop3MailInfo::SetNumLinesHtml(TInt aNumLinesHtml)
+	{
+	iNumLinesHtml = aNumLinesHtml;
+	}
+
+/** 
+Gets Flag status for FooterExpected
+
+@return
+Returns Value of FooterExpected
+*/
+inline TBool CExpPop3MailInfo::GetFooterExpected() const
+	{
+	return iFooterExpected;
+	}
+
+/** 
+Sets if Footer is Expected
+
+@param aFooterExpected
+Sets ETrue if Footer Expected
+*/
+inline void CExpPop3MailInfo::SetFooterExpected(TBool aFooterExpected)
+	{
+	iFooterExpected = aFooterExpected;
+	}
+
+/** 
+Gets Size of Footer
+
+@return
+Returns Size of Footer
+*/
+inline TInt CExpPop3MailInfo::GetFooterSize() const
+	{
+	return iFooterSize;
+	}
+
+/** 
+Sets Footer Size
+
+@param aFooterSize
+Sets Footer Size
+*/
+inline void CExpPop3MailInfo::SetFooterSize(TBool aFooterSize)
+	{
+	iFooterSize = aFooterSize;
+	}
+
+/** 
+Gets Description
+
+@return
+Returns Description
+*/
+inline TDesC& CExpPop3MailInfo::GetDescription()
+	{
+	return iDescription;
+	}
+
+/** 
+Sets Description
+
+@param aDesc
+Sets Description
+*/
+inline void CExpPop3MailInfo::SetDescription(TDesC& aDesc) 
+	{ 
+	iDescription.Copy(aDesc);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_CheckChildrenCountPop.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,54 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_CHECK_CHILDREN_COUNT_H__
+#define __T_CHECK_CHILDREN_COUNT_H__
+
+// user includes
+#include"T_MsgSyncStepPop.h"
+#include "T_MsgSharedDataPop.h"
+
+// Literals Used
+_LIT(KCheckChildrenCountPop,"CheckChildrenCountPop");
+
+
+/**
+Implements the test step which obtains the children count under the POP account
+and matches it against the expected count.
+*/
+class CT_MsgCheckChildrenCountPop : public CT_MsgSyncStepPOP
+	{
+public:
+	CT_MsgCheckChildrenCountPop(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgCheckChildrenCountPop();
+	
+	// CTestStep implementation
+	TVerdict doTestStepL();
+
+private:
+	CT_MsgCheckChildrenCountPop();
+	};
+#endif //__T_CHECK_CHILDREN_COUNT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_CheckPop3AccessPoint.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,34 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef __T_CHECKPOP3ACCESSPOINT_H__
+#define __T_CHECKPOP3ACCESSPOINT_H__
+
+#include "T_MsgSyncStepPop.h"
+
+_LIT(KCheckPop3AccessPoint,"CheckPop3AccessPoint");
+
+class CT_MsgCheckPop3AccessPoint : public CT_MsgSyncStepPOP
+	{
+public :
+	CT_MsgCheckPop3AccessPoint(CT_MsgSharedDataPop& aSharedDataPOP);
+
+	~CT_MsgCheckPop3AccessPoint();
+
+	/* CTestStep implementation */
+	TVerdict doTestStepL();
+	};
+
+#endif //__T_CHECKPOP3ACCESSPOINT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_CheckPopBMSetting.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,45 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgCheckPopBMSetting class
+// 
+//
+
+#ifndef T_CHECK_POP_BM_SETTING_H
+#define T_CHECK_POP_BM_SETTING_H
+
+/* User include */
+#include "T_MsgSyncStepPop.h"
+
+/* Literal used */
+_LIT(KCheckPopBMSetting,"CheckPopBMSetting");
+
+/* Implements a test step to check if bearer mobility is supported by POP service */
+class CT_MsgCheckPopBMSetting : public CT_MsgSyncStepPOP
+	{
+public:
+	CT_MsgCheckPopBMSetting(CT_MsgSharedDataPop& aSharedDataPOP);
+	
+	/* CTestStep implementation */
+	virtual TVerdict doTestStepL();
+	
+private:
+	TBool ReadIni();
+	
+private:
+	TPtrC iPopAccountName;
+	TBool iExpectedBMSupport;
+	
+	};
+	
+#endif /* T_CHECK_POP_BM_SETTING_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_CheckPopSNAPSetting.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,45 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgCheckPopSNAPSetting class
+// 
+//
+
+#ifndef T_CHECK_POP_SNAP_SETTING_H
+#define T_CHECK_POP_SNAP_SETTING_H
+
+/* User include */
+#include "T_MsgSyncStepPop.h"
+
+/* Literal used */
+_LIT(KCheckPopSNAPSetting,"CheckPopSNAPSetting");
+
+/* Implements a test step to check the POP SNAP information for the account */
+class CT_MsgCheckPopSNAPSetting : public CT_MsgSyncStepPOP
+	{
+public:
+	CT_MsgCheckPopSNAPSetting(CT_MsgSharedDataPop& aSharedDataPOP);
+	
+	/* CTestStep implementation */
+	virtual TVerdict doTestStepL();
+	
+private:
+	TBool ReadIni();
+	
+private:
+	TPtrC iPopAccountName;
+	TBool iExpectedSNAPDefinition;
+	
+	};
+	
+#endif /* T_CHECK_POP_SNAP_SETTING_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_ComparePopEmailMsgs.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,111 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_COMPARE_POP_EMAIL_MSGS_H__
+#define __T_COMPARE_POP_EMAIL_MSGS_H__
+
+	
+// User include
+#include "T_MsgAsyncStepPOP.h"
+#include "T_MsgSharedDataPop.h"
+
+
+// Epoc include
+#include <msvstd.h>
+
+// Literal used
+_LIT(KComparePopEmailMsgs,"ComparePopEmailMsgs");
+
+
+// Forward declaration
+class CImEmailMessage;
+class CExpPop3MailInfo;
+class CMsvSession;
+class MMsvAttachmentManager;
+
+
+/**
+Retireves the attacments related to a message entry.
+*/
+class CAttachmentItem : CBase
+	{
+public:	
+	static CAttachmentItem* NewL(CMsvSession& aSession, TMsvEntry aEntry);
+	static CAttachmentItem* NewLC(CMsvSession& aSession, TMsvEntry aEntry);
+	~CAttachmentItem();
+	
+	void ConstructL(CMsvSession& aSession, TMsvEntry aEntry);
+	MMsvAttachmentManager& MMsvAttachmentManager() const;
+	
+private:	
+	CMsvEntry*	iMsvEntry;
+	CImEmailMessage* iEmailMsg;
+	};
+
+
+/**	
+Implements the test step to compare email body text with the 
+partial/full download limits set.
+*/
+class CT_MsgComparePopEmailMsgs : public CT_MsgAsyncStepPOP
+	{
+public:
+	static CT_MsgComparePopEmailMsgs* NewL(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgComparePopEmailMsgs();
+
+	// CTestStep implementation
+	virtual TVerdict doTestStepL();
+
+private:
+	CT_MsgComparePopEmailMsgs(CT_MsgSharedDataPop& aSharedDataPOP);
+
+	//	CT_MsgAsyncStep implementation
+	virtual void	ProgressL(TBool bFinal);
+
+	//	MT_MsgActiveCallback implementation
+	virtual void	CancelStep();
+
+	TMsvId GetMessagePartIndexL(TMsvEntry& aEntry, TUid aUid);
+	TBool CheckIfFooterMessageExistsL(TPtrC& aRecvBodyText, TInt& aFooterSize);
+	TBool DoCompareL(TMsvEntry& aRecvEntry, CExpPop3MailInfo& aMailInfo, TMsvEntry& aSentEntry);
+	TInt GetMessageLinesL(TMsvEntry& aEntry, TUid aUid, TBool& aFooterExists, TInt &aFooterSize);
+	TInt CountLinesOfBodyTextL(CMsvEntry& aEntry, TBool& aFooterExists, TInt& aFooterSize);
+	TInt CountLinesOfHtmlL(CMsvEntry& aEntry);	
+	TBool LoadParametersL();
+
+	CExpPop3MailInfo* GetExpPop3MailInfoLC(TInt aIndx);
+	TBool CheckAttachmentsL(TMsvEntry& aRecvEntry, CExpPop3MailInfo& aMailInfo, TMsvEntry& aSentEntry);
+	TBool CompareFilesL(TFileName& aFileName1, TFileName& aFileName2);
+ 	TInt CT_MsgComparePopEmailMsgs::CheckIfServerMessageExists(TPtrC aBodyText);
+
+private:
+	CMsvEntrySelection*					iSentSelectionList;
+	CMsvEntrySelection*					iInboxSelectionList;
+	RPointerArray<CExpPop3MailInfo>		iExpResults;
+	RFs									iFs;
+	};
+	
+#endif //__T_COMPARE_POP_EMAIL_MSGS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_ComparePopSettings.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,69 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_COMPARE_POP_SETTINGS_H__
+#define __T_COMPARE_POP_SETTINGS_H__
+
+
+
+// User include
+#include "T_MsgSyncStepPop.h"
+
+//Epoc includes
+#include <cemailaccounts.h>
+
+// Forward Declaration
+class CImPop3Settings;
+class CImSmtpSettings;
+class CImIAPPreferences;
+
+// Literals Used
+_LIT(KComparePopSettings,"ComparePopSettings");
+
+
+/**
+Implements a test step to compare the POP and SMTP settings objects
+fora POP account
+*/
+class CT_MsgComparePopSettings : public CT_MsgSyncStepPOP
+	{	
+public:
+	CT_MsgComparePopSettings(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgComparePopSettings();
+	
+	// CTestStep implementation
+	TVerdict doTestStepL();
+	
+public:	
+	TVerdict CompareSettings(CImPop3Settings& aPopSettings1, CImPop3Settings& aPopSettings2,
+				CImSmtpSettings& aSmtpSettings1, CImSmtpSettings& aSmtpSettings2,
+				CImIAPPreferences& aPopIapPrefs1, CImIAPPreferences& aPopIapPrefs2,
+				CImIAPPreferences& aSmtpIapPrefs1, CImIAPPreferences& aSmtpIapPrefs2);
+	// This function loads the SMTP and POP settings objects of the specified POP account
+	void LoadAccountSettingsL(CEmailAccounts& aEmailAccount, const TPopAccount& aAccount, CImPop3Settings& aPopSettings, 
+	CImIAPPreferences& aPopIapSettings,CImSmtpSettings& aSmtpSettings, CImIAPPreferences& aSmtpIapSettings);
+	};
+#endif // __T_COMPARE_POP_SETTINGS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_ConnectPop3Server.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,62 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_CONNECT_POP3_SERVER_H__
+#define __T_CONNECT_POP3_SERVER_H__
+
+
+// User include
+#include "T_MsgAsyncStepPOP.h"
+
+// Literals Used
+_LIT(KConnectPop3Server,"ConnectPop3Server");
+
+
+/**
+This implements a test step to connect to the POP server
+*/
+class CT_MsgConnectPop3Server : public CT_MsgAsyncStepPOP
+	{
+public:
+	static CT_MsgConnectPop3Server* NewL(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgConnectPop3Server();
+
+	//	CTestStep implementation
+	virtual TVerdict doTestStepL();
+
+private:
+	CT_MsgConnectPop3Server(CT_MsgSharedDataPop& aSharedDataPOP);
+
+	//	CT_MsgAsyncStep implementation
+	virtual void	ProgressL(TBool bFinal);
+
+	//	MT_MsgActiveCallback implementation
+	virtual void	CancelStep();
+
+private:
+	CMsvOperation*	iOperation;
+	};
+
+#endif //__T_CONNECT_POP3_SERVER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_CopyPopSelection.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,62 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_COPY_POP_SELECTION_H__
+#define __T_COPY_POP_SELECTION_H__
+
+
+// User includes
+#include "T_MsgAsyncStepPOP.h"
+#include "T_MsgSharedDataPop.h"
+
+// Literals Used
+_LIT(KCopyPopSelection,"CopyPopSelection");
+
+/**
+Implements a test step to copy entries from the POP account created 
+to the specified target folder
+*/
+class CT_MsgCopyPopSelection  : public CT_MsgAsyncStepPOP
+	{
+public: 
+	static CT_MsgCopyPopSelection* NewL(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgCopyPopSelection();
+
+	//	CTestStep implementation
+	virtual TVerdict doTestStepL();
+
+private:
+	CT_MsgCopyPopSelection(CT_MsgSharedDataPop& aSharedDataPOP);
+
+	//	CT_MsgAsyncStep implementation
+	virtual void ProgressL(TBool bFinal);
+
+	//	MT_MsgActiveCallback implementation
+	virtual void CancelStep();
+
+private:
+	CMsvOperation* iOperation;
+	};
+#endif // __T_COPY_POP_SELECTION_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_CreatePopAccount.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,49 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_CREATE_POP_ACCOUNT_H__
+#define __T_CREATE_POP_ACCOUNT_H__
+
+
+// User include
+#include "T_MsgSyncStepPop.h"
+
+
+// Literals used
+_LIT(KCreatePopAccount,"CreatePopAccount");
+
+/**
+Implements a test step to create a POP account 
+*/
+class CT_MsgCreatePopAccount : public CT_MsgSyncStepPOP
+	{
+public :
+	CT_MsgCreatePopAccount(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgCreatePopAccount();
+	
+	// CTestStep implementation
+	TVerdict doTestStepL();
+	};
+#endif //__T_CREATE_POP_ACCOUNT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_CreatePopAccountWithoutSmtp.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,44 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgCreatePopAccountWithoutSmtp class
+// 
+//
+
+#ifndef T_CREATE_POP_ACCOUNT_WITHOUT_SMTP_H
+#define T_CREATE_POP_ACCOUNT_WITHOUT_SMTP_H
+
+/* User include */
+#include "T_MsgSyncStepPop.h"
+
+/* Literal used */
+_LIT(KCreatePopAccountWithoutSmtp,"CreatePopAccountWithoutSmtp");
+
+/* Implements a test step to create an POP account reading the settings from a config file */
+class CT_MsgCreatePopAccountWithoutSmtp : public CT_MsgSyncStepPOP
+	{
+public:
+	CT_MsgCreatePopAccountWithoutSmtp(CT_MsgSharedDataPop& aSharedDataPOP);
+
+	/* CTestStep implementation */
+	virtual TVerdict doTestStepL();
+	
+private:
+	TBool ReadIni();
+
+private:
+	TPtrC iPopAccountName;
+	TPtrC iConfigFileName;
+	
+	};
+#endif /* T_CREATE_POP_ACCOUNT_WITHOUT_SMTP_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_DeleteAllPopChildren.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,66 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_DELETE_ALL_POP_CHILDREN_H__
+#define __T_DELETE_ALL_POP_CHILDREN_H__
+
+
+// User include
+#include "T_MsgAsyncStepPOP.h"
+
+//	Forward decleration
+class CT_MsgUtilsDeleteAllChildren;
+
+//Literals Used
+_LIT(KDeleteAllPopChildren,"DeleteAllPopChildren");
+
+
+/**
+Implements a test step to delete all the children entries for the remote 
+POP account.
+*/
+class CT_MsgDeleteAllPopChildren : public CT_MsgAsyncStepPOP
+	{
+public:
+	static CT_MsgDeleteAllPopChildren* NewL(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgDeleteAllPopChildren();
+
+	//	CTestStep implementation
+	virtual TVerdict	doTestStepL();
+
+private:
+	CT_MsgDeleteAllPopChildren(CT_MsgSharedDataPop& aSharedDataPOP);
+
+	//	CT_MsgAsyncStep implementation
+	virtual void	ProgressL(TBool bFinal);
+
+	//	MT_MsgActiveCallback implementation
+	virtual void	CancelStep();
+
+private:
+	CT_MsgUtilsDeleteAllChildren*	iUtil;
+	};
+
+#endif //__T_DELETE_ALL_POP_CHILDREN_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_DeletePopAccount.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,47 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_DELETE_POP_ACCOUNT_H__
+#define __T_DELETE_POP_ACCOUNT_H__
+
+
+// User include
+#include "T_MsgSyncStepPop.h"
+
+// Literals Used
+_LIT(KDeletePopAccount,"DeletePopAccount");
+
+
+// This implements a test step to delete the pop account mentioned or to delete all the pop accounts
+class CT_MsgDeletePopAccount : public CT_MsgSyncStepPOP
+	{
+public :
+	CT_MsgDeletePopAccount(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgDeletePopAccount();
+	
+	// CTestStep implementation
+	TVerdict doTestStepL();	
+	};
+#endif //__T_DELETE_POP_ACCOUNT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_DisConnectPop3Server.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,62 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_DIS_CONNECT_POP3_SERVER_H__
+#define __T_DIS_CONNECT_POP3_SERVER_H__
+
+// User includes
+#include"T_MsgAsyncStepPOP.h"
+#include "T_MsgSharedDataPop.h"
+
+
+// Literals Used
+_LIT(KDisConnectPop3Server,"DisConnectPop3Server");
+
+/**
+Implements a test step to disconnect from the POP server
+*/
+class CT_MsgDisConnectPop3Server : public CT_MsgAsyncStepPOP
+	{
+public:
+	static CT_MsgDisConnectPop3Server* NewL(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgDisConnectPop3Server();
+
+	//	CTestStep implementation
+	virtual TVerdict	doTestStepL();
+
+private:
+	CT_MsgDisConnectPop3Server(CT_MsgSharedDataPop& aSharedDataPOP);
+
+	//	CT_MsgAsyncStep implementation
+	virtual void	ProgressL(TBool bFinal);
+
+	//	MT_MsgActiveCallback implementation
+	virtual void	CancelStep();
+
+private:
+	CMsvOperation*	iOperation;
+	};
+
+#endif //__T_DIS_CONNECT_POP3_SERVER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_ModifyPopSettings.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,50 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_MODIFY_POP_SETTINGS_H__
+#define __T_MODIFY_POP_SETTINGS_H__
+
+
+// User include
+#include "T_MsgSyncStepPop.h"
+
+// Literals Used
+_LIT(KModifyPopSettings,"ModifyPopSettings");
+
+
+/**
+Implements a test step to modify the settings of a POP account
+by reading from the config file specified
+*/
+class CT_MsgModifyPopSettings : public CT_MsgSyncStepPOP
+	{
+public :
+	CT_MsgModifyPopSettings(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgModifyPopSettings();
+	
+	// CTestStep implementation
+	TVerdict doTestStepL();
+	};
+#endif //__T_MODIFY_POP_SETTINGS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_ModifyPopSettings2.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,39 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgModifyPopSettings2 class
+// 
+//
+
+#ifndef T_MODIFY_POP_SETTINGS_2_H
+#define T_MODIFY_POP_SETTINGS_2_H
+
+/* User include */
+#include "T_MsgSyncStepPop.h"
+
+/* Literal used */
+_LIT(KModifyPopSettings2,"ModifyPopSettings2");
+
+/* Implements a test step that modifies the settings of the specified Pop account
+   via the given config file */
+class CT_MsgModifyPopSettings2 : public CT_MsgSyncStepPOP
+	{
+public :
+	CT_MsgModifyPopSettings2(CT_MsgSharedDataPop& aSharedDataPOP);
+
+	~CT_MsgModifyPopSettings2();
+
+	/* CTestStep implementation */
+	TVerdict doTestStepL();
+	};
+#endif /* T_MODIFY_POP_SETTINGS_2_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_MsgAsyncStepPOP.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,52 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* References POP shared data for use by derived test steps.
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_MSG_ASYNCSTEPPOP_H__
+#define __T_MSG_ASYNCSTEPPOP_H__
+
+//user includes
+#include "T_MsgAsyncStep.h"
+#include "T_MsgSharedDataPop.h"
+
+
+/**
+Base class for the asynchronous POP test steps
+*/
+class CT_MsgAsyncStepPOP : public CT_MsgAsyncStep
+	{
+protected:
+	CT_MsgAsyncStepPOP(CT_MsgSharedDataPop& iSharedDataPop);
+
+	//	MT_MsgActiveCallback implementation
+//	virtual void RunL() =0;
+//	virtual void DoCancel() =0;
+
+protected:
+	CT_MsgSharedDataPop& iSharedDataPOP;
+	};
+
+#endif // __T_MSG_ASYNCSTEPPOP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_MsgSharedDataPop.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,61 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_MSG_SHARED_DATA_POP_H__
+#define __T_MSG_SHARED_DATA_POP_H__
+
+// Epoc include
+#include <mtclbase.h>
+
+// User includes
+#include "T_MsgSharedDataBase.h"
+
+/**
+This implements a class which creates a pointer to the POP MTM object
+*/
+class CT_MsgSharedDataPop : public CT_MsgSharedDataBase
+	{
+public:
+	static CT_MsgSharedDataPop* NewL();
+	~CT_MsgSharedDataPop();
+
+protected:
+	virtual CBaseMtm*	NewMtmL();
+
+private:
+	void ConstructL();
+	CT_MsgSharedDataPop();
+
+public:
+	CPeriodic* 	iPeriodic;
+ 	TInt  		iMaxRamValue;
+ 	TInt  		iMinRamValue;
+ 	TInt  		iStartRamValue;
+ 	TInt  		iEndRamValue;
+ 	TBool 		iMark;
+	};
+
+#endif // __T_MSG_SHARED_DATA_Pop_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_MsgSyncStepPop.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,51 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Sync step class owning POP shared data for use by derived test steps.
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_MSG_SYNC_STEP_POP_H__
+#define __T_MSG_SYNC_STEP_POP_H__
+
+//user includes
+#include "T_MsgStep.h"
+#include "T_MsgSharedDataPop.h"
+
+/**
+Base class for synchronous POP teststeps.
+*/
+class CT_MsgSyncStepPOP : public CT_MsgStep
+	{
+protected:
+	CT_MsgSyncStepPOP(CT_MsgSharedDataPop& iSharedDataPop);
+	virtual ~CT_MsgSyncStepPOP();
+
+private:
+	CT_MsgSyncStepPOP(); //Force iSharedData to be set correctly.
+
+protected:
+	CT_MsgSharedDataPop& iSharedDataPOP;
+	};
+
+#endif // __T_MSG_SYNC_STEP_POP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_PopInvokeAsyncFunction.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,72 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_POP_INVOKE_ASYNC_FUNCTION_H__
+#define __T_POP_INVOKE_ASYNC_FUNCTION_H__
+
+// User includes
+#include "T_MsgAsyncStepPOP.h"
+#include "T_MsgSharedDataPop.h"
+
+
+// Epoc includes
+#include <pop3set.h>
+
+// Forward Declaration
+class CMsvOperation;
+class CT_MsgPopServer;
+
+// Literals Used
+_LIT(KPopInvokeAsyncFunction,"PopInvokeAsyncFunction");
+
+
+/**
+Implements a test step to populate the messages from the POP server
+*/
+class CT_MsgPopInvokeAsyncFunction : public CT_MsgAsyncStepPOP
+	{
+public:
+	static CT_MsgPopInvokeAsyncFunction* NewL(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgPopInvokeAsyncFunction();
+
+	//	CTestStep implementation
+	virtual TVerdict doTestStepL();
+
+private:
+	CT_MsgPopInvokeAsyncFunction(CT_MsgSharedDataPop& aSharedDataPOP);
+
+	//	CT_MsgAsyncStep implementation
+	virtual void ProgressL(TBool bFinal);
+
+	//	MT_MsgActiveCallback implementation
+	virtual void	CancelStep();
+
+private:
+	// For the async operation
+	CMsvOperation* iOperation;
+	// For the mail populate options
+	TImPop3PopulateOptions iMailInfo;
+	};
+#endif //__T_POP_INVOKE_ASYNC_FUNCTION_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_PopServer.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,57 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_POP_SERVER_H__
+#define __T_POP_SERVER_H__
+
+// User defined classes
+#include "T_MsgServer.h"
+#include "T_MsgSharedDataPop.h"
+
+
+//Literals Used
+_LIT(KPopServer,"T_MsgPopServer");
+
+
+/**
+POP test server which creates and executes the teststeps.
+*/
+class CT_MsgPopServer : public CT_MsgServer
+	{
+public :
+	static CT_MsgPopServer* NewL();
+
+private:
+	CT_MsgPopServer();
+
+	virtual CTestStep*				CreateTestStepL(const TDesC& aStepName);
+
+	// Creates an object of Shared Data
+	virtual CT_MsgSharedDataBase* NewSharedDataL();
+
+public:
+	CT_MsgSharedDataPop* iSharedDataPOP;
+	};
+#endif //__T_POP_SERVER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_RemovePopSNAPSetting.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,44 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgRemovePopSNAPSetting class
+// 
+//
+
+#ifndef T_REMOVE_POP_SNAP_SETTING_H
+#define T_REMOVE_POP_SNAP_SETTING_H
+
+/* User include */
+#include "T_MsgSyncStepPop.h"
+
+/* Literal used */
+_LIT(KRemovePopSNAPSetting,"RemovePopSNAPSetting");
+
+/* Implements a test step to remove the POP SNAP information for the account */
+class CT_MsgRemovePopSNAPSetting : public CT_MsgSyncStepPOP
+	{
+public:	
+	CT_MsgRemovePopSNAPSetting(CT_MsgSharedDataPop& aSharedDataPOP);
+	
+	/* CTestStep implementation */
+	virtual TVerdict doTestStepL();
+	
+private:
+	TBool ReadIni();
+	
+private:
+	TPtrC iPopAccountName;
+	
+	};
+	
+#endif /* T_REMOVE_POP_SNAP_SETTING_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_SharedDataPop.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,52 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_SHARED_DATA_POP_H__
+#define __T_SHARED_DATA_POP_H__
+
+// Epoc include
+#include <mtclbase.h>
+
+// User includes
+#include "t_msgshareddatabase.h"
+
+
+/**
+This implements a class which creates a pointer to the POP MTM object
+*/
+class CT_MsgSharedDataPop : public CT_MsgSharedDataBase
+	{
+public:
+	static CT_MsgSharedDataPop* NewL();
+
+protected:
+	virtual CBaseMtm*	NewMtmL();
+
+private:
+	CT_MsgSharedDataPop();
+	};
+
+#endif // __T_SHARED_DATA_POP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_StartRamUsageTimer.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_StartRamUsageTimer
+* 
+*
+*/
+
+
+
+
+
+
+
+#ifndef _T_START_RAM_USAGE_TIMER_
+#define _T_START_RAM_USAGE_TIMER_
+
+
+// User includes 
+#include "T_MsgAsyncStepPOP.h"
+
+// Literals used 
+_LIT(KStartRamUsageTimer,"StartRamUsageTimer");
+
+/**
+Implement a wrapper class over HAL APIs and 
+setting the periodic Timer to monitor the RAM usage
+ */
+class CT_StartRamUsageTimer : public CT_MsgAsyncStepPOP
+	{
+public:
+	CT_StartRamUsageTimer(CT_MsgSharedDataPop& aSharedDataPOP);	
+	~CT_StartRamUsageTimer();
+
+	static TInt RamUsage(TAny* aObject);
+	void DoRamUsage();
+
+private:
+     void ProgressL(TBool aFinal);
+     void CancelStep();
+     
+	// CTestStep implementation 
+	virtual TVerdict	doTestStepL();	
+	};
+
+
+#endif // _T_START_RAM_USAGE_TIMER_ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_StopRamUsageTimer.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_StopRamUsageTimer
+* 
+*
+*/
+
+
+
+
+
+
+
+#ifndef _T_STOP_RAM_USAGE_TIMER_
+#define _T_STOP_RAM_USAGE_TIMER_
+
+
+// User includes 
+#include "T_MsgAsyncStepPOP.h"
+
+// Literals used 
+_LIT(KStopRamUsageTimer,"StopRamUsageTimer");
+
+// Implement a test step to stop the periodic Timer 
+class CT_StopRamUsageTimer :public CT_MsgAsyncStepPOP
+	{
+public:
+	CT_StopRamUsageTimer(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_StopRamUsageTimer();
+private:
+     void ProgressL(TBool aFinal);
+     void CancelStep();
+     
+	// CTestStep implementation 
+	virtual TVerdict	doTestStepL();	
+	};
+
+
+#endif // _T_STOP_RAM_USAGE_TIMER_ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_VerfiyPopSettings.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,50 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_VERIFY_POP_SETTINGS_H__
+#define __T_VERIFY_POP_SETTINGS_H__
+
+
+// User include
+#include "T_MsgSyncStepPop.h"
+
+// Literals used
+_LIT(KVerifyPopSettings,"VerifyPopSettings");
+
+
+/**
+Implements a test step that verifies the settings of an POP account
+created with the default settings
+*/
+class CT_MsgVerifyPopSettings : public CT_MsgSyncStepPOP
+	{
+public :
+	CT_MsgVerifyPopSettings(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgVerifyPopSettings();
+	
+	// CTestStep implementation
+	TVerdict doTestStepL();
+	};
+#endif //__T_VERIFY_POP_SETTINGS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/inc/T_VerifyPopAccountsCount.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,49 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_VERIFY_POP_ACCOUNTS_COUNT_H__
+#define __T_VERIFY_POP_ACCOUNTS_COUNT_H__
+
+
+// User include
+#include "T_MsgSyncStepPop.h"
+
+// Literals Used
+_LIT(KVerifyPopAccountsCount,"VerifyPopAccountsCount");
+
+
+/**
+This class Implements a test step to verify the count of the Pop accounts created
+*/
+class CT_MsgVerifyPopAccountsCount: public CT_MsgSyncStepPOP
+	{
+public :
+	CT_MsgVerifyPopAccountsCount(CT_MsgSharedDataPop& aSharedDataPOP);
+	~CT_MsgVerifyPopAccountsCount();
+	
+	// CTestStep implementation
+	TVerdict doTestStepL();
+	};
+#endif //__T_VERIFY_POP_ACCOUNTS_COUNT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/scripts/plainbody/setup_smoketest_email.script	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,30 @@
+//
+// Copyright (c) 2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+RUN_UTILS MkDir			c:\smoketest\
+RUN_UTILS MkDir 		c:\smoketest\EmailMessage\
+RUN_UTILS MkDir 		c:\smoketest\emailsettings\
+
+RUN_UTILS CopyFile 		z:\smoketest\smoketest_email.ini	c:\smoketest\smoketest_email.ini
+RUN_UTILS MakeReadWrite	c:\smoketest\smoketest_email.ini
+RUN_UTILS CopyFile 		z:\smoketest\EmailMessage\20KBody.txt	c:\smoketest\EmailMessage\20KBody.txt
+RUN_UTILS MakeReadWrite c:\smoketest\EmailMessage\20KBody.txt
+RUN_UTILS CopyFile 		z:\smoketest\emailsettings\popsettings_test908.txt	c:\smoketest\emailsettings\popsettings_test908.txt
+RUN_UTILS MakeReadWrite c:\smoketest\emailsettings\popsettings_test908.txt
+RUN_UTILS CopyFile 		z:\smoketest\MachineName.txt	c:\smoketest\MachineName.txt
+RUN_UTILS MakeReadWrite c:\smoketest\MachineName.txt
+RUN_UTILS CopyFile 		z:\smoketest\smoketest_email.script	c:\smoketest\smoketest_email.script
+RUN_UTILS MakeReadWrite	c:\smoketest\smoketest_email.script
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/scripts/plainbody/smoketest_email.script	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,39 @@
+//
+// Copyright (c) 2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRINT Run Email smoketest
+
+LOAD_SUITE		T_MsgPopServer		-SharedData
+LOAD_SUITE		T_MsgSmtpServer 	-SharedData
+DELAY 1000
+
+START_TESTCASE			SMOKE_EMAIL_0001
+//!	@SYMTestCaseID		SMOKE_EMAIL_0001
+//!	@SYMTestCaseDesc	Create a new email message with 20KB plain body text
+
+PRINT Setup Begins #####################################################
+
+RUN_TEST_STEP 1000 T_MsgPopServer	StartUp
+RUN_TEST_STEP 1000 T_MsgSmtpServer	StartUp
+
+RUN_TEST_STEP 1000 T_MsgPopServer	CreatePopAccount		c:\smoketest\smoketest_email.ini 		0001-CreatePopAccount
+RUN_TEST_STEP 1000 T_MsgSmtpServer	SmtpCreateNewMessageWithPlainBodyText c:\smoketest\smoketest_email.ini 		0001-SmtpCreateNewMessageWithPlainBodyText
+
+RUN_TEST_STEP 1000 T_MsgSmtpServer	ShutDown
+RUN_TEST_STEP 1000 T_MsgPopServer	ShutDown
+
+PRINT Execute Completed ################################################
+END_TESTCASE			SMOKE_EMAIL_0001
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_CheckChildrenCountPop.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,138 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CheckChildrenCountPop
+// [Paramaters]
+// PopAccountName			:		Name of the Pop account
+// ExpectedChildrenCount	:		Expected number of children to be present in the
+// folder
+// Obtains a selection of the children entries under the Pop account and obtains its count.
+// Checks if children count is as expected. If the count does not match, the test step
+// fails.
+// [APIs Used]
+// CMsvEntry::SetEntryL
+// CMsvEntry::ChildrenL
+// CMsvEntry::SetSortTypeL
+// TMsvSelectionOrdering::SetShowInvisibleEntries
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User includes
+#include "T_CheckChildrenCountPop.h"
+#include <t_utils.h>
+#include <t_utilscentralrepository.h>
+
+
+//epoc includes
+#include <msvids.h>
+
+
+// Literals used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KExpCount,"Expectedcount");
+
+
+/**
+CT_MsgCheckChildrenCountPop()
+Sets the teststep name to KCheckChildrenCountPop
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgCheckChildrenCountPop::CT_MsgCheckChildrenCountPop(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgSyncStepPOP(aSharedDataPOP)
+	{
+	SetTestStepName(KCheckChildrenCountPop);
+	}
+
+
+/**
+~CT_MsgCheckChildrenCountPop()
+Destructor
+*/
+CT_MsgCheckChildrenCountPop::~CT_MsgCheckChildrenCountPop()
+	{
+	}
+
+	
+/**
+doTestStepL()
+Reads the remote foldername and the expected count from the ini file.
+Obtains the count of the children entries under the given folder.
+Verifies whether the expected count read from the ini file 
+matches with the actual count.Fails if the count does not match
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgCheckChildrenCountPop::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step :CheckChildrenCountPop "));
+
+	// Read the POP account name from the ini file
+	TPtrC	popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("POP account name is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		// Retrieving the POP service Id based on the account name read from ini
+		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&) popAccountName);
+		if(popServiceId == KMsvNullIndexEntryId)
+			{
+			ERR_PRINTF1(_L("Invalid Pop account name specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			TInt expectedChildrenCount;			
+			// Read the expected children count from ini file
+			if(!GetIntFromConfig(ConfigSection(), KExpCount, expectedChildrenCount))
+				{
+				ERR_PRINTF1(_L("Expected number of children in the POP account not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				// Create a selection of the children entries under the given folder and verify the count
+				CMsvEntrySelection* childrenSelection = 
+				CT_MsgUtils::CreateChildrenSelectionL(iSharedDataPOP.iSession, popServiceId);
+				CleanupStack::PushL(childrenSelection);
+		
+				TInt actualCount = childrenSelection->Count();
+
+				if (expectedChildrenCount != actualCount)
+					{
+					ERR_PRINTF3(_L("Children count is not equal to expected count, expected : %d, actual: %d "),expectedChildrenCount, actualCount);
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					INFO_PRINTF3(_L("Children count is equal to expected count, expected : %d, actual: %d "),expectedChildrenCount, actualCount);
+					}
+				CleanupStack::PopAndDestroy(childrenSelection);
+				}
+			}
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_CheckPop3AccessPoint.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,135 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CheckPop3AccessPoint
+// [Paramaters]
+// PopAccountName : Name of the Pop account
+// ConfigFileName: Configuration file name to read for account settings
+// [TestStep Description]
+// Checks what access point is being used by an POP account connection
+// 
+//
+
+#include "T_CheckPop3AccessPoint.h"
+
+#include <t_utilsreademailsettingsfromconfigfile.h>
+#include <t_utilscentralrepository.h>
+#include <pop3set.h>
+#include <iapprefs.h>
+
+/* Literals Used */
+_LIT(KAccountName,"PopAccountName");
+_LIT(KConfigFileName, "PopConfigFileName");
+
+/**
+	Function : CT_MsgCheckPop3AccessPoint
+	Description : Constructor
+	@param : aSharedDataPOP		Reference to CT_MsgSharedDataPop
+	@return : N/A
+*/
+CT_MsgCheckPop3AccessPoint::CT_MsgCheckPop3AccessPoint(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgSyncStepPOP(aSharedDataPOP)
+	{
+	SetTestStepName(KCheckPop3AccessPoint);
+	}
+
+/**
+	Function : ~CT_MsgCheckPop3AccessPoint
+	Description : Destructor
+	@return : N/A
+*/
+CT_MsgCheckPop3AccessPoint::~CT_MsgCheckPop3AccessPoint()
+	{
+	}
+
+/**
+	Function : doTestStepL
+	Description : 
+	@return : TVerdict - Test step result
+	@leave : KMsvNullIndexEntryId	Invalid POP account name specified
+*/
+TVerdict CT_MsgCheckPop3AccessPoint::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : CheckPop3AccessPoint"));
+
+	TPtrC	accountName;
+	if(!GetStringFromConfig(ConfigSection(), KAccountName, accountName))
+		{
+		ERR_PRINTF1(_L("Pop Account name not specified"));
+		SetTestStepResult(EFail);
+		return TestStepResult();
+		}
+
+	TPtrC	configFileName;
+	if(!GetStringFromConfig(ConfigSection(), KConfigFileName, configFileName))
+		{
+		ERR_PRINTF1(_L("Configuration file path is not specified"));
+		SetTestStepResult(EFail);
+		return TestStepResult();
+		}
+
+	CImIAPPreferences* popPrefs = CImIAPPreferences::NewLC();
+	CImPop3Settings* popSettings = new (ELeave) CImPop3Settings;
+	CleanupStack::PushL(popSettings);
+
+	TInt expectedAccessPoint = 0;
+
+	if(configFileName.CompareF( _L("none") ) != 0 )
+		{
+		TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(configFileName, *popSettings, *popPrefs));
+		if(err)
+			{
+			ERR_PRINTF2(_L("Failure while setting the POP setting parameters, failed with error %d"), err);
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			if (popPrefs->NumberOfIAPs() > 0)
+				{
+				TImIAPChoice iapChoice = popPrefs->IAPPreference(0);
+				expectedAccessPoint = iapChoice.iIAP;
+				}
+			}
+		}
+
+	CleanupStack::PopAndDestroy(2, popPrefs);
+
+	if (TestStepResult() == EPass)
+		{
+		TMsvId serviceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)accountName);
+
+		TUint32 accessPoint;
+		TInt err = iSharedDataPOP.iSession->ServiceAccessPointId(serviceId, accessPoint);
+		
+		if (err == KErrNone)
+			{
+			if (accessPoint == expectedAccessPoint)
+				{
+				INFO_PRINTF1(_L("Access points match"));
+				}
+			else
+				{
+				ERR_PRINTF3(_L("Access point %d does not match expected %d"), accessPoint, expectedAccessPoint);
+				SetTestStepResult(EFail);
+				}
+			}
+		else
+			{
+			ERR_PRINTF2(_L("Failure getting access point - %d"), err);
+			SetTestStepResult(EFail);
+			}
+		}
+
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_CheckPopBMSetting.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,111 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CheckPopBMSetting
+// [Paramaters]
+// PopAccountName			:Name of the Pop account.
+// ExpectedBMSupport		:ETrue => Bearer mobility is expected to be supported by the POP service.
+// EFalse => Bearer mobility is not expected to be supported by the POP service.
+// Checks if bearer mobility is supported by the POP service.
+// 
+//
+
+//User includes
+#include "T_CheckPopBMSetting.h"
+#include <t_utils.h>
+#include <t_utilsenumconverter.h>
+#include <t_utilscentralrepository.h>
+
+//Epoc include
+#include <iapprefs.h>
+
+//Literals used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KExpectedBMSupport,"ExpectedBMSupport");
+
+/**
+  Function : CT_MsgCheckPopBMSetting
+  Description : Constructor 
+  @param : aSharedDataPOP Reference to CT_MsgSharedDataPop
+  @return : N/A
+*/
+CT_MsgCheckPopBMSetting::CT_MsgCheckPopBMSetting(CT_MsgSharedDataPop& aSharedDataPOP)
+:CT_MsgSyncStepPOP(aSharedDataPOP)
+	{
+	SetTestStepName(KCheckPopBMSetting);
+	}
+	
+/**
+  Function : ReadIni
+  Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
+  @return : TBool
+*/
+TBool CT_MsgCheckPopBMSetting::ReadIni()
+	{
+	TBool result = ETrue;
+	
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, iPopAccountName))
+		{
+		ERR_PRINTF1(_L("Pop account name is not specified"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+		
+	if(!GetBoolFromConfig(ConfigSection(), KExpectedBMSupport, iExpectedBMSupport))
+		{
+		ERR_PRINTF1(_L("An expected \"ETrue\" or \"EFalse\" boolean value is not specified for BM support"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+	
+	return result;
+	}
+
+/**
+  Function : doTestStepL
+  Description : Checks the provisioned BM support for the POP account settings of a test case.
+  @return : TVerdict - Test step result
+*/		
+TVerdict CT_MsgCheckPopBMSetting::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : CheckPopBMSetting"));
+	if(ReadIni())
+		{
+		CEmailAccounts* accounts = CEmailAccounts::NewL();
+		CleanupStack::PushL(accounts);
+		
+		CImPop3Settings* popSettings = new(ELeave) CImPop3Settings();
+		CleanupStack::PushL(popSettings);
+					
+		TPopAccount popAccountId;
+		CT_MsgUtilsCentralRepository::GetPopAccountL((TDes&)iPopAccountName, popAccountId);
+				
+		accounts->LoadPopSettingsL(popAccountId, *popSettings);
+		
+		TBool actualBMSupport = popSettings->BearerMobility();
+		
+		if (actualBMSupport == iExpectedBMSupport)
+			{
+			INFO_PRINTF3(_L("Actual Bearer Mobility Support [%d] does equals Expected Bearer Mobility Support [%d]"),actualBMSupport,iExpectedBMSupport);
+			}
+		else
+			{
+			ERR_PRINTF3(_L("Actual Bearer Mobility Support [%d] does not equal Expected Bearer Mobility Support [%d]"),actualBMSupport,iExpectedBMSupport);
+			SetTestStepResult(EFail);
+			}
+	
+		CleanupStack::PopAndDestroy(2,accounts); // popSettings, accounts
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_CheckPopSNAPSetting.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,134 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CheckPopSNAPSetting
+// [Paramaters]
+// PopAccountName			:Name of the Pop account.
+// ExpectedSNAPDefinition	:ETrue => A SNAP has expected to been provisioned for the POP account.
+// EFalse => A SNAP has not expected to been provisioned for the POP account.
+// ExpectedSNAPPreference	:Expected SNAP ID (Assuming the SNAP has been defined for the POP a/c)
+// This parameter can be ignored if the "ExpectedSNAPDefinition" is EFalse.
+// Checks the provisioned SNAP information for the POP account.
+// 
+//
+
+//User includes
+#include "T_CheckPopSNAPSetting.h"
+#include <t_utils.h>
+#include <t_utilsenumconverter.h>
+#include <t_utilscentralrepository.h>
+
+//Epoc include
+#include <iapprefs.h>
+
+//Literals used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KSNAPDefined,"ExpectedSNAPDefinition");
+_LIT(KSNAPPreference,"ExpectedSNAPPreference");
+
+/**
+  Function : CT_MsgCheckPopSNAPSetting
+  Description : Constructor 
+  @param : aSharedDataPOP Reference to CT_MsgSharedDataPop
+  @return : N/A
+*/
+CT_MsgCheckPopSNAPSetting::CT_MsgCheckPopSNAPSetting(CT_MsgSharedDataPop& aSharedDataPOP)
+:CT_MsgSyncStepPOP(aSharedDataPOP)
+	{
+	SetTestStepName(KCheckPopSNAPSetting);
+	}
+	
+/**
+  Function : ReadIni
+  Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
+  @return : TBool
+*/
+TBool CT_MsgCheckPopSNAPSetting::ReadIni()
+	{
+	TBool result = ETrue;
+	
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, iPopAccountName))
+		{
+		ERR_PRINTF1(_L("Pop account name is not specified"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+		
+	if(!GetBoolFromConfig(ConfigSection(), KSNAPDefined, iExpectedSNAPDefinition))
+		{
+		ERR_PRINTF1(_L("An expected \"ETrue\" or \"EFalse\" boolean value is not specified for the SNAP definition"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+	
+	return result;
+	}
+
+/**
+  Function : doTestStepL
+  Description : Checks the provisioned SNAP information for the POP account settings of a test case.
+  @return : TVerdict - Test step result
+*/		
+TVerdict CT_MsgCheckPopSNAPSetting::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : CheckPopSNAPSetting"));
+	if(ReadIni())
+		{
+		CEmailAccounts* accounts = CEmailAccounts::NewL();
+		CleanupStack::PushL(accounts);
+		
+		CImIAPPreferences* popIapPrefs = CImIAPPreferences::NewLC();
+					
+		TPopAccount popAccountId;
+		CT_MsgUtilsCentralRepository::GetPopAccountL((TDes&)iPopAccountName,popAccountId);
+				
+		accounts->LoadPopIapSettingsL(popAccountId, *popIapPrefs);	
+		
+		TBool actualSNAPDefintion = popIapPrefs->SNAPDefined();
+		
+		if (actualSNAPDefintion == iExpectedSNAPDefinition)
+			{
+			if (actualSNAPDefintion)
+				{
+				TInt expectedSNAPPreference = 0;
+				if(!GetIntFromConfig(ConfigSection(), KSNAPPreference, expectedSNAPPreference))
+					{
+					ERR_PRINTF1(_L("An expected SNAP ID value is not specified"));
+					SetTestStepResult(EFail);
+					CleanupStack::PopAndDestroy(2,accounts); // popIapPrefs, accounts
+					return TestStepResult();
+					}
+				TInt actualSNAPPreference = popIapPrefs->SNAPPreference();
+				
+				if (actualSNAPPreference != expectedSNAPPreference)
+					{
+					ERR_PRINTF3(_L("Actual SNAP ID [%d] does not equal Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference);
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					INFO_PRINTF3(_L("Actual SNAP ID [%d] equals Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference);
+					}
+				}
+			}
+		else
+			{
+			ERR_PRINTF3(_L("Actual SNAP Defintion [%d] does not equal Expected SNAP Defintion [%d]"),actualSNAPDefintion,iExpectedSNAPDefinition);
+			SetTestStepResult(EFail);
+			}
+	
+		CleanupStack::PopAndDestroy(2,accounts); // popIapPrefs, accounts
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_ComparePopEmailMsgs.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,999 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// ComparePopEmailMsgs
+// [Paramaters]
+// PopAccountName		: 		Name of the POP account
+// Compares the recieved mails with the expected numbers of lines to test POP3 TOP command
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+// User includes
+#include "CExpMailInfo.h"
+#include "T_ComparePopEmailMsgs.h"
+#include <t_utils.h>
+#include <t_utilscentralrepository.h>
+#include <t_utilsenumconverter.h>
+
+
+// Epoc includes
+#include <imcm.rsg>
+#include <miutmsg.h>
+#include <mmsvattachmentmanager.h>
+
+
+// Literals Used
+_LIT(KPopAccountName,"PopAccountName");
+
+
+/**
+ConstructL()
+Used to ensure that MMsvAttachmentManager is not destroyed until we want it to be.
+To do this we need to preserve certain objects of CImEmailMessage, which if disappeared
+would invalidate MMsvAttachmentManager. But this should be deleted in a controlled manner.
+
+@param aSession
+An object of type CMsvSession object.
+
+@param aEntry
+An object of type TMsvEntry used to get the entry ID. 
+*/
+void CAttachmentItem::ConstructL(CMsvSession& aSession, TMsvEntry aEntry)
+	{
+	iMsvEntry = aSession.GetEntryL(aEntry.Id());
+
+	iMsvEntry->SetEntryL(aEntry.Id());
+	iEmailMsg = CImEmailMessage::NewL(*iMsvEntry);
+		
+	CMsvOperationActiveSchedulerWait* waiter = CMsvOperationActiveSchedulerWait::NewLC();
+ 	iEmailMsg->GetAttachmentsListL(waiter->iStatus, aEntry.Id(),
+								   CImEmailMessage::EAllAttachments, 
+								   CImEmailMessage::EThisMessageOnly);
+	waiter->Start();
+
+	CleanupStack::PopAndDestroy(1, waiter); //waiter		
+	}
+
+
+/**
+NewL()
+Allocates and creates a new CAttachmentItem object
+
+@param aSession
+An object of type CMsvSession object.
+
+@param aEntry
+An object of type TMsvEntry
+
+@leave KErrNoMemory
+
+@return 
+A pointer to an object of type CAttachmentItem
+
+*/
+CAttachmentItem* CAttachmentItem::NewL(CMsvSession& aSession, TMsvEntry aEntry)
+	{
+	CAttachmentItem* self=CAttachmentItem::NewLC(aSession, aEntry);
+	CleanupStack::Pop(self);
+
+	return self;
+	}
+
+
+/**
+NewLC()
+Static factory constructor. Uses two phase construction and leaves nothing on the CleanupStack.
+
+
+@param aSession
+An object of type CMsvSession object.
+
+@param aEntry
+An object of type TMsvEntry
+
+@leave KErrNoMemory
+@return
+A pointer to the newly created CAttachmentItem object.
+
+*/
+CAttachmentItem* CAttachmentItem::NewLC(CMsvSession& aSession, TMsvEntry aEntry)
+	{
+	CAttachmentItem* self=new (ELeave) CAttachmentItem;
+	CleanupStack::PushL(self);
+	
+	self->ConstructL(aSession, aEntry);
+	
+	return self;
+	}
+
+
+/**
+~CAttachmentItem()
+Destroy the data members.
+*/
+CAttachmentItem::~CAttachmentItem()
+	{
+	delete iEmailMsg;
+	iEmailMsg=NULL;
+
+	delete iMsvEntry;
+	iMsvEntry=NULL;
+	}
+
+
+/**
+MMsvAttachmentManager()
+
+@return
+An object of MMsvAttachmentManager
+*/
+MMsvAttachmentManager& CAttachmentItem::MMsvAttachmentManager() const
+	{			
+	return (iEmailMsg->AttachmentManager());		
+	}
+
+
+/**
+GetExpPop3MailInfoLC()
+Sets the CExpPop3MailInfo attributes reading from the INI file
+
+@param  aIndx
+Index in the selection list.
+
+@leave KErrNotReady
+
+@return
+A pointer to an object of type CExpPop3MailInfo
+*/
+CExpPop3MailInfo* CT_MsgComparePopEmailMsgs::GetExpPop3MailInfoLC(TInt aIndx)
+	{
+	CExpPop3MailInfo* expMailInfo  = new (ELeave) CExpPop3MailInfo;
+	CleanupStack::PushL(expMailInfo);
+	
+	TInt comInt = -1;
+	_LIT(KNumOfLines,"NumOfLines%d");
+	TBuf<256> param;
+	param.Format(KNumOfLines,aIndx);
+	
+	if (!GetIntFromConfig(ConfigSection(), param, comInt))
+		{
+		ERR_PRINTF1(_L("No Input for NumOfLines"));
+		User::Leave(KErrNotReady);
+		}
+	
+	expMailInfo->SetNumLinesBodyText(comInt);
+	comInt = -1;
+	
+	_LIT(KFooterExpected, "FooterExpected%d");
+	param.Format(KFooterExpected,aIndx);
+	if (!GetIntFromConfig(ConfigSection(), param, comInt))
+		{
+		ERR_PRINTF1(_L("No Input for Footer Expected"));
+		User::Leave(KErrNotReady);
+		}
+	expMailInfo->SetFooterExpected(comInt);
+	
+	comInt = -1;
+	_LIT(KNumOfLinesHtml, "NumOfLinesHtml%d");
+	param.Format(KNumOfLinesHtml, aIndx);
+	if (!GetIntFromConfig(ConfigSection(), param, comInt))
+		{
+		ERR_PRINTF1(_L("No Input For NumOfLinesHtml"));
+		User::Leave(KErrNotReady);
+		}
+	expMailInfo->SetNumLinesHtml(comInt);
+	
+	TPtrC ptrDes;
+	_LIT(KDescription, "Description%d");
+	param.Format(KDescription, aIndx);
+	if(!GetStringFromConfig(ConfigSection(), param, ptrDes))
+		{
+		ERR_PRINTF1(_L("No Input for Description"));
+		User::Leave(KErrNotReady);
+		}
+	expMailInfo->SetDescription(ptrDes);
+		
+	_LIT(KNumOfAttachments, "NumOfAttachments%d");
+	param.Format(KNumOfAttachments, aIndx);
+	if (!GetIntFromConfig(ConfigSection(), param, comInt))
+		{
+		ERR_PRINTF1(_L("No Input for NumOfAttachments"));
+		User::Leave(KErrNotReady);
+		}
+	expMailInfo->SetNumAttachments(comInt);
+	
+	comInt = -1;
+	if(expMailInfo->GetFooterExpected())
+		{
+		_LIT(KFooterSize, "FooterSize%d");
+		param.Format(KFooterSize, aIndx);
+		if (!GetIntFromConfig(ConfigSection(), param, comInt))
+			{
+			ERR_PRINTF1(_L("No Input for FooterSize"));
+			User::Leave(KErrNotReady);
+			}
+		expMailInfo->SetFooterSize(comInt);
+		}
+	else
+		{
+		expMailInfo->SetFooterSize(0);
+		}
+	
+	return expMailInfo;
+	}
+
+
+
+/**
+LoadParametersL()
+Loads the test parameters 
+
+@leave KErrNotReady
+@return
+ETrue if parameters loaded, Efalse on failure.
+*/
+TBool CT_MsgComparePopEmailMsgs::LoadParametersL()
+	{
+	TPtrC sentFolder;
+	_LIT(KSentFolder, "SentFolder");
+	if(!GetStringFromConfig(ConfigSection(), KSentFolder, sentFolder))
+		{
+		ERR_PRINTF1(_L("No Input for Sent Folder"));
+		User::Leave(KErrNotReady);
+		}
+			
+	iSentSelectionList = CT_MsgUtils ::CreateChildrenSelectionL(iSharedDataPOP.iSession, CT_MsgUtilsEnumConverter::FindFolderIdByName(sentFolder));
+	if(! iSentSelectionList)
+		{
+		ERR_PRINTF1(_L("Invalid sentSelectionList"));
+		SetTestStepResult(EFail);
+		return EFalse;
+		}
+	
+	TPtrC inboxFolder;
+	_LIT(KInboxFolder, "InboxFolder");
+	if(!GetStringFromConfig(ConfigSection(), KInboxFolder, inboxFolder))
+		{
+		ERR_PRINTF1(_L("No Input for Inbox Folder"));
+		User::Leave(KErrNotReady);
+		}
+	
+	
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("Account name not specified"));
+		SetTestStepResult(EFail);
+		}
+	if (CT_MsgUtilsEnumConverter::FindFolderIdByName(inboxFolder) == KMsvLocalServiceIndexEntryId)
+		{
+		// We are expecting to get a selection of remote Folder(which is the serviceId)
+		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+		
+		CMsvEntry* entry = iSharedDataPOP.iSession->GetEntryL(popServiceId);
+		CleanupStack::PushL(entry);
+		
+		entry->SetEntryL(popServiceId); // Setting the context to remote folder.
+		
+		iInboxSelectionList = CT_MsgUtils ::CreateChildrenSelectionL(iSharedDataPOP.iSession, popServiceId);
+		
+		CleanupStack::PopAndDestroy(entry);
+		}
+	else
+		{
+		iInboxSelectionList = CT_MsgUtils ::CreateChildrenSelectionL(iSharedDataPOP.iSession, CT_MsgUtilsEnumConverter::FindFolderIdByName(inboxFolder));
+		}
+
+	if(! iInboxSelectionList)
+		{
+		ERR_PRINTF1(_L("Invalid inboxSelectionList"));
+		SetTestStepResult(EFail);
+		return EFalse;
+		}
+	//Starting the comparision
+	if(iInboxSelectionList->Count() != iSentSelectionList->Count())
+		{
+		ERR_PRINTF3(_L("iInboxSelectionList->Count(%d) != iSentSelectionList->Count(%d)"),
+								 iInboxSelectionList->Count(), iSentSelectionList->Count());
+		SetTestStepResult(EFail);
+		return EFalse;
+		}
+
+	TInt comInt = -1;
+	_LIT(KNumTest, "NumTest");
+	if (!GetIntFromConfig(ConfigSection(), KNumTest, comInt))
+		{
+		ERR_PRINTF1(_L("No Input for NumTests"));
+		User::Leave(KErrNotReady);
+		}
+	TInt numTests = comInt;
+	if(numTests != iInboxSelectionList->Count())
+		{
+		ERR_PRINTF1(_L("iNumTests != iInboxSelectionList"));
+		SetTestStepResult(EFail);
+		return EFalse;
+		}
+		
+	iExpResults.Reset();
+	for(TInt i = 0;i < numTests; i++) 
+		{
+		
+		CExpPop3MailInfo* pExp = GetExpPop3MailInfoLC(i);
+		if(! pExp)
+			{
+			ERR_PRINTF1(_L("Invalid expected mail Info"));
+			SetTestStepResult(EFail);
+			return EFalse;
+			}
+		else
+			{
+			CleanupStack::Pop(pExp); // pExp			
+			iExpResults.Append(pExp);
+			}
+		}
+	return ETrue;
+	}
+
+
+/**
+DoCompareL()
+Comparison of 2 email messages identified by TMsvEntry
+
+@param  aRecvEntry
+The recieved email identifier.
+
+@param  aMailInfo
+Expected state of the recieved email.
+
+@param  aSentEntry
+Identifier of the original sent email foir comparison purposes.
+
+@return
+ETrue if emails match EFalse otherwise
+*/
+TBool CT_MsgComparePopEmailMsgs::DoCompareL(TMsvEntry& aRecvEntry, CExpPop3MailInfo& aMailInfo, TMsvEntry& aSentEntry)
+	{
+	TBool ret = ETrue;
+	TBool footerExists = EFalse;
+	TInt footersize = 0;
+		
+			
+	TInt nLines = GetMessageLinesL(aRecvEntry, KUidMsvEmailTextEntry, footerExists, footersize);
+	if(nLines != aMailInfo.GetNumLinesBodyText())
+		{
+		ERR_PRINTF3(_L("Lines of body text wrong actual = %d expected = %d!"), nLines, aMailInfo.GetNumLinesBodyText());
+		ret = EFalse;
+		}
+	nLines = GetMessageLinesL(aRecvEntry, KUidMsvEmailHtmlEntry, footerExists, footersize);
+
+	if(nLines != aMailInfo.GetNumLinesHtml())
+		{		
+		ERR_PRINTF3(_L("HTML size wrong actual = %d expected = %d!"), nLines, aMailInfo.GetNumLinesHtml());
+		ret = EFalse;
+		}
+
+	else if(! CheckAttachmentsL(aRecvEntry, aMailInfo, aSentEntry))
+		{
+		ERR_PRINTF1(_L("Attachment comparison failed !"));
+		ret = EFalse;
+		}
+
+	else if(! footerExists && aMailInfo.GetFooterExpected())
+		{
+		ERR_PRINTF1(_L("An expected footer was missing !"));
+		ret = EFalse;
+		}
+	else if(footerExists && ! aMailInfo.GetFooterExpected())
+		{
+		ERR_PRINTF1(_L("An unexpected footer was found !"));
+		ret = EFalse;
+		}
+	else if(aMailInfo.GetFooterExpected() && aMailInfo.GetFooterSize()!=0 
+			&& aMailInfo.GetFooterSize() != footersize)
+		{
+		ERR_PRINTF3(_L("KB left on server size wrong = %d expected = %d!"), footersize, aMailInfo.GetFooterSize());
+		ret = EFalse;			
+		}
+	return ret;
+	}
+
+
+
+
+/**
+CheckAttachmentsL()
+Compares attachments for the email messages aRecvEntry and aSentEntry using
+expected results in aMailInfo
+
+@param aRecvEntry
+An identifier for the recieved email
+
+@param aMailInfo
+Expected state of recieved email attachments
+
+@param aSentEntry
+An identifier for the original email
+
+@return
+ETrue if attachments match otherwise EFalse
+*/
+TBool CT_MsgComparePopEmailMsgs::CheckAttachmentsL(TMsvEntry& aRecvEntry, CExpPop3MailInfo& aMailInfo, TMsvEntry& aSentEntry)
+	{
+	TBool ret = ETrue;
+	CAttachmentItem* recvManager = CAttachmentItem::NewLC(*iSharedDataPOP.iSession, aRecvEntry);
+	CAttachmentItem* sentManager = CAttachmentItem::NewLC(*iSharedDataPOP.iSession, aSentEntry);
+
+	TInt recvCount = recvManager->MMsvAttachmentManager().AttachmentCount();	
+	TInt sentCount = sentManager->MMsvAttachmentManager().AttachmentCount();
+
+	TFileName recvFileName;
+	TFileName sentFileName;
+
+	if(recvCount == aMailInfo.GetNumAttachments())
+		{
+		for(TInt i=0;i<recvCount;i++)
+			{
+			for(TInt j=0;j<sentCount;j++)
+				{
+				CMsvAttachment* recvAttInfo = recvManager->MMsvAttachmentManager().GetAttachmentInfoL(i);
+				CleanupStack::PushL(recvAttInfo);
+
+				CMsvAttachment* sentAttInfo = sentManager->MMsvAttachmentManager().GetAttachmentInfoL(j);
+				CleanupStack::PushL(sentAttInfo);
+
+				if(recvAttInfo->AttachmentName().Compare(sentAttInfo->AttachmentName()) == 0)
+					{
+					recvFileName = recvAttInfo->FilePath();
+					sentFileName = sentAttInfo->FilePath();
+					ret = CompareFilesL(recvFileName, sentFileName);
+					}
+				CleanupStack::PopAndDestroy(2, recvAttInfo);		
+				}
+			}
+		}
+	else
+		{
+		INFO_PRINTF3(_L("Warning - Expected attachments mismatch recieved (%d) expected (%d)"),
+								 recvCount, aMailInfo.GetNumAttachments());
+		ret = EFalse;
+		}
+	CleanupStack::PopAndDestroy(2, recvManager); // recvManager,sentManager
+	return ret;
+	}
+
+
+
+/**
+CompareFilesL()
+Performs byte for byte copmparison of the files indicated by aFileName1 and aFileName2
+
+@param aFileName1
+Filename of first file to be compared
+
+@param aFileName2
+Filename of second file to be compared
+
+@return
+ETrue if files match, EFalse otherwise
+*/
+TBool CT_MsgComparePopEmailMsgs::CompareFilesL(TFileName& aFileName1, TFileName& aFileName2)
+	{
+	TBool ret = ETrue;
+	RFile file1, file2;
+
+	User::LeaveIfError(file1.Open(iFs, aFileName1, EFileRead));
+	User::LeaveIfError(file2.Open(iFs, aFileName2, EFileRead));
+
+	TInt sz1, sz2;
+	User::LeaveIfError(file1.Size(sz1));
+	User::LeaveIfError(file2.Size(sz2));
+	
+	if(sz1 != sz2)
+		{
+		ERR_PRINTF3(_L("File size mismatch 1(%d)   2(%d)"), sz1, sz2);
+		ret = EFalse;
+		}
+	else
+		{
+		TBuf8<1> char1;
+		TBuf8<1> char2;
+		TInt len1, len2;
+		do
+			{
+			file1.Read(char1);
+			file2.Read(char2);
+			len1 = char1.Length();
+			len2 = char2.Length();
+			if(char1.Compare(char2) != 0)
+				{
+				ret = EFalse;
+				break;
+				}
+			}
+		while(len1 && len2);
+		}
+	file1.Close();
+	file2.Close();
+	return ret;
+	}
+
+
+/**
+GetMessageLinesL()
+Counts the number of lines in a message's HTML or body text
+
+@param aEntry
+Email message identifier
+
+@param aUid
+Request identifier KUidMsvEmailHtmlEntry or KUidMsvEmailTextEntry at present
+
+@param aFooterExists
+Reference to a boolean variable only used when aUid == KUidMsvEmailTextEntry
+
+@param aFooterSize
+Expected KB left on server inserted into footer string if present 
+
+@return
+Returns the number of lines in the requested message part
+*/
+TInt CT_MsgComparePopEmailMsgs::GetMessageLinesL(TMsvEntry& aEntry, TUid aUid, TBool& aFooterExists, TInt &aFooterSize)
+	{
+	TInt lines = 0; 
+	
+	TMsvId msgPartIndex = GetMessagePartIndexL(aEntry,aUid);
+	
+	if(msgPartIndex)
+		{
+		CMsvEntry* msvEntry = iSharedDataPOP.iSession->GetEntryL(msgPartIndex);
+		CleanupStack::PushL(msvEntry);
+	
+		msvEntry->SetEntryL(msgPartIndex);
+		if(aUid == KUidMsvEmailTextEntry)
+			{
+			lines = CountLinesOfBodyTextL(*msvEntry, aFooterExists, aFooterSize);
+			}
+		else if(aUid == KUidMsvEmailHtmlEntry)
+			{
+			lines = CountLinesOfHtmlL(*msvEntry);
+			}
+		CleanupStack::PopAndDestroy(msvEntry);
+		}
+	return lines;
+	}
+
+
+/**
+CountLinesOfBodyTextL()
+Counts the lines of body text in the email aEntry
+
+@param aEntry
+A reference to an object representing the email
+
+@param aFooterExists
+Reference to a boolean variable - set to ETrue if the footer string is found in the body text
+
+@param aFooterSize
+Expected KB left on server inserted into footer string if present 
+
+@return
+Number of lines in the body text 
+*/
+TInt CT_MsgComparePopEmailMsgs::CountLinesOfBodyTextL(CMsvEntry& aEntry, TBool& aFooterExists, TInt& aFooterSize)
+	{
+	TInt lines = 0;
+	aFooterExists=EFalse;
+	aFooterSize=0;
+	aEntry.SetEntryL(aEntry.EntryId());
+	if(aEntry.HasStoreL())
+		{
+		CMsvStore*	msvStore1= aEntry.ReadStoreL();
+		CleanupStack::PushL(msvStore1);
+		CParaFormatLayer*	paraFormatLayer1 = CParaFormatLayer::NewL();
+		CleanupStack::PushL(paraFormatLayer1);
+		CCharFormatLayer*	charFormatLayer1 = CCharFormatLayer::NewL(); 
+		CleanupStack::PushL(charFormatLayer1);
+		CRichText*	bodyText1=CRichText::NewL(paraFormatLayer1, charFormatLayer1, CEditableText::EFlatStorage, 256);
+		CleanupStack::PushL(bodyText1);
+
+		bodyText1->Reset();
+		if (msvStore1->HasBodyTextL())
+			{
+			msvStore1->RestoreBodyTextL(*bodyText1);
+			TUint16 val = CEditableText::ELineBreak;
+			TInt n = 0;
+			TInt pos = 0;
+			for(;;)
+				{
+				TPtrC bodyText = bodyText1->Read(pos);
+				n = bodyText.Find(&val, 1);
+				if(n < 0)
+					break;
+				lines++;
+				pos += n+1;
+				
+				//This Check is needed to delete the extra line introduced by communigate Pro Server
+				TInt fpos = CheckIfServerMessageExists(bodyText);
+				if (fpos != KErrNotFound)
+					{
+					lines--;
+					}
+				}
+			TPtrC	pBt = bodyText1->Read(0);
+			aFooterExists = CheckIfFooterMessageExistsL(pBt , aFooterSize);
+			}		
+		CleanupStack::PopAndDestroy(4, msvStore1);  //bodyText1,charFormatLayer1,paraFormatLayer1,msvStore1.
+		}
+	return lines;
+	}
+
+
+/**
+CheckIfServerMessageExists()
+Checks if any server message has been added to the Body text returns the 
+position of the server message in the buffer and the length of the server
+message.This function can be enhanced to check for any other server message encountered.
+If not found, returns KErrNotFound.
+
+@param aBodyText
+The body text of the message
+
+@return
+Position of the message, if not found returns KErrNotFound
+*/
+ TInt CT_MsgComparePopEmailMsgs::CheckIfServerMessageExists(TPtrC aBodyText)
+	{
+	_LIT(KServerMessage,"*This message was transferred with a trial version of CommuniGate(tm) Pro*");
+
+	TInt pos = aBodyText.FindC(KServerMessage);
+	
+	return pos;
+	}
+
+
+/**
+CountLinesOfHtmlL()
+Counts the number of lines of HTML
+
+@param aEntry
+A reference to an object representing the email
+
+@return
+Number of lines of HTML
+*/
+TInt CT_MsgComparePopEmailMsgs::CountLinesOfHtmlL(CMsvEntry& aEntry)
+	{ 
+	TInt lines = 0;
+	aEntry.SetEntryL(aEntry.EntryId());
+	
+	
+	CMsvStore* store = aEntry.ReadStoreL();
+	CleanupStack::PushL(store);
+	
+	MMsvAttachmentManager& attManager = store->AttachmentManagerL();
+	
+	RFile htmlFile = attManager.GetAttachmentFileL(0);
+	CleanupClosePushL(htmlFile);
+	
+	_LIT8(KFindData, "\r\n");
+	TInt htmlSize = 0;
+	User::LeaveIfError(htmlFile.Size(htmlSize));
+	HBufC8* fBuf = HBufC8::NewLC(htmlSize);
+	TPtr8 p = fBuf->Des();
+	htmlFile.Read(p);
+	TInt pos = 0;
+	for(;;)
+		{
+		pos = p.Find(KFindData);
+		if(pos < 0)
+			{
+			break;
+			}
+		p = p.Mid(pos+2);
+		lines++;
+		}
+		
+	CleanupStack::PopAndDestroy(fBuf);
+	CleanupStack::PopAndDestroy(); // htmlFile
+	CleanupStack::PopAndDestroy(store);
+	
+	return lines;
+	}
+
+
+
+/**
+GetMessagePartIndexL()
+Retrieves the part index id for the email identified by aEntry
+
+@param aEntry
+A valid email identifier
+
+@param aUid
+An identifier tfor the type of message part to be retrieved
+
+@return
+TMsvId - message part identifier
+*/
+TMsvId CT_MsgComparePopEmailMsgs::GetMessagePartIndexL(TMsvEntry& aEntry, TUid aUid)
+	{
+	static TBool msgPartFound = EFalse;	
+	TMsvId msgPartId = 0;
+	CMsvEntry*	baseEntry  = iSharedDataPOP.iSession->GetEntryL(aEntry.Id());
+	CleanupStack::PushL(baseEntry);
+	CMsvEntrySelection*	selection =  baseEntry->ChildrenL();
+	CleanupStack::PushL(selection);
+	TInt count = selection->Count();
+	TInt ind1;
+	CMsvEntry* entry = iSharedDataPOP.iSession->GetEntryL(KMsvRootIndexEntryId);
+	CleanupStack::PushL(entry);
+	for (ind1=0, msgPartFound=EFalse; ind1 < count; ind1++)
+		{
+		if(msgPartFound)
+			{
+			break;
+			}		
+		TMsvId	childId  = selection->At(ind1);
+		entry->SetEntryL(childId);
+
+		if (entry->Entry().iType  == aUid)
+			{
+			msgPartId = childId;
+			break;
+			}
+		else if (entry->Entry().iType  == KUidMsvFolderEntry)
+			{
+			TMsvEntry ent = entry->Entry();
+			msgPartId = GetMessagePartIndexL(ent, aUid);
+			}
+		}
+	CleanupStack::PopAndDestroy(3, baseEntry);  // entry,selection,baseEntry
+	return msgPartId;
+	}
+
+
+
+
+/**
+CheckIfFooterMessageExistsL()
+Checks the email for the presence of the footer string
+
+@param aRecvBodyText
+Reference to a descriptor holding the body text
+
+@param aFooterSize
+The expected number of KB remaining on the server which has been inserted into the footer string
+
+@return
+ETrue if footer string found otherwise EFalse 
+*/
+TBool CT_MsgComparePopEmailMsgs::CheckIfFooterMessageExistsL(TPtrC& aRecvBodyText , TInt& aFooterSize)
+	{
+	RResourceFile resFile;
+	CT_MsgUtils ::OpenResourceFileL(resFile, iFs, KImEngineResourceFile);	// NB leaves if file not found
+	TCleanupItem close(CT_MsgUtils ::CloseResourceFile, &resFile);
+	CleanupStack::PushL(close);
+	
+	HBufC8* buf = NULL;
+	buf = resFile.AllocReadLC(PARTIAL_DOWNLOAD_FOOTER_MESSAGE);
+	TResourceReader reader;
+	reader.SetBuffer(buf);
+
+	HBufC* resourceBuf = (reader.ReadTPtrC()).AllocL();
+	CleanupStack::PushL(resourceBuf);
+
+	TInt len = resourceBuf->Find(_L("%d"));
+	const TInt KBufLen = 256;
+	TBuf<KBufLen> findBuf;
+
+	if(len == KErrNotFound)
+		{
+		len = resourceBuf->Length();
+		}
+
+	if(len > KBufLen)
+		{
+		len = KBufLen;
+		}
+	
+	findBuf.Copy(resourceBuf->Ptr(), len);
+	len = aRecvBodyText.Find(findBuf);
+
+	if(len>=0)
+		{
+		TPtrC rest=aRecvBodyText.Right(aRecvBodyText.Length()-len-findBuf.Length());
+		TLex lex(rest.Left(rest.Locate(TChar(' '))));
+		lex.Val(aFooterSize);
+		}
+	else
+		{
+		aFooterSize=0;
+		}
+
+	CT_MsgUtils ::CloseResourceFile(&resFile);
+	CleanupStack::PopAndDestroy(3); // buf, resourceBuf, close
+	return (len != KErrNotFound);
+	}
+
+//const TInt KGranuality = 5;
+
+/**
+CT_MsgComparePopEmailMsgs()
+Constructor
+
+@param  aSharedDataPOP
+Data shared across the POP test steps. Ex. SessionF
+*/
+CT_MsgComparePopEmailMsgs::CT_MsgComparePopEmailMsgs(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgAsyncStepPOP(aSharedDataPOP)  
+	{
+	iSentSelectionList = NULL;
+	iInboxSelectionList = NULL;
+	SetTestStepName(KComparePopEmailMsgs);
+	}
+
+
+/**
+NewL()
+Allocates and creates a new CT_MsgComparePopEmailMsgs object
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+
+@leave KErrNoMemory
+@return
+Returns pointer to an object of CT_MsgComparePopEmailMsgs.
+*/
+CT_MsgComparePopEmailMsgs* CT_MsgComparePopEmailMsgs::NewL(CT_MsgSharedDataPop& aSharedDataPOP)
+	{
+	CT_MsgComparePopEmailMsgs* self = new(ELeave) CT_MsgComparePopEmailMsgs(aSharedDataPOP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 // Call CT_AsyncStep::ConstructL()
+	CleanupStack::Pop(self);
+	return self;
+	}		
+
+
+/**
+ProgressL()
+
+*/
+
+//////////////////////////
+////
+////	I have no idea what this code is doing.
+////	It looks very messy.
+////	Someone is going to have to reowrk this code so that we can cancel and do progress
+////
+//////////////////////////
+void CT_MsgComparePopEmailMsgs::ProgressL(TBool bFinal)
+	{
+	//	TODO
+	if (bFinal)
+		{
+		//	Display final progress
+		}
+	else
+		{
+		//	Display current progress
+		}
+	}
+
+
+/**
+CancelStep()
+
+*/
+void CT_MsgComparePopEmailMsgs::CancelStep()
+	{
+	//	TODO
+	}
+
+
+/**
+~CT_MsgComparePopEmailMsgs()
+Deletes all the data members.
+*/
+CT_MsgComparePopEmailMsgs::~CT_MsgComparePopEmailMsgs()
+	{
+	// To delete each element in the array
+	for(TInt i=0; i < iExpResults.Count(); i++)
+		{
+		CExpPop3MailInfo* pExp = iExpResults[i];
+		delete pExp;
+		pExp=NULL;
+		}
+	iExpResults.Reset();
+	iExpResults.Close();
+
+	delete iSentSelectionList;
+	iSentSelectionList=NULL;
+	delete iInboxSelectionList;
+	iInboxSelectionList=NULL;
+	}
+
+
+/**
+doTestStepL()
+Performs the comparison of POP messages
+
+@return
+Returns the teststep result.
+*/
+TVerdict CT_MsgComparePopEmailMsgs::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: Compare Pop Email Msgs"));
+		
+	if(LoadParametersL())
+		{
+		User::LeaveIfError(iFs.Connect());
+		CleanupClosePushL(iFs);
+		
+			// Normally do not push an object that is a data member of another object.
+			// But in this case we want to close early if we get a leave.
+			// Otherwise the iFs would be open till the thread had begun to die.
+		if(TestStepResult() == EPass)
+			{
+			CMsvEntry* recvMsvEntry = iSharedDataPOP.iSession->GetEntryL(KMsvRootIndexEntryId);
+			CleanupStack::PushL(recvMsvEntry);
+			CMsvEntry* sentMsvEntry = iSharedDataPOP.iSession->GetEntryL(KMsvRootIndexEntryId);
+			CleanupStack::PushL(sentMsvEntry);
+
+			for(TInt i = 0;i < iInboxSelectionList->Count();i++)
+				{
+				recvMsvEntry->SetEntryL(iInboxSelectionList->At(i));
+				TMsvEntry recvEntry = recvMsvEntry->Entry();
+				for(TInt j = 0;j < iSentSelectionList->Count();j++)
+					{
+					sentMsvEntry->SetEntryL(iSentSelectionList->At(j));
+					TMsvEntry sentEntry = sentMsvEntry->Entry();
+					if(recvEntry.iDescription.Compare(sentEntry.iDescription) == 0) 
+						{
+						CExpPop3MailInfo* pExpMailInfo = NULL;
+						for(int k = 0;k < iExpResults.Count();k++)
+							{
+							if(iExpResults[k]->GetDescription().Compare(recvEntry.iDescription) == 0)
+								{
+								pExpMailInfo =  iExpResults[k];
+								break;
+								}
+							}
+						if(! pExpMailInfo)
+							{
+							ERR_PRINTF2(_L("Test %d failed could not retrieve expected mail info"), j+1);
+							SetTestStepResult(EFail);
+							break;
+							}
+
+						if(! DoCompareL(recvEntry, *pExpMailInfo, sentEntry))
+							{
+							INFO_PRINTF2(_L("Test %d failed"), j + 1);
+							SetTestStepResult(EFail);
+							}														
+						}
+					}
+				}
+			CleanupStack::PopAndDestroy(2, recvMsvEntry); // recvMsvEntry, sentMsvEntry
+			}		
+		CleanupStack::PopAndDestroy();
+		}		
+	INFO_PRINTF1(_L("T_ComparePopEmailMsgs Completed"));
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_ComparePopSettings.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,310 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// ComparePopSettings
+// [Paramaters]
+// PopAccountName		:		Name of the Pop account
+// ConfigFileName		:		Config file from which the Pop account settings are read 
+// ComparePopSettings is intended to compare the Pop account settings.
+// 
+//
+
+
+
+/**
+ @file cexppop3mailinfo.h
+*/
+
+
+// User includes
+#include "T_ComparePopSettings.h"
+#include <t_utilsconfigfileparserutility.h>
+#include <t_utilsreademailsettingsfromconfigfile.h>
+#include <t_utilscentralrepository.h>
+
+
+// Epoc includes
+#include <cemailaccounts.h>
+#include <iapprefs.h>
+#include <pop3set.h>
+#include <smtpset.h>
+
+
+// Literals Used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KPopConfigFileName,"PopConfigFileName");
+_LIT(KMatchExpected,"MatchExpected");
+
+
+/**
+CT_MsgComparePopSettings()
+Constructor - Initializes the data members.
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgComparePopSettings::CT_MsgComparePopSettings(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgSyncStepPOP(aSharedDataPOP) 
+	{
+	SetTestStepName(KComparePopSettings);
+	}
+
+
+/**
+~CT_MsgComparePopSettings
+Destructor
+*/
+CT_MsgComparePopSettings::~CT_MsgComparePopSettings()
+	{
+	}
+
+
+/**
+doTestStepL()
+Reads the Pop account name and config file name from the ini file
+Compares the settings of the Imap account.
+  
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgComparePopSettings::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : ComparePopSettings"));
+	// Read the POP account name from the ini file
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("PopAccount Name is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		// Retrieving the Pop service Id for the given Pop account
+		TMsvId popServiceId = KMsvNullIndexEntryId;
+		TRAPD(err,popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName));
+		INFO_PRINTF2(_L("Pop service id is %d"),popServiceId);
+		
+		TBool matchExpected = ETrue;
+		GetBoolFromConfig(ConfigSection(), KMatchExpected, matchExpected);
+		
+		TVerdict result = EPass;
+		TPtrC configFileName;
+		
+		if(popServiceId == KMsvNullIndexEntryId)
+			{
+			INFO_PRINTF1(_L("Invalid POP account name is specified"));
+			result = EFail;	
+			}
+		else
+			{
+			if(!GetStringFromConfig(ConfigSection(), KPopConfigFileName, configFileName))
+				{
+				ERR_PRINTF1(_L("Configuration file path is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
+
+				// Creating the first set of settings objects
+				CImPop3Settings* popSettings1 = new(ELeave) CImPop3Settings();
+				CleanupStack::PushL(popSettings1);
+				
+				CImIAPPreferences* popIapPrefs1 = CImIAPPreferences::NewLC();
+				
+				CImSmtpSettings* smtpSettings1 = new(ELeave) CImSmtpSettings();
+				CleanupStack::PushL(smtpSettings1);
+
+				CImIAPPreferences* smtpIapPrefs1 = CImIAPPreferences::NewLC();
+				
+				// Creating the second set of settings objects	
+				CImPop3Settings* popSettings2= new(ELeave) CImPop3Settings();
+				CleanupStack::PushL(popSettings2);
+				
+				CImIAPPreferences* popIapPrefs2 = CImIAPPreferences::NewLC();
+				
+				CImSmtpSettings* smtpSettings2 = new(ELeave) CImSmtpSettings();
+				CleanupStack::PushL(smtpSettings2);
+
+				CImIAPPreferences* smtpIapPrefs2 = CImIAPPreferences::NewLC();
+					
+				emailAccounts->PopulateDefaultPopSettingsL(*popSettings2, *popIapPrefs2);
+				emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings2, *smtpIapPrefs2);
+					
+				TPopAccount popAccount;
+				emailAccounts->	GetPopAccountL(popServiceId, popAccount);
+					
+				TRAPD(error1, LoadAccountSettingsL(*emailAccounts,popAccount,
+					*popSettings1,*popIapPrefs1,*smtpSettings1,*smtpIapPrefs1));
+				
+				if(error1 != KErrNone)
+					{
+					ERR_PRINTF2(_L("LoadPOPPSettingsL Failed with error code %d"), error1);
+					result = EFail;
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					if(configFileName.CompareF(_L("none")) != 0)
+						{
+						TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(configFileName, *popSettings2, *popIapPrefs2));
+						if(err)
+							{	
+							ERR_PRINTF2(_L("Failure while setting the Pop setting parameters, failed with error %d"), err);
+							SetTestStepResult(EFail);															  
+							}
+						else
+							{
+							TRAPD(error, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(configFileName, *smtpSettings2, *smtpIapPrefs2));
+							if(error)
+								{
+								ERR_PRINTF2(_L("Failure while setting the SMTP setting parameters, failed with error %d"), error);
+								SetTestStepResult(EFail);															  
+								}							
+							}							
+						}
+					if(TestStepResult() == EPass)
+						{
+						result = CompareSettings(*popSettings1 , *popSettings2 ,
+											*smtpSettings1,*smtpSettings2,
+											*popIapPrefs1,*popIapPrefs2,
+											*smtpIapPrefs1,*smtpIapPrefs2);
+						}
+					}
+				CleanupStack::PopAndDestroy(9,emailAccounts);
+					
+				}				
+			}
+
+		// if the parameters did not match and we expected them to then fail the test
+		if(result == EPass && matchExpected)
+			{
+			INFO_PRINTF1(_L("*********Passed As Expected*******"));
+			SetTestStepResult(EPass);
+			}
+		else if(result == EFail && !matchExpected)
+			{
+			INFO_PRINTF1(_L("*******Failed as Expected********"));
+			SetTestStepResult(EPass); // This is required as some checks where it will fail, at that pt teststep might have been set to fail
+			}
+		else
+			{
+			ERR_PRINTF1(_L("Pop settings Comparison Failed"));
+			SetTestStepResult(EFail);					
+			}
+		INFO_PRINTF1(_L("ComparePopSettings completed"));
+		}
+	return TestStepResult();
+	}
+	
+/**
+CompareSettings()
+Compares the two sets of POP settings, IAPPrefernces, and SMTP settings.
+  
+@param aPopSettings1
+An object of type CImPop3Settings
+
+@param aPopSettings2
+An object of type CImPop3Settings
+
+@param aPopIapPrefs1
+An object of type CImIAPPreferences
+
+@param aPopIapPrefs2
+An object of type CImIAPPreferences
+
+@param aSmtpIapPrefs1
+An object of type CImIAPPreferences
+
+@param aSmtpIapPrefs2
+An object of type CImIAPPreferences
+
+@param aSmtpSettings
+An object of type CImSmtpSettings
+
+@param aSmtpIapSettings
+An object of type CImIAPPreferences
+
+@return
+Returns EPass if exactly the same for all values in the two sets of parameters.
+Returns EFail if any value is different between the two sets of parameters.
+*/
+TVerdict CT_MsgComparePopSettings::CompareSettings(CImPop3Settings& aPopSettings1, CImPop3Settings& aPopSettings2,
+						 CImSmtpSettings& aSmtpSettings1,CImSmtpSettings& aSmtpSettings2, CImIAPPreferences& aPopIapPrefs1,
+							CImIAPPreferences& aPopIapPrefs2, CImIAPPreferences& aSmtpIapPrefs1, CImIAPPreferences& aSmtpIapPrefs2)
+	{
+	TVerdict result = EPass;
+	if (!(aPopSettings1 == aPopSettings2))   
+		{
+		// failed
+		ERR_PRINTF1(_L("Pop3 Settings objects do not match !"));
+		result = EFail;
+		}
+	else if (!(aSmtpSettings1 == aSmtpSettings2))
+		{
+		// failed
+		ERR_PRINTF1(_L("SMTP Settings objects do not match !"));
+		result = EFail;
+		}
+	else if (!CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(aPopIapPrefs1, aPopIapPrefs2))
+		{
+		// failed
+		ERR_PRINTF1(_L("Pop3 IAP Preference objects do not match !"));
+		result = EFail;
+		}
+	else if (!CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(aSmtpIapPrefs1, aSmtpIapPrefs2))
+		{
+		// failed
+		ERR_PRINTF1(_L("SMTP IAP Preference objects do not match !"));
+		result = EFail;
+		}
+	
+	return result;
+	}
+	
+/**
+LoadAccountSettingsL()
+This function loads the IMAP and SMTP settings object from the IMAP account given
+
+@param aEmailAccount
+An object of type CEmailAccounts
+
+@param aAccount
+An object of type TPopAccount
+
+@param aPopSettings
+An object of type CImPop3Settings
+
+@param aPopIapSettings
+An object of type CImIAPPreferences
+
+@param aSmtpSettings
+An object of type CImSmtpSettings
+
+@param aSmtpIapSettings
+An object of type CImIAPPreferences
+
+@return : void
+*/	
+void CT_MsgComparePopSettings::LoadAccountSettingsL(CEmailAccounts& aEmailAccount, const TPopAccount& aAccount, CImPop3Settings& aPopSettings, 
+		CImIAPPreferences& aPopIapSettings,CImSmtpSettings& aSmtpSettings, CImIAPPreferences& aSmtpIapSettings)
+	{
+	aEmailAccount.LoadPopSettingsL(aAccount, aPopSettings);
+	aEmailAccount.LoadPopIapSettingsL(aAccount, aPopIapSettings);
+	
+	TSmtpAccount smtpAccount;
+	aEmailAccount.GetSmtpAccountL(aAccount.iSmtpService, smtpAccount);
+	aEmailAccount.LoadSmtpSettingsL(smtpAccount, aSmtpSettings);
+	aEmailAccount.LoadSmtpIapSettingsL(smtpAccount, aSmtpIapSettings);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_ConnectPop3Server.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,180 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// ConnectPop3Server
+// [Paramaters]
+// PopAccountName			<input>	: Name of the Pop account
+// Connects to the Pop3 Server
+// [APIs Used]
+// CMsvEntry::SetEntryL
+// CMsvEntrySelection::AppendL
+// CPop3ClientMtm::InvokeAsyncFunctionL
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+// User Includes
+#include "T_ConnectPop3Server.h"
+#include <t_utilscentralrepository.h>
+
+
+// Epoc includes
+#include <miutset.h>
+#include <pop3cmds.h>
+#include <mtclbase.h>
+#include <pop3set.h>
+
+// Literals Used
+_LIT(KPopAccountName,"PopAccountName");
+
+const TInt KMaxLenghtOfChar = 1;
+
+/**
+CT_MsgConnectPop3Server()
+Sets the teststep name to KConnectPop3Server
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgConnectPop3Server::CT_MsgConnectPop3Server(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgAsyncStepPOP(aSharedDataPOP) 
+,	iOperation(NULL)
+	{
+	SetTestStepName(KConnectPop3Server);
+	}
+
+/**
+NewL()
+Allocates and creates a new CT_MsgConnectPop3Server object
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+
+@leave KErrNoMemory
+@return
+Returns pointer to an object of CT_MsgComparePopEmailMsgs
+*/
+CT_MsgConnectPop3Server* CT_MsgConnectPop3Server::NewL(CT_MsgSharedDataPop& aSharedDataPOP)
+	{
+	CT_MsgConnectPop3Server* self = new(ELeave) CT_MsgConnectPop3Server(aSharedDataPOP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 // Call CT_AsyncStep::ConstructL()
+	CleanupStack::Pop(self);
+	return self;
+	}		
+
+
+/**
+~CT_MsgConnectPop3Server()
+Destructor
+*/
+CT_MsgConnectPop3Server::~CT_MsgConnectPop3Server()
+	{
+	delete iOperation;
+	iOperation=NULL;
+	}
+
+
+/**
+ProgressL()
+
+@param
+*/
+void CT_MsgConnectPop3Server::ProgressL(TBool bFinal)
+	{
+	//	TODO
+	if (bFinal)
+		{
+		//	Display final progress iOperation
+		}
+	else
+		{
+		//	Display current progress iOperation
+		}
+	}
+
+
+/**
+CancelStep()
+
+@param
+*/
+void CT_MsgConnectPop3Server::CancelStep()
+	{
+	iOperation->Cancel();
+	}
+
+
+/**
+doTestStepL()
+It establishes connection with the Pop server using a POP account.
+The account is identified by the account name that is read from the INI file.
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgConnectPop3Server::doTestStepL()
+	{	
+	INFO_PRINTF1(_L(" Test Step : ConnectPop3Server"));
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("Pop Account Name is not specified"));
+		SetTestStepResult(EFail);
+		}
+
+	else
+		{
+		// Retrieving the Pop service Id for the given Pop account
+		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+		INFO_PRINTF2(_L("Pop service id is %d"),popServiceId);
+
+		// Change the current context
+		iSharedDataPOP.iMtm->SwitchCurrentEntryL(popServiceId);
+
+		CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+		CleanupStack::PushL(selection);
+
+		// Appends the popServiceId onto the end of the array
+		selection->AppendL(popServiceId);
+		
+		TBuf8<KMaxLenghtOfChar> param;
+
+		CT_MsgActive&	active=Active();
+		// Attempts to connect to the Pop3 Service
+		iOperation = iSharedDataPOP.iMtm->InvokeAsyncFunctionL(KPOP3MTMConnect,*selection,param, active.iStatus);
+
+		active.Activate();
+		CActiveScheduler::Start();
+	
+		// Get the error code from TPop3Progress
+		TPop3Progress temp;
+		TPckgC<TPop3Progress> paramPack(temp);
+		paramPack.Set(iOperation->ProgressL());
+		TPop3Progress progress=paramPack();
+		SetTestStepError(progress.iErrorCode);
+
+		delete iOperation;
+		iOperation=NULL;
+		
+		CleanupStack::PopAndDestroy(selection); //operation,selection
+	//	User::LeaveIfError(active.Result());
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_CopyPopSelection.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,250 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CopyPopSelection
+// [Paramaters]
+// PopAccountName				:	Name of the Pop account
+// TargetFolderName				:   Name of the target folder to which the entries need to be copied 				
+// Copies the entries to the target.
+// [APIs Used]
+// CMsvEntry::SetEntryL
+// CMsvEntry::CopyL
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+// User includes
+#include "T_CopyPopSelection.h"
+#include <t_utilscentralrepository.h>
+#include <t_utils.h>
+#include <t_utilsenumconverter.h>
+#include "T_MsgSharedDataPop.h"
+
+
+// Literals Used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KTargetFolderName,"TargetFolderName");
+_LIT(KMove, "Move");
+_LIT(KCopyWithinService, "CopyWithinService");
+
+/**
+CT_MsgCopyPopSelection()
+Sets the teststep name to KCopyPopSelection
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgCopyPopSelection::CT_MsgCopyPopSelection(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgAsyncStepPOP(aSharedDataPOP) 
+,	iOperation(NULL)
+	{
+	SetTestStepName(KCopyPopSelection);
+	}
+
+/**
+NewL()
+Allocates and creates a new CT_MsgCopyPopSelection object
+  
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+
+@leave KErrNoMemory
+@return
+Returns pointer to an object of CT_MsgComparePopEmailMsgs
+*/
+CT_MsgCopyPopSelection* CT_MsgCopyPopSelection::NewL(CT_MsgSharedDataPop& aSharedDataPOP)
+	{
+	CT_MsgCopyPopSelection* self = new(ELeave) CT_MsgCopyPopSelection(aSharedDataPOP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 // Call CT_AsyncStep::ConstructL()
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+
+/**
+~CT_MsgCopyPopSelection()
+Destructor
+*/
+CT_MsgCopyPopSelection::~CT_MsgCopyPopSelection()
+	{
+	delete iOperation;
+	iOperation=NULL;
+	}
+
+
+/**
+ProgressL()
+
+@param
+*/
+void CT_MsgCopyPopSelection::ProgressL(TBool bFinal)
+	{
+	//	TODO
+	if (bFinal)
+		{
+		//	Display final progress iOperation
+		}
+	else
+		{
+		//	Display current progress iOperation
+		}
+	}
+
+
+/**
+CancelStep()
+
+*/
+void CT_MsgCopyPopSelection::CancelStep()
+	{
+	iOperation->Cancel();
+	}
+
+
+/**
+doTestStepL()
+A connection with the POP server is established in the doTestStepPreambleL of the 
+base class. Reads the Pop account name from the ini file. It obtains a selection of
+the entires under POP account given. It copies these entries into the specified target folder.
+ 
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgCopyPopSelection::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep : CopyPopSelection"));
+	// Read the POP account name from the ini file
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("Pop Account Name is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		// Retrieving the Pop service Id for the given Pop account
+		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+		INFO_PRINTF2(_L("Pop service id is %d"),popServiceId);
+
+		if(popServiceId == KMsvNullIndexEntryId)
+			{
+			ERR_PRINTF1(_L("Invalid POP account name specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			TMsvId targetFolderId = KErrNotFound;
+			TBool copyWithinService = EFalse;
+			GetBoolFromConfig(ConfigSection(), KCopyWithinService, copyWithinService);
+
+			if (!copyWithinService)
+				{
+				TPtrC targetFolderName;
+				if(!GetStringFromConfig(ConfigSection(), KTargetFolderName, targetFolderName))
+					{
+					ERR_PRINTF1(_L("Target Folder is not specified"));
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					// Retrieves the folder Id based on the local folder name read from the ini file
+					targetFolderId = CT_MsgUtilsEnumConverter::FindFolderIdByName(targetFolderName);
+					if(targetFolderId == KErrNotFound)
+						{
+						ERR_PRINTF1(_L("Invalid local folder name specified"));
+						SetTestStepResult(EFail);
+						}
+					}
+				}
+
+			if (copyWithinService || targetFolderId != KErrNotFound)
+				{
+				// Get a selection of the children entries for the Pop account
+				CMsvEntrySelection* selection =  CT_MsgUtils::CreateChildrenSelectionL(iSharedDataPOP.iSession,
+																			popServiceId);
+				CleanupStack::PushL(selection);
+					
+				// Check if there are no entries under the remote folder 
+				TInt count = selection->Count();
+				if (count == 0)
+					{
+					User::Leave(KErrArgument);
+					}
+				// Fetch the Id of the first entry
+				TMsvId entryId = (*selection)[0];
+
+				// Creates a new CMsvEntry for the specified entry ID.
+				CMsvEntry* entry = CMsvEntry::NewL(*iSharedDataPOP.iSession,entryId,TMsvSelectionOrdering());
+				CleanupStack::PushL(entry);
+						
+				// Sets the context to the parent of the specified entry.
+				entry->SetEntryL(entryId);
+				entry->SetEntryL(entry->Entry().Parent());
+
+				TBool isMove = EFalse;
+				if(GetBoolFromConfig(ConfigSection(), KMove, isMove))
+					{
+					INFO_PRINTF1(_L("Is move"));
+					}
+
+				CT_MsgActive&	active=Active();
+
+				if (copyWithinService)
+					{
+					if (isMove)
+						{
+						iOperation = entry->MoveL(*selection,popServiceId, active.iStatus);
+						}
+					else
+						{
+						iOperation = entry->CopyL(*selection,popServiceId, active.iStatus);						
+						}
+					}
+				else
+					{
+					if (isMove)
+						{
+						iOperation = entry->MoveL(*selection,targetFolderId, active.iStatus);
+						}
+					else
+						{
+						iOperation = entry->CopyL(*selection,targetFolderId, active.iStatus);						
+						}
+					}
+
+				active.Activate();
+				CActiveScheduler::Start();
+
+				// Get the error code from TPop3Progress
+				TPop3Progress temp;
+				TPckgC<TPop3Progress> paramPack(temp);
+				paramPack.Set(iOperation->ProgressL());
+				TPop3Progress progress=paramPack();
+				SetTestStepError(progress.iErrorCode);
+
+				delete iOperation;
+				iOperation=NULL;
+				CleanupStack::PopAndDestroy(2,selection); //operation,entry,selection
+				User::LeaveIfError(active.Result());
+				}		
+			}
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_CreatePopAccount.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,157 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CreatePopAccount
+// [Paramaters]
+// PopAccountName			: Name of the pop account which needs to be created
+// SettingsFileName		: Config file from which the pop account settings are read 
+// Creates a POP account in the Central Repository with the specified name and configuration settings file.
+// The settings file includes both POP settings,SMTP settings and IAP preference settings for both POP and SMTP.
+// [APIs Used]
+// CEmailAccounts::CreatePopAccountL
+// CEmailAccounts::CreateSmtpAccountL
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User include
+#include "T_CreatePopAccount.h"
+#include <t_utilsreademailsettingsfromconfigfile.h>
+
+
+// epoc includes
+#include <iapprefs.h>
+#include <smtpset.h>
+#include <pop3set.h>
+#include <cemailaccounts.h>
+
+
+// Literals used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KPopConfigFileName,"PopConfigFileName");
+_LIT(KEmailAdd, "EmailAdd");
+
+/**
+CT_MsgCreatePopAccount()
+Sets the teststep name to KCreatePopAccount
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgCreatePopAccount::CT_MsgCreatePopAccount(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgSyncStepPOP(aSharedDataPOP) 
+	{
+	SetTestStepName(KCreatePopAccount);
+	}
+
+
+/**
+~CT_MsgCreatePopAccount()
+Destructor
+*/
+CT_MsgCreatePopAccount::~CT_MsgCreatePopAccount()
+	{
+	}
+
+
+/**
+doTestStepL()
+Reads the Pop account name and the settings file name from the ini file.
+Creates an Pop account by reading the settings from the given settings file
+  
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgCreatePopAccount::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: Create Pop Account"));
+	// Read Pop Account Name from ini file
+	TPtrC popAccountName;
+	TPtrC configFileName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("Pop Account name not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		// Read the configuration file name
+		if(!GetStringFromConfig(ConfigSection(), KPopConfigFileName, configFileName))
+			{
+			ERR_PRINTF1(_L("Configuration file path is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			CEmailAccounts *emailAccounts = CEmailAccounts::NewLC();
+
+			// Create objects requried for POP account
+			CImIAPPreferences *popIapPreferences = CImIAPPreferences::NewLC();
+			
+			CImPop3Settings *popSettings = new (ELeave) CImPop3Settings;
+			CleanupStack::PushL(popSettings);
+
+			// Create objects requried for SMTP account
+			CImIAPPreferences *smtpIapPreferences = CImIAPPreferences::NewLC();
+			
+			CImSmtpSettings *smtpSettings = new (ELeave) CImSmtpSettings;
+			CleanupStack::PushL(smtpSettings);
+		
+			// Set the default POP and SMTP settings
+			emailAccounts->PopulateDefaultPopSettingsL(*popSettings, *popIapPreferences);
+			emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings, *smtpIapPreferences);
+
+			// If the setting file name is provided as input, then read the Pop and Smtp settings from the config file
+			if(configFileName.CompareC(_L("none")) != 0)
+				{
+			
+				TPtrC ptrEmailAdd = KNone();
+				if(!GetStringFromConfig(ConfigSection(), KEmailAdd, ptrEmailAdd))
+					{
+					INFO_PRINTF1(_L("Email Address not specified"));
+					}
+				
+				TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(configFileName, *popSettings, *popIapPreferences, ptrEmailAdd));
+				if(err)
+					{	
+					ERR_PRINTF2(_L("Failure while setting the POP/SMTP setting parameters, failed with error %d"), err);
+					SetTestStepResult(EFail);															  
+					}
+				else
+					{
+					TRAPD(error, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(configFileName, *smtpSettings, *smtpIapPreferences, ptrEmailAdd));
+					if(error)
+						{
+						ERR_PRINTF2(_L("Failure while setting the SMTP setting parameters, failed with error %d"), error);
+						SetTestStepResult(EFail);															  
+						}
+					}
+				}
+			if(TestStepResult() == EPass)
+				{
+				TPopAccount popAccount = emailAccounts->CreatePopAccountL(popAccountName, *popSettings,*popIapPreferences,EFalse);
+				TSmtpAccount smtpAccount = emailAccounts->CreateSmtpAccountL(popAccount, *smtpSettings, *smtpIapPreferences, EFalse);
+				emailAccounts->SetDefaultSmtpAccountL(smtpAccount);	
+				}
+			CleanupStack::PopAndDestroy(5,emailAccounts); // smtpSettings, smtpIapPreferences, popSettings, popIapPreferences, emailAccounts  
+			}
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_CreatePopAccountWithoutSmtp.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,116 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CreatePopAccountWithoutSmtp
+// [Paramaters]
+// PopAccountName			:Name of the Pop account.
+// PopConfigFileName		:Config file from which the Pop account settings are read.
+// Creates a POP account in the Central Repository with the specified name using the 
+// settings read from the config file.
+// 
+//
+
+//User includes
+#include "T_CreatePopAccountWithoutSmtp.h"
+#include <t_utilsreademailsettingsfromconfigfile.h>
+
+//Epoc inlcudes
+#include <cemailaccounts.h>
+#include <iapprefs.h>
+#include <pop3set.h>
+
+//Literals used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KPopConfigFileName,"PopConfigFileName");
+
+/**
+  Function : CT_MsgCreatePopAccountWithoutSmtp
+  Description : Constructor
+  @param : aSharedDataPOP Reference to CT_MsgSharedDataPop
+  @return : N/A
+*/
+CT_MsgCreatePopAccountWithoutSmtp::CT_MsgCreatePopAccountWithoutSmtp(CT_MsgSharedDataPop& aSharedDataPOP)
+:CT_MsgSyncStepPOP(aSharedDataPOP)
+	{
+	SetTestStepName(KCreatePopAccountWithoutSmtp);
+	}
+
+/**
+  Function : ReadIni
+  Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
+  @return : TBool
+*/
+TBool CT_MsgCreatePopAccountWithoutSmtp::ReadIni()
+	{
+	TBool result = ETrue;
+	
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, iPopAccountName))
+		{
+		ERR_PRINTF1(_L("Pop account name is not specified"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+		
+	if(!GetStringFromConfig(ConfigSection(), KPopConfigFileName, iConfigFileName))
+		{
+		ERR_PRINTF1(_L("Configuration file path is not specified"));
+		SetTestStepResult(EFail);
+		}
+		
+	return result;
+	}
+
+/**
+  Function : doTestStepL
+  Description : Reads the Pop account name and the settings file name from the .ini file
+				and then creates a Pop account.
+  @return : TVerdict - Test step result
+*/
+TVerdict CT_MsgCreatePopAccountWithoutSmtp::doTestStepL()
+	{
+	
+	INFO_PRINTF1(_L("Test Step : CreatePopAccountWithoutSmtp"));
+	if(ReadIni())
+		{
+		CEmailAccounts*	emailAccounts = CEmailAccounts::NewLC();
+		
+		// Creates objects requried for POP account
+		CImIAPPreferences *popIapPreferences = CImIAPPreferences::NewLC();
+		CImPop3Settings *popSettings = new (ELeave) CImPop3Settings;
+		CleanupStack::PushL(popSettings);
+
+		// Populates the default POP settings
+		emailAccounts->PopulateDefaultPopSettingsL(*popSettings, *popIapPreferences);
+
+		//If the config file name is provided as input, then reads the POP settings from it
+		if(iConfigFileName.CompareF( _L("none") ) != 0)
+			{
+			TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(iConfigFileName, *popSettings, *popIapPreferences));
+			if(err)
+				{
+				ERR_PRINTF2(_L("Failure while setting the POP settings, failed with error %d"), err);
+				SetTestStepError(err);
+				CleanupStack::PopAndDestroy(3,emailAccounts); // popSettings, popIapPreferences, emailAccounts
+				return TestStepResult();														  
+				}
+			if(TestStepResult() == EPass)
+				{
+				// Creates the POP account for the name specified and for the settings objects
+				TPopAccount popAccount = emailAccounts->CreatePopAccountL(iPopAccountName, *popSettings,*popIapPreferences,EFalse);
+				}
+			}
+		CleanupStack::PopAndDestroy(3,emailAccounts); // popSettings, popIapPreferences, emailAccounts
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_DeleteAllPopChildren.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,188 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// DeleteAllPopChildren
+// [Paramaters]
+// PopAccountName			:			Name of the Pop Account
+// [Action Description]
+// Deletes all children entries for the remote Pop account
+// [APIs Used]
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+//User Includes
+#include "T_DeleteAllPopChildren.h"
+#include <t_utilsdeleteallchildren.h>
+#include <t_utilscentralrepository.h>
+#include "T_MsgSharedDataPop.h"
+
+
+//epoc includes
+#include <barsc.h>
+#include <bautils.h>
+#include <msgs.rsg>
+
+
+// Literals Used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KBlockDelete, "BlockDelete");
+
+
+/**
+CT_MsgDeleteAllPopChildren()
+Sets the teststep name to KDeleteAllPopChildren
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgDeleteAllPopChildren::CT_MsgDeleteAllPopChildren(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgAsyncStepPOP(aSharedDataPOP)
+,	iUtil(NULL)
+	{
+	SetTestStepName(KDeleteAllPopChildren);
+	}
+
+
+/**
+NewL()
+Allocates and creates a new CT_MsgDeleteAllPopChildren object
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+
+@return
+Returns pointer to an object of CT_MsgDeleteAllPopChildren
+*/
+CT_MsgDeleteAllPopChildren* CT_MsgDeleteAllPopChildren::NewL(CT_MsgSharedDataPop& aSharedDataPOP)
+	{
+	CT_MsgDeleteAllPopChildren* self = new(ELeave) CT_MsgDeleteAllPopChildren(aSharedDataPOP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 // Call CT_AsyncStep::ConstructL()
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+
+/**
+~CT_MsgDeleteAllPopChildren()
+Destructor
+*/
+CT_MsgDeleteAllPopChildren::~CT_MsgDeleteAllPopChildren()
+	{
+	if(iUtil!=NULL)
+		{
+		delete iUtil;
+		iUtil=NULL;
+		}
+	}
+
+
+/**
+ProgressL()
+
+@param
+*/
+void CT_MsgDeleteAllPopChildren::ProgressL(TBool bFinal)
+	{
+	//	TODO
+	if (bFinal)
+		{
+		//	Display final progress iUtil
+		}
+	else
+		{
+		//	Display current progress iUtil
+		}
+	}
+
+
+/**
+CancelStep()
+
+@param
+*/
+void CT_MsgDeleteAllPopChildren::CancelStep()
+	{
+	//	TODO cancel iUtil
+	}
+
+
+/**
+doTestStepL()
+Reads the Pop account name from the ini file. It obtains a selection of the 
+enries under the account and calls theT_UtilsDeleteAllChildren to delete them
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgDeleteAllPopChildren::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : DeleteAllChildren "));
+	// Read the POP account name from the ini file
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("Pop Account Name is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		// Retrieving the Pop service Id for the given Pop account
+		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+		INFO_PRINTF2(_L("Pop service id is %d"),popServiceId);
+		if(popServiceId == KMsvNullIndexEntryId)
+			{
+			ERR_PRINTF1(_L("Invalid POP account name specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			if(iUtil==NULL)
+				{
+				iUtil = new (ELeave) CT_MsgUtilsDeleteAllChildren(iSharedDataPOP.iSession,popServiceId);
+				}
+
+			CT_MsgActive&	active=Active();
+			// Deletes all the entries under the remote folder
+
+			TBool blockDelete = EFalse;
+			GetBoolFromConfig(ConfigSection(), KBlockDelete, blockDelete);
+			if (blockDelete)
+				{
+				INFO_PRINTF1(_L("Using block delete"));
+				}
+
+			iUtil->StartL(blockDelete, active.iStatus);
+			active.Activate();
+			CActiveScheduler::Start();
+			delete iUtil;
+			iUtil=NULL;
+			
+			TInt err = active.Result();
+			if (err != KErrNone)
+				{
+				SetTestStepResult(EFail);
+				SetTestStepError(err);
+				}
+			}
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_DeletePopAccount.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,136 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// DeletePopAccount
+// [Paramaters]
+// PopAccountName		<input>	: Name of the Pop account to be Deleted
+// For deleteing all the Pop accounts "all" can be used 
+// and it is case insensitive.
+// [Test Step Description]
+// Deletes the Pop account(s) in the Central Repository 
+// [APIs Used]
+// CEmailAccounts::DeletePopAccountL
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User include
+#include "T_DeletePopAccount.h"
+
+
+// epoc inlcudes
+#include<cemailaccounts.h>
+
+// Literals used
+_LIT(KPopAccountName,"PopAccountName");
+
+
+/**
+CT_MsgDeletePopAccount()
+Sets the teststep name to KDeletePopAccount
+  
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgDeletePopAccount::CT_MsgDeletePopAccount(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgSyncStepPOP(aSharedDataPOP) 
+	{
+	SetTestStepName(KDeletePopAccount);
+	}
+
+/**
+~CT_MsgDeletePopAccount()
+Destructor
+*/
+CT_MsgDeletePopAccount::~CT_MsgDeletePopAccount()
+	{
+	}
+
+
+
+/**
+doTestStepL()
+Reads the POP account name from the ini file. If ALL string is mentioned in the .ini file 
+it deletes all the IMAP accounts, Else deletes the IMAP account whose name is 
+mentioned in the ini file
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgDeletePopAccount::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: Delete Pop Account"));
+	TPtrC popAccountName;
+	// Read Pop Account Name from ini file
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("Account name not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{	
+		CEmailAccounts* account = CEmailAccounts::NewLC();
+		
+		RArray<TPopAccount> arrayPop3Accounts;
+		CleanupClosePushL(arrayPop3Accounts);
+		account->GetPopAccountsL(arrayPop3Accounts);
+		TInt count=arrayPop3Accounts.Count();
+		
+		TBuf<12> temp(popAccountName);
+		temp.UpperCase();	// Making case insensitive
+		if(temp.CompareC(_L("ALL")) == 0)
+			{
+			INFO_PRINTF2(_L("Deleting all accounts. Total = %d"), count);
+			for(TInt i=0; i<count; i++)
+				{
+				TPopAccount id = arrayPop3Accounts[i];
+				account->DeletePopAccountL(id);
+				}
+			}			
+		else 
+			{
+			TBool deleteFlag = EFalse;
+			for(TInt i = 0; i < count; i++)
+				{
+				if(popAccountName.CompareC(arrayPop3Accounts[i].iPopAccountName) == 0)
+					{
+					account->DeletePopAccountL(arrayPop3Accounts[i]);
+					// Just ensure that if we try to delete it again we hopefuly get an error
+					// or can see that it has been deleted.
+					arrayPop3Accounts.Remove(i);
+					deleteFlag = ETrue;
+					break;					
+					}
+				}
+			if(deleteFlag)
+				{
+				INFO_PRINTF2(_L("Pop acount \" %S \" deleted"), &popAccountName);	
+				}
+			else
+				{
+				ERR_PRINTF2(_L("Pop acount \" %S \" not found"), &popAccountName);
+				SetTestStepResult(EFail);
+				User::Leave(KErrNotFound);
+				}
+			}
+		CleanupStack::PopAndDestroy(2, account);	//arrayPop3Accounts,account
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_DisconnectPop3Server.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,165 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// DisConnectPop3Server
+// [Paramaters]
+// PopAccountName			<input>	: Name of the Pop account
+// DisConnects to the Pop3 Server
+// [APIs Used]
+// CMsvEntry::SetEntryL
+// CMsvEntrySelection::AppendL
+// CPop3ClientMtm::InvokeAsyncFunctionL
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+// User Includes
+#include "T_DisConnectPop3Server.h"
+#include <t_utilscentralrepository.h>
+
+
+// Epoc includes
+#include <pop3cmds.h>
+
+
+// Literals Used
+_LIT(KPopAccountName,"PopAccountName");
+const TInt KMaxLenghtOfChar= 1;
+
+/**
+CT_MsgDisConnectPop3Server()
+Sets the teststep name to KDisConnectPop3Server
+  
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgDisConnectPop3Server::CT_MsgDisConnectPop3Server(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgAsyncStepPOP(aSharedDataPOP) 
+,	iOperation(NULL)
+	{
+	SetTestStepName(KDisConnectPop3Server);
+	}
+
+
+/**
+NewL()
+Allocates and creates a new CT_MsgDisConnectPop3Server object 
+  
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+
+@leave KErrNoMemory
+@return
+Returns pointer to an object of CT_MsgDisConnectPop3Server
+*/
+CT_MsgDisConnectPop3Server* CT_MsgDisConnectPop3Server::NewL(CT_MsgSharedDataPop& aSharedDataPOP)
+	{
+	CT_MsgDisConnectPop3Server* self = new(ELeave) CT_MsgDisConnectPop3Server(aSharedDataPOP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 // Call CT_AsyncStep::ConstructL()
+	CleanupStack::Pop(self);
+	return self;
+	}		
+
+
+/**
+~CT_MsgDisConnectPop3Server()
+Destructor
+*/
+CT_MsgDisConnectPop3Server::~CT_MsgDisConnectPop3Server()
+	{
+	delete iOperation;
+	iOperation=NULL;
+	}
+
+
+/**
+ProgressL()
+
+@param
+*/
+void CT_MsgDisConnectPop3Server::ProgressL(TBool bFinal)
+	{
+	//	TODO
+	if (bFinal)
+		{
+		//	Display final progress iOperation
+		}
+	else
+		{
+		//	Display current progress iOperation
+		}
+	}
+
+
+/**
+CancelStep()
+
+@param
+*/
+void CT_MsgDisConnectPop3Server::CancelStep()
+	{
+	iOperation->Cancel();
+	}
+
+/**
+doTestStepL()
+Reads the  Pop account name from the ini file. It establishes disconnection with the Pop server.
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgDisConnectPop3Server::doTestStepL()
+	{	
+	INFO_PRINTF1(_L(" Test Step : DisConnectPop3Server"));
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("Pop Account Name is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		// Retrieving the Pop service Id for the given Pop account
+		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+		INFO_PRINTF2(_L("Pop service id is %d"),popServiceId);
+
+		// Change the current context
+		iSharedDataPOP.iMtm->SwitchCurrentEntryL(popServiceId);
+
+		CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+		CleanupStack::PushL(selection);
+
+		// Appends the popServiceId onto the end of the array
+		selection->AppendL(popServiceId);
+		
+		TBuf8<KMaxLenghtOfChar> param;
+
+		// Attempts to DisConnect to the Pop3 Service
+		CT_MsgActive&	active=Active();
+		iOperation = iSharedDataPOP.iMtm->InvokeAsyncFunctionL(KPOP3MTMDisconnect, *selection, param, active.iStatus);
+		active.Activate();
+		CActiveScheduler::Start();
+		delete iOperation;
+		iOperation=NULL;
+		CleanupStack::PopAndDestroy(selection); //operation,selection
+		User::LeaveIfError(active.Result());
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_ModifyPopSettings.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,204 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// ModifyPopSettings
+// [Paramaters]
+// PopAccountName		:		Name of the Pop account
+// ConfigFileName		:		Config file from which the Pop account settings are read 
+// [Test Step Description]
+// ModifyPopSettings Test Action is intended to modify and save the existing settings to CenRep 
+// for the specified Pop account Id
+// [APIs Used]	
+// CEmailAccounts::ModifyPopSettingsL
+// CImPop3Settings::SetServerAddressL
+// CImPop3Settings::SetUserAddressL
+// CImPop3Settings::SetLoginNameL
+// CImPop3Settings::SetPasswordL
+// CImPop3Settings::SetPort
+// CImPop3Settings::SetSecureSockets
+// CImPop3Settings::SetVersion
+// CImPop3Settings::SetFolderPathL
+// CImPop3Settings::SetPathSeparator
+// CImPop3Settings::SetMaxEmailSize
+// CImPop3Settings::SetGetMailOptions
+// CImPop3Settings::SetInboxSynchronisationLimit
+// CImPop3Settings::SetMailboxSynchronisationLimit
+// CImSmtpSettings::SetServerAddressL
+// CImSmtpSettings::SetEmailAddressL
+// CImSmtpSettings::SetBodyEncoding
+// CImSmtpSettings::SetReceiptAddressL
+// CImSmtpSettings::SetRequestReceipts
+// CImSmtpSettings::SetSendMessageOption
+// CImSmtpSettings::SetPort
+// CImSmtpSettings::SetEmailAliasL
+// CImSmtpSettings::SetBodyEncoding
+// CImSmtpSettings::SetDefaultMsgCharSet
+// CImSmtpSettings::SetUserAddress
+// CImSmtpSettings::SetVersion
+// CImIAPPreferences::Version
+// CImIAPPreferences::AddIAPL 
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+
+// User include
+#include "T_ModifyPopSettings.h"
+#include <t_utilsreademailsettingsfromconfigfile.h>
+#include <t_utilscentralrepository.h>
+
+
+
+// epoc inlcudes
+#include <cemailaccounts.h>
+#include <pop3set.h>
+#include <iapprefs.h>
+#include <smtpset.h>
+
+
+
+// Literals used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KPopConfigFileName,"PopConfigFileName");
+
+
+/**
+CT_MsgModifyPopSettings()
+Sets the teststep name to KModifyPopSettings
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgModifyPopSettings::CT_MsgModifyPopSettings(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgSyncStepPOP(aSharedDataPOP) 
+	{
+	SetTestStepName(KModifyPopSettings);
+	}
+
+
+/**
+~CT_MsgModifyPopSettings()
+Destructor
+*/
+CT_MsgModifyPopSettings::~CT_MsgModifyPopSettings()
+	{
+	}
+
+
+/**
+doTestStepL()
+Reads the Pop account name, config file name from the ini file.
+It then modifies the account settings with the settings read from the config file
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgModifyPopSettings::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: ModifyPopSettings"));
+	// Read the Pop account name from the ini file
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("PopAccount Name is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TPtrC configFileName;
+		if(!GetStringFromConfig(ConfigSection(), KPopConfigFileName, configFileName))
+			{
+			ERR_PRINTF1(_L("Configuration file path is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			// Retrieving the Pop service Id for the given Pop account
+			TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+			INFO_PRINTF2(_L("Pop service id is %d"),popServiceId);
+			
+			if(popServiceId == KMsvNullIndexEntryId)
+				{
+				ERR_PRINTF1(_L("Invalid POP account name specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
+
+				CImPop3Settings* popSettings = new(ELeave) CImPop3Settings();
+				CleanupStack::PushL(popSettings);
+				
+				CImIAPPreferences* popIapPrefs = CImIAPPreferences::NewLC();
+				
+				CImSmtpSettings* smtpSettings = new(ELeave) CImSmtpSettings();
+				CleanupStack::PushL(smtpSettings);
+
+				CImIAPPreferences* smtpIapPrefs = CImIAPPreferences::NewLC();				
+				
+				TPopAccount popAccount;
+				emailAccounts->GetPopAccountL(popServiceId, popAccount);
+				
+				emailAccounts->PopulateDefaultPopSettingsL(*popSettings, *popIapPrefs);
+				emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings, *smtpIapPrefs);
+
+				_LIT(KEmailAdd, "EmailAdd");
+				
+				TPtrC ptrEmailAdd;
+				if(!GetStringFromConfig(ConfigSection(), KEmailAdd, ptrEmailAdd))
+					{
+					ERR_PRINTF1(_L("Email Address not specified"));
+					}
+				
+				TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(configFileName, *popSettings, *popIapPrefs, ptrEmailAdd));
+				if(err)
+					{	
+					ERR_PRINTF2(_L("Failure while setting the Pop setting parameters, failed with error %d"), err);
+					SetTestStepResult(EFail);															  
+					}
+				else
+					{
+					TRAPD(error, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(configFileName, *smtpSettings, *smtpIapPrefs, ptrEmailAdd));
+					if(error)
+						{
+						ERR_PRINTF2(_L("Failure while setting the SMTP setting parameters, failed with error %d"), error);
+						SetTestStepResult(EFail);															  
+						}
+					else
+						{												
+						// Save the new settings
+						emailAccounts->SavePopSettingsL(popAccount, *popSettings);
+						emailAccounts->SavePopIapSettingsL(popAccount, *popIapPrefs);
+					
+						TSmtpAccount smtpAccount;
+						emailAccounts->GetSmtpAccountL(popAccount.iSmtpService, smtpAccount);											
+				
+						emailAccounts->SaveSmtpSettingsL(smtpAccount, *smtpSettings);
+						emailAccounts->SaveSmtpIapSettingsL(smtpAccount, *smtpIapPrefs);
+						}
+					}
+				CleanupStack::PopAndDestroy(5, emailAccounts); //smtpIapPrefs,smtpSettings,popIapPrefs,popSettings,emailAccounts
+				}
+			}
+		}
+	return TestStepResult();
+	}
+	
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_ModifyPopSettings2.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,130 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// ModifyPopSettings2
+// [Paramaters]
+// PopAccountName			:Name of the Pop account
+// PopConfigFileName		:Config file from which the Pop account settings are read 
+// ModifyPopSettings2 Test Step is intended to modify existing settings and save to CenRep 
+// for the specified POP account Id
+// 
+//
+
+/* user includes */
+#include "T_ModifyPopSettings2.h"
+#include <t_utilsreademailsettingsfromconfigfile.h>
+#include <t_utilscentralrepository.h>
+
+/* epoc inlcudes */
+#include <cemailaccounts.h>
+#include <pop3set.h>
+#include <iapprefs.h>
+
+/* Literals used */
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KPopConfigFileName,"PopConfigFileName");
+
+/**
+  Function : CT_MsgModifyPopSettings2
+  Description : Constructor
+  @param : aSharedDataPOP Reference to CT_MsgSharedDataPop
+  @return : N/A
+*/
+CT_MsgModifyPopSettings2::CT_MsgModifyPopSettings2(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgSyncStepPOP(aSharedDataPOP)
+	{
+	SetTestStepName(KModifyPopSettings2);
+	}
+	
+/**
+  Function : ~CT_MsgModifyPopSettings2
+  Description : Destructor
+  @return : N/A
+*/
+CT_MsgModifyPopSettings2::~CT_MsgModifyPopSettings2()
+	{
+	}
+
+/**
+  Function : doTestStepL
+  Description : Reads the Pop account name and config file name from the .ini file
+				 and it then modifies the account with the settings read from the config file.
+  @return : TVerdict - Test step result
+  @leave  : KMsvNullIndexEntryId	Invalid POP account name specified	
+*/
+TVerdict CT_MsgModifyPopSettings2::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: ModifyPopSettings2"));
+	// Read the POP account name from the ini file
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("POP account name is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		// Read the POP Config file name from the ini file
+		TPtrC configFileName;
+		if(!GetStringFromConfig(ConfigSection(), KPopConfigFileName, configFileName))
+			{
+			ERR_PRINTF1(_L("Configuration file path is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			// Retrieving the POP service Id for the given POP account
+			TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+			INFO_PRINTF2(_L("POP service Id is %d"),popServiceId);
+			
+			if(popServiceId == KMsvNullIndexEntryId)
+				{
+				ERR_PRINTF1(_L("Invalid POP account name specified"));
+				SetTestStepResult(EFail);
+				}
+			// Creates the settings object
+			else
+				{
+				CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
+
+				CImPop3Settings* popSettings = new(ELeave) CImPop3Settings();
+				CleanupStack::PushL(popSettings);
+				
+				CImIAPPreferences* popIapPrefs = CImIAPPreferences::NewLC();
+
+				// Loads the settings for the account with the current settings
+				TPopAccount popAccount;
+				emailAccounts->GetPopAccountL(popServiceId, popAccount);
+				emailAccounts->LoadPopSettingsL(popAccount, *popSettings);
+				emailAccounts->LoadPopIapSettingsL(popAccount, *popIapPrefs);
+
+				// Reads the settings from the config file
+				TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(configFileName, *popSettings, *popIapPrefs));
+				if(err)
+					{	
+					ERR_PRINTF2(_L("Failure while setting the POP setting parameters, failed with error %d"), err);
+					SetTestStepError(err);															  
+					}
+				else
+					{
+					// Saves the new settings
+					emailAccounts->SavePopSettingsL(popAccount, *popSettings);
+					emailAccounts->SavePopIapSettingsL(popAccount, *popIapPrefs);
+					}
+				CleanupStack::PopAndDestroy(3, emailAccounts);// popIapPrefs,popSettings,emailAccounts
+				}
+			}
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_MsgAsyncStepPOP.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,41 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [Test Step] :
+// AsyncStepPOP
+// References POP shared data for use by derived test steps.
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+// User includes
+#include "T_MsgAsyncStepPOP.h"
+
+
+/**
+CT_MsgAsyncStepPOP()
+Intialises the shared data
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgAsyncStepPOP::CT_MsgAsyncStepPOP(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgAsyncStep()
+,	iSharedDataPOP(aSharedDataPOP)
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_MsgSharedDataPop.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,88 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+*/
+
+// user include
+#include "T_MsgSharedDataPop.h"
+
+
+// epoc includes
+#include <miutset.h>
+
+
+/**
+NewL()
+Allocates and creates a new CT_MsgSharedDataPop object
+
+@leave KErrNoMemory
+@return
+Returns pointer to an object of CT_MsgComparePopEmailMsgs
+*/
+CT_MsgSharedDataPop* CT_MsgSharedDataPop::NewL()
+	{
+	CT_MsgSharedDataPop* self = new(ELeave) CT_MsgSharedDataPop();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+/**
+  ConstructL()
+  Second phage constructor
+*/
+void CT_MsgSharedDataPop::ConstructL()
+{
+	CT_MsgSharedDataBase::ConstructL();
+	iPeriodic 		= CPeriodic::New(EPriorityHigh);
+ 	iMaxRamValue 	= 0;
+ 	iMinRamValue 	= 0;
+ 	iStartRamValue 	= 0;
+ 	iEndRamValue 	= 0;
+ 	iMark			= ETrue;
+}
+
+/**
+NewMtmL()
+ 
+@return
+Returns a pointer to Client-side MTM object
+*/
+CBaseMtm* CT_MsgSharedDataPop::NewMtmL()	
+	{
+	return iRegistry->NewMtmL(KUidMsgTypePOP3);	
+	}
+
+/**
+CT_MsgSharedDataPop()
+Construstor
+*/
+CT_MsgSharedDataPop::CT_MsgSharedDataPop()
+	{
+	}
+
+/**
+  ~CT_MsgSharedDataPop()
+  Destructor
+*/
+CT_MsgSharedDataPop::~CT_MsgSharedDataPop()
+	{
+	delete iPeriodic;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_MsgSyncStepPOP.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,50 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [Test Step] :
+// MsgSyncStepPOP
+// References POP shared data for use by derived test steps.
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+// User includes
+#include "T_MsgSyncStepPop.h"
+
+
+/**
+CT_MsgSyncStepPOP()
+Constructor
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgSyncStepPOP::CT_MsgSyncStepPOP(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgStep()
+,	iSharedDataPOP(aSharedDataPOP)
+	{
+	}
+
+
+/**
+~CT_MsgSyncStepPOP()
+Destructor
+*/
+CT_MsgSyncStepPOP::~CT_MsgSyncStepPOP()
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_PopInvokeAsyncFunction.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,223 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// PopInvokeAsyncFunction
+// [Parameters]
+// PopAccountName		:		Name of the pop account
+// EmailSize			:		The maximum emailsize
+// PopLimit			:		The population limit
+// PopCommand			:		The POP command to be executed
+// Reads the Pop account name,maximun email size,population limit and the pop command 
+// name to be executed.Based on the command it calls a utility to establish connection 
+// the POP server, executes the POP command and then based on the command again
+// disconnects with the POP server.
+// [APIs Used]
+// CMsvEntry:: GetEntryL
+// CBaseMtm :: SwitchCurrentEntryL
+// CMsvEntry:: ChildrenL
+// CBaseMtm :: InvokeAsyncFunctionL
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+
+// User Includes
+#include "T_PopInvokeAsyncFunction.h"
+#include <t_utilsenumconverter.h>
+#include <t_utilscentralrepository.h>
+#include "T_PopServer.h"
+#include "T_MsgSharedDataPop.h"
+
+// Epoc includes
+#include <miutset.h>
+
+
+// Literals Used
+_LIT(KPopAccountName,"PopAccountName");
+_LIT(KEmailSize,"EmailSize");
+_LIT(KPopLimit,"PopLimit");
+_LIT(KPopCommand,"PopCommand");
+
+
+typedef TPckgBuf<TImPop3PopulateOptions> TPop3MailInfoBuf;
+
+
+/**
+CT_MsgModifyPopSettings()
+Sets the teststep name to KPopInvokeAsyncFunction
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+*/
+CT_MsgPopInvokeAsyncFunction::CT_MsgPopInvokeAsyncFunction(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgAsyncStepPOP(aSharedDataPOP)
+,	iOperation(NULL)
+	{
+	SetTestStepName(KPopInvokeAsyncFunction);
+	}
+
+
+/**
+NewL()
+Allocates and creates a new CT_MsgPopInvokeAsyncFunction object
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Session
+
+@leave KErrNoMemory
+@return
+Returns pointer to an object of CT_MsgPopInvokeAsyncFunction
+*/
+CT_MsgPopInvokeAsyncFunction* CT_MsgPopInvokeAsyncFunction::NewL(CT_MsgSharedDataPop& aSharedDataPOP)
+	{
+	CT_MsgPopInvokeAsyncFunction* self = new(ELeave) CT_MsgPopInvokeAsyncFunction(aSharedDataPOP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 // Call CT_AsyncStep::ConstructL()
+	CleanupStack::Pop(self);
+	return self;
+	}	
+	
+
+/**
+~CT_MsgPopInvokeAsyncFunction()
+Destructor
+*/
+CT_MsgPopInvokeAsyncFunction::~CT_MsgPopInvokeAsyncFunction()
+	{
+	delete iOperation;
+	iOperation=NULL;
+	}
+
+
+/**
+ProgressL()
+
+@param
+*/
+void CT_MsgPopInvokeAsyncFunction::ProgressL(TBool bFinal)
+	{
+	//	TODO
+	if ( bFinal )
+		{
+		//	Display final progress iOperation
+		}
+	else
+		{
+		//	Display current progress iOperation
+		}
+	}
+
+
+/**
+CancelStep()
+
+@param
+*/
+void CT_MsgPopInvokeAsyncFunction::CancelStep()
+	{
+	iOperation->Cancel();
+	}
+
+
+/**
+doTestStepL()
+Reads the POP account name,population limit,maximum email size from the ini file
+Based on the command decides whether a connection is required.
+It then calls the InvokeAsyncFunctionL with the given command.
+Based on the command again calls the utility to disconnect fromt the POP server
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgPopInvokeAsyncFunction::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : Invoke Async Function"));
+
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("Account name not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+
+		// Retrieving the Pop service Id for the given Pop account
+		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+
+		// Read the maximum email size from the ini file
+		TInt maxEmailSize;
+		GetIntFromConfig(ConfigSection(), KEmailSize, maxEmailSize); 
+
+		// Read the population limit from the ini file
+		TInt popLimit;
+		GetIntFromConfig(ConfigSection(), KPopLimit, popLimit);
+
+		// Read the pop command to be executed from the ini file
+		TPtrC popCmdName;
+		if(!GetStringFromConfig(ConfigSection(),KPopCommand,popCmdName))
+			{
+			ERR_PRINTF1(_L("Pop command not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			
+			// Changes the entry on which later actions are performed to the entry of the Pop Service Id.
+			iSharedDataPOP.iMtm->SwitchCurrentEntryL(popServiceId); //base Class Member iMtm
+			TPop3Cmds  popCommand = CT_MsgUtilsEnumConverter::ConvertDesToTPop3Cmds(popCmdName);
+			// Accesses the entry for the specified Pop Service Id.
+			CMsvEntry* entry = iSharedDataPOP.iSession->GetEntryL(popServiceId); //base Class Member iSession
+			entry->SetEntryL(popServiceId);
+			CleanupStack::PushL(entry);
+
+			// Create a selection of the children entries  
+			CMsvEntrySelection* selection = entry->ChildrenL();
+			CleanupStack::PushL(selection); 
+			
+	
+			//setting the max email size and populationlimit to the values read from the ini file
+			iMailInfo.SetMaxEmailSize(static_cast<TInt32>(maxEmailSize));
+			iMailInfo.SetPopulationLimit(static_cast<TInt32>(popLimit));
+
+			TPop3MailInfoBuf pack(iMailInfo);
+			selection->InsertL(0, popServiceId);
+
+			CT_MsgActive&	active=Active();
+			iOperation = iSharedDataPOP.iMtm->InvokeAsyncFunctionL( popCommand,
+											*selection, pack, active.iStatus ); //base Class Member iMtm, waiter
+			active.Activate();
+			CActiveScheduler::Start();
+
+			// Get the error code from TPop3Progress
+			TPop3Progress temp;
+			TPckgC<TPop3Progress> paramPack(temp);
+			paramPack.Set(iOperation->ProgressL());
+			TPop3Progress progress=paramPack();
+			SetTestStepError(progress.iErrorCode);
+
+			delete iOperation;
+			iOperation=NULL;
+			CleanupStack::PopAndDestroy(2,entry);   // operation,selection,entry
+			User::LeaveIfError(active.Result());
+			}
+		}	
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_PopServer.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,255 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+// User includes
+#include "T_MsgServer.h"
+#include "T_PopServer.h"
+#include "T_MsgSharedDataPop.h"
+
+// Header files of Test Steps POP
+#include "T_CreatePopAccount.h"
+#include "T_DeletePopAccount.h"
+#include "T_VerifyPopAccountsCount.h"
+#include "T_ModifyPopSettings.h"
+#include "T_ComparePopSettings.h"
+#include "T_VerfiyPopSettings.h"
+#include "T_ConnectPop3Server.h"
+#include "T_DisConnectPop3Server.h"
+#include "T_ComparePopEmailMsgs.h"
+#include "T_CopyPopSelection.h"
+#include "T_PopInvokeAsyncFunction.h"
+#include "T_DeleteAllPopChildren.h"
+#include "T_CheckChildrenCountPop.h"
+#include "T_StartRamUsageTimer.h"
+#include "T_StopRamUsageTimer.h"
+#include "T_CheckPop3AccessPoint.h"
+#include "T_CreatePopAccountWithoutSmtp.h"
+#include "T_ModifyPopSettings2.h"
+#include "T_CheckPopSNAPSetting.h"
+#include "T_RemovePopSNAPSetting.h"
+#include "T_CheckPopBMSetting.h"
+
+/**
+MainL()
+This is the main function which installs the active scheduler and 
+creates an object of the Email server
+*/
+LOCAL_C void MainL()
+/**
+Secure variant
+Much simpler, uses the new Rendezvous() call to sync with the client
+*/
+	{
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().SecureApi(RProcess::ESecureApiOn);
+
+	CActiveScheduler*	sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CT_MsgPopServer* server = NULL;
+
+	// Create the CTestServer derived Email server
+	TRAPD(err, server = CT_MsgPopServer::NewL());
+	if ( err == KErrNone )
+		{
+		// Sync with the client and enter the active scheduler
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+	delete server;
+	server=NULL;
+	delete sched;
+	sched=NULL;
+	}
+
+
+/**
+E32Main()
+It is the entry point for POP testserver
+
+@return
+Returns KErrNone on suceed otherwise the error code
+*/
+GLDEF_C TInt E32Main()
+/**
+@return
+Standard Epoc error code on process exit
+Secure variant only
+Process entry point. Called by client using RProcess API
+*/
+	{
+	__UHEAP_MARK;
+	
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());	
+	delete cleanup;
+	cleanup=NULL;
+	__UHEAP_MARKEND;
+	
+	return KErrNone;
+    }
+    
+
+/**
+NewL()
+Constructs a CT_MsgPopServer object.
+Uses two phase construction and leaves nothing on the CleanupStack.
+
+@leave KErrNoMemory
+@return
+Created object of type CT_MsgPopServer
+*/
+CT_MsgPopServer* CT_MsgPopServer::NewL()
+	{
+	CT_MsgPopServer*	server=new(ELeave) CT_MsgPopServer();
+	CleanupStack::PushL(server);
+//	server->StartL(KPopServer);
+	server->ConstructL(KPopServer);
+	CleanupStack::Pop(server);
+	return server;
+	}
+	
+	
+/**
+CT_MsgPopServer()
+Intializes iSharedDataPOP with NULL
+*/
+CT_MsgPopServer::CT_MsgPopServer()
+:	iSharedDataPOP(NULL)
+	{
+	}
+
+/**
+NewSharedDataL()
+Constructs a CT_MsgSharedDataPop object dynamically and assigns it's address to iSharedDataPOP
+
+@return
+An object of CT_MsgSharedDataPop
+*/
+CT_MsgSharedDataBase* CT_MsgPopServer::NewSharedDataL()
+	{
+	return iSharedDataPOP = CT_MsgSharedDataPop::NewL();
+	}
+
+
+/**
+CreateTestStepL()
+Creates the test steps based on the name read from the script file
+
+@param aStepName
+The name of the test step to be created
+
+@return
+The CTestStep object created
+*/ 
+CTestStep* CT_MsgPopServer::CreateTestStepL(const TDesC& aStepName)
+	{
+	CTestStep* testStep = NULL;
+	
+	if(aStepName == KVerifyPopSettings)
+		{
+		testStep = new(ELeave) CT_MsgVerifyPopSettings(*iSharedDataPOP);
+		}
+	else if(aStepName == KDeleteAllPopChildren)
+		{
+		testStep = CT_MsgDeleteAllPopChildren::NewL(*iSharedDataPOP);
+		}
+	else if(aStepName == KCopyPopSelection)
+		{
+		testStep = CT_MsgCopyPopSelection::NewL(*iSharedDataPOP);
+		}
+	else if(aStepName == KCreatePopAccount)
+		{
+		testStep = new(ELeave) CT_MsgCreatePopAccount(*iSharedDataPOP);
+		}
+	else if(aStepName == KModifyPopSettings)
+		{
+		testStep = new(ELeave) CT_MsgModifyPopSettings(*iSharedDataPOP);
+		}
+	else if(aStepName == KComparePopSettings)
+		{
+		testStep = new(ELeave) CT_MsgComparePopSettings(*iSharedDataPOP);
+		}
+	else if(aStepName == KDeletePopAccount)
+		{
+		testStep = new(ELeave) CT_MsgDeletePopAccount(*iSharedDataPOP);
+		}
+	else if(aStepName == KVerifyPopAccountsCount)
+		{
+		testStep = new(ELeave) CT_MsgVerifyPopAccountsCount(*iSharedDataPOP);
+		}
+	else if(aStepName == KPopInvokeAsyncFunction)
+		{
+		testStep = CT_MsgPopInvokeAsyncFunction::NewL(*iSharedDataPOP);
+		}
+	else if(aStepName == KCheckChildrenCountPop)
+		{
+		testStep = new(ELeave) CT_MsgCheckChildrenCountPop(*iSharedDataPOP);
+		}
+	else if(aStepName == KComparePopEmailMsgs)
+		{
+		testStep = CT_MsgComparePopEmailMsgs::NewL(*iSharedDataPOP);
+		}
+	else if(aStepName == KConnectPop3Server)
+		{
+		testStep = CT_MsgConnectPop3Server::NewL(*iSharedDataPOP);
+		}
+	else if(aStepName == KDisConnectPop3Server)
+		{
+		testStep = CT_MsgDisConnectPop3Server::NewL(*iSharedDataPOP);
+		}
+	else if(aStepName == KStartRamUsageTimer)
+ 		{
+ 		testStep = new(ELeave) CT_StartRamUsageTimer(*iSharedDataPOP);
+ 		}
+ 	else if(aStepName == KStopRamUsageTimer)
+ 		{
+ 		testStep = new(ELeave) CT_StopRamUsageTimer(*iSharedDataPOP);
+ 		}
+ 	else if(aStepName == KCheckPop3AccessPoint)
+ 		{
+ 		testStep = new(ELeave) CT_MsgCheckPop3AccessPoint(*iSharedDataPOP);
+ 		}
+ 	else if(aStepName == KCreatePopAccountWithoutSmtp)
+ 		{
+ 		testStep = new(ELeave) CT_MsgCreatePopAccountWithoutSmtp(*iSharedDataPOP);
+ 		}
+ 	else if(aStepName == KModifyPopSettings2)
+ 		{
+ 		testStep = new(ELeave) CT_MsgModifyPopSettings2(*iSharedDataPOP);
+ 		}
+ 	else if(aStepName == KCheckPopSNAPSetting)
+ 		{
+ 		testStep = new(ELeave) CT_MsgCheckPopSNAPSetting(*iSharedDataPOP);
+ 		}
+ 	else if(aStepName == KRemovePopSNAPSetting)
+ 		{
+ 		testStep = new(ELeave) CT_MsgRemovePopSNAPSetting(*iSharedDataPOP);
+ 		}
+ 	else if(aStepName == KCheckPopBMSetting)
+ 		{
+ 		testStep = new(ELeave) CT_MsgCheckPopBMSetting(*iSharedDataPOP);
+ 		}
+	else
+		{
+		testStep = CT_MsgServer::CreateTestStepL(aStepName);
+		}
+
+	return testStep;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_RemovePopSNAPSetting.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,93 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// RemovePopSNAPSetting
+// [Paramaters]
+// PopAccountName			:Name of the Pop account.
+// Removes the provisioned SNAP information for the POP account.
+// 
+//
+
+//User includes
+#include "T_RemovePopSNAPSetting.h"
+#include <t_utils.h>
+#include <t_utilsenumconverter.h>
+#include <t_utilscentralrepository.h>
+
+//Epoc include
+#include <iapprefs.h>
+
+//Literal used
+_LIT(KPopAccountName,"PopAccountName");
+
+/**
+  Function : CT_MsgRemovePopSNAPSetting
+  Description : Constructor 
+  @param : aSharedDataPOP Reference to CT_MsgSharedDataPop
+  @return : N/A
+*/
+CT_MsgRemovePopSNAPSetting::CT_MsgRemovePopSNAPSetting(CT_MsgSharedDataPop& aSharedDataPOP)
+:CT_MsgSyncStepPOP(aSharedDataPOP)
+	{
+	SetTestStepName(KRemovePopSNAPSetting);
+	}
+	
+	
+/**
+  Function : ReadIni
+  Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
+  @return : TBool
+*/
+TBool CT_MsgRemovePopSNAPSetting::ReadIni()
+	{
+	TBool result = ETrue;
+	
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, iPopAccountName))
+		{
+		ERR_PRINTF1(_L("Pop account name is not specified"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+		
+	return result;
+	}
+
+/**
+  Function : doTestStepL
+  Description : Removes the provisioned SNAP information from the POP account settings of a test case.
+  @return : TVerdict - Test step result
+*/		
+TVerdict CT_MsgRemovePopSNAPSetting::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : RemovePopSNAPSetting"));
+	if(ReadIni())
+		{
+		CEmailAccounts* accounts = CEmailAccounts::NewL();
+		CleanupStack::PushL(accounts);
+		
+		CImIAPPreferences* popIapPrefs = CImIAPPreferences::NewLC();
+					
+		TPopAccount popAccountId;
+		CT_MsgUtilsCentralRepository::GetPopAccountL((TDes&)iPopAccountName, popAccountId);
+				
+		accounts->LoadPopIapSettingsL(popAccountId, *popIapPrefs);	
+		
+		popIapPrefs->RemoveSNAP();
+		
+		accounts->SavePopIapSettingsL(popAccountId, *popIapPrefs);
+	
+		CleanupStack::PopAndDestroy(2,accounts); // popIapPrefs, accounts
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_SharedDataPop.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,69 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file contains the shared data class for the POP server
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+// user include
+#include "t_shareddatapop.h"
+
+
+// epoc includes
+#include <miutset.h>
+#include <mtclreg.h>
+
+
+/**
+NewL()
+Allocates and creates a new CT_MsgSharedDataPop object
+
+@leave KErrNoMemory
+@return
+Returns pointer to an object of CT_MsgSharedDataPop
+*/
+CT_MsgSharedDataPop* CT_MsgSharedDataPop::NewL()
+	{
+	CT_MsgSharedDataPop* sharedDataPop=new(ELeave) CT_MsgSharedDataPop();
+	CleanupStack::PushL(sharedDataPop);
+	sharedDataPop->ConstructL();
+	CleanupStack::Pop(sharedDataPop);
+	return sharedDataPop;
+	}
+
+	
+/**
+NewMtmL()
+ 
+@return
+Returns a pointer to Client-side MTM object
+*/
+CBaseMtm* CT_MsgSharedDataPop::NewMtmL()
+	{
+	return iRegistry->NewMtmL(KUidMsgTypePOP3);
+	}
+
+
+/**
+CT_MsgSharedDataPop()
+Construstor
+*/
+CT_MsgSharedDataImap::CT_MsgSharedDataImap()
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_StartRamUsageTimer.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,148 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// [TestStep Name]
+// StartRamUsageTimer
+// [Paramaters]
+// IntervalTimeInMicroSecs			<input>	: The interval between events generated
+// after the initial delay, in microseconds
+// Starts periodical measurement of RAM memory used and updates the information kept
+// in POP testserver.
+// [APIs Used]
+// 
+//
+
+
+
+// User includes 
+#include "T_StartRamUsageTimer.h"
+#include "T_MsgSharedDataPop.h"
+
+// Epoc includes
+#include <hal.h>
+#include <hal_data.h>
+
+// Literals used
+_LIT(KIntervalTimeInMicroSecs, "IntervalTimeInMicroSecs");
+
+/**
+  Function 		: CT_StartRamUsageTimer
+  Description 	: Constructor
+  @return 		: none
+*/
+CT_StartRamUsageTimer::CT_StartRamUsageTimer(CT_MsgSharedDataPop& aSharedDataPOP)
+:CT_MsgAsyncStepPOP(aSharedDataPOP)
+	{
+	SetTestStepName(KStartRamUsageTimer);
+	}
+
+/**
+  Function 		: ~CT_StartRamUsageTimer
+  Description 	: Destructor
+  @return 		: N/A
+*/
+CT_StartRamUsageTimer::~CT_StartRamUsageTimer()
+	{}
+	
+
+/**
+  Function 		: doTestStepL
+  Description 	: Generate a periodic Timer event and handle the RAM usage callback function
+  @return 		: TVerdict Test result
+*/
+TVerdict CT_StartRamUsageTimer::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep :StartRamUsageTimer"));
+	TInt intervalTime = 0;	
+	if(!GetIntFromConfig(ConfigSection(),KIntervalTimeInMicroSecs,intervalTime))
+		{
+		ERR_PRINTF1(_L("Interval time is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		iSharedDataPOP.iPeriodic->Start(intervalTime, intervalTime, TCallBack(RamUsage,this));
+		}
+	return TestStepResult();	
+	}
+
+/**
+  Function 		: RamUsage
+  Description 	: Call non-static method DoRamUsage
+  @return 		: TInt
+*/
+TInt CT_StartRamUsageTimer::RamUsage(TAny* aObject)
+	{
+	// Cast, and call non-static function
+	((CT_StartRamUsageTimer *)aObject)->DoRamUsage();	
+	return 1;	
+	}
+
+/**
+  Function 		: DoRamUsage
+  Description 	: Calculate the RAM usage value and percentage at a particular instance 
+  @return 		: void
+*/	
+void CT_StartRamUsageTimer::DoRamUsage()
+	{
+	
+	TInt fullRamValue;
+	TInt ramFreeValue;
+	
+	HAL 	data;
+	HALData haldata;
+	
+	data.Get(haldata.EMemoryRAM, fullRamValue);
+	data.Get(haldata.EMemoryRAMFree, ramFreeValue);	
+	
+	TInt ramUsage = ((fullRamValue - ramFreeValue)/(1024));
+	
+	if ( iSharedDataPOP.iMark != EFalse )
+		{
+		iSharedDataPOP.iStartRamValue = ramUsage;
+		iSharedDataPOP.iMinRamValue = ramUsage;
+		iSharedDataPOP.iMaxRamValue = ramUsage;
+		iSharedDataPOP.iMark = EFalse;
+		}
+	
+	if ( iSharedDataPOP.iMinRamValue > ramUsage )
+		{
+		iSharedDataPOP.iMinRamValue = ramUsage;
+		}
+		
+	if ( iSharedDataPOP.iMaxRamValue < ramUsage )
+		{
+		iSharedDataPOP.iMaxRamValue = ramUsage;
+		}
+	
+	iSharedDataPOP.iEndRamValue = ramUsage;
+	}
+	
+
+	
+/**
+  Function 		: ProgressL
+  Description 	: Displays the progress information of the asynchronous operation
+  @return 		: void
+*/
+void CT_StartRamUsageTimer::ProgressL(TBool /*aFinal*/)
+	{}
+
+/**
+  Function 		: CancelStep
+  Description 	: Cancels the asynchronous operation
+  @return 		: void
+*/
+void CT_StartRamUsageTimer::CancelStep()
+	{}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_StopRamUsageTimer.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,127 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// [TestStep Name]
+// StopRamUsageTimer
+// [Paramaters]
+// EventStartCode			<input>	: Start event code which maps to the RAM usage value
+// when tacking of RAM usage got started.
+// EventStopCode			<input> : Stop event code which maps to the RAM usage value
+// when tacking of RAM usage got stopped.
+// Stops periodical measurement of RAM memory used and logs the RAM usage information
+// [APIs Used]
+// 
+//
+
+
+
+// User includes
+#include "T_StopRamUsageTimer.h"
+#include <t_utilsenumconverter.h>
+#include <t_testinstrumentation.h>
+
+
+// Literals used
+_LIT(KEventStartCode, "EventStartCode");
+_LIT(KEventStopCode, "EventStopCode");
+/**
+  Function 		: CT_StopRamUsageTimer
+  Description 	: Constructor
+  @return 		: none
+*/
+CT_StopRamUsageTimer::CT_StopRamUsageTimer(CT_MsgSharedDataPop& aSharedDataPOP)
+:CT_MsgAsyncStepPOP(aSharedDataPOP)
+	{
+	SetTestStepName(KStopRamUsageTimer);
+	}
+	
+/**
+  Function 		: ~CT_StopRamUsageTimer
+  Description 	: Destructor
+  @return 		: N/A
+*/
+CT_StopRamUsageTimer::~CT_StopRamUsageTimer()
+	{}
+	
+
+/**
+  Function 		: doTestStepL
+  Description 	: Stop the periodic Timer
+  @return 		: TVerdict Test result
+*/
+TVerdict CT_StopRamUsageTimer::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep :StopRamUsageTimer"));
+	TPtrC startCodeFromIni;
+	if(!GetStringFromConfig(ConfigSection(), KEventStartCode, startCodeFromIni))
+		{
+		ERR_PRINTF1(_L("Event Start code is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TInstrumentationPoint starteventcode = CT_MsgUtilsEnumConverter::ConvertDesToEventCode(startCodeFromIni);
+		
+		TPtrC stopCodeFromIni;
+		if(!GetStringFromConfig(ConfigSection(), KEventStopCode, stopCodeFromIni))
+			{
+			ERR_PRINTF1(_L("Event Stop code is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			TInstrumentationPoint stopeventcode = CT_MsgUtilsEnumConverter::ConvertDesToEventCode(stopCodeFromIni);
+			iSharedDataPOP.iPeriodic->Cancel();
+
+			INFO_PRINTF2(_L("Minimum Ram usage value is %d KB "), iSharedDataPOP.iMinRamValue);
+			INFO_PRINTF2(_L("Maximum Ram usage value is %d KB "), iSharedDataPOP.iMaxRamValue);
+			INFO_PRINTF2(_L("Start Ram usage value is %d KB "), iSharedDataPOP.iStartRamValue);
+			INFO_PRINTF2(_L("End Ram usage value is %d KB "), iSharedDataPOP.iEndRamValue);
+
+			TInt maxRamUsage = ( iSharedDataPOP.iMaxRamValue - iSharedDataPOP.iStartRamValue );
+			TInt extremeRamUsage = ( iSharedDataPOP.iMaxRamValue - iSharedDataPOP.iMinRamValue );
+			TInt actualRamUsage = ( iSharedDataPOP.iEndRamValue - iSharedDataPOP.iStartRamValue );
+			
+			INFO_PRINTF2(_L("Maximum(Mx-St) Ram usage diff value is %d KB "), maxRamUsage );
+			INFO_PRINTF2(_L("Extreme(Mx-Mn) Ram usage diff value is %d KB "), extremeRamUsage );
+			INFO_PRINTF2(_L("Actual(En-St) Ram usage diff value is %d KB "), actualRamUsage );
+			if( starteventcode || stopeventcode )
+				{
+				INFO_PRINTF5(_L("EVENT_LOG_INFORMATION,%d,%d,%d,%d"),0,0,starteventcode,iSharedDataPOP.iStartRamValue);
+				INFO_PRINTF5(_L("EVENT_LOG_INFORMATION,%d,%d,%d,%d"),0,0,stopeventcode,iSharedDataPOP.iMaxRamValue);
+				}
+			else
+				{
+				ERR_PRINTF1(_L("**ERROR**: Bad Event code. Check t_testinstrumentation.h for valid event code"));					
+				}	
+			}		
+		}
+	return TestStepResult();
+	}
+
+/**
+  Function 		: ProgressL
+  Description 	: Displays the progress information of the asynchronous operation
+  @return 		: void
+*/
+void CT_StopRamUsageTimer::ProgressL(TBool /*aFinal*/)
+	{}
+
+/**
+  Function 		: CancelStep
+  Description 	: Cancels the asynchronous operation
+  @return 		: void
+*/
+void CT_StopRamUsageTimer::CancelStep()
+	{}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_VerifyPopAccountsCount.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,106 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// VerifyPopAccountsCount
+// [Paramaters]
+// ExpectedCount		<input>	: Expected Number of the POP Accouts present
+// [Test Step Description]
+// If number of POP accounts present equals with the expected number of accounts then test step result is pass.
+// [APIs Used]
+// CEmailAccounts::GetPopAccountsL
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User include
+#include "T_VerifyPopAccountsCount.h"
+
+
+// epoc inlcudes
+#include<cemailaccounts.h>
+
+
+// Literals used
+_LIT(KExpectedCount,"ExpectedCount");
+
+
+/**
+CT_MsgVerifyPopAccountsCount()
+Sets the teststep name to KCheckChildrenCountPop
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Sessoin
+*/
+CT_MsgVerifyPopAccountsCount::CT_MsgVerifyPopAccountsCount(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgSyncStepPOP(aSharedDataPOP) 
+	{
+	SetTestStepName(KVerifyPopAccountsCount);
+	}
+
+
+/**
+~CT_MsgVerifyPopAccountsCount()
+Destructor
+*/
+CT_MsgVerifyPopAccountsCount::~CT_MsgVerifyPopAccountsCount()
+	{
+	}
+
+
+/**
+doTestStepL()
+Reads the expected count from the ini file.
+Obtains the count of the POP accounts created and compares against the expected number.
+
+@return
+Returns the test step result.
+*/
+TVerdict CT_MsgVerifyPopAccountsCount::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: Verify Pop Accounts Count"));
+	TInt expectedCount = -1;
+	if(!GetIntFromConfig(ConfigSection(), KExpectedCount, expectedCount) && expectedCount < 0)
+		{
+		ERR_PRINTF1(_L("ExpectedCount is not Specified or < 0"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		CEmailAccounts *account = CEmailAccounts::NewLC();	
+		RArray<TPopAccount> arrayPopAccounts;
+		account->GetPopAccountsL(arrayPopAccounts);
+		TInt count = arrayPopAccounts.Count();
+		
+		CleanupStack::PopAndDestroy(account);
+		arrayPopAccounts.Reset();
+		
+		if (count != expectedCount)
+			{
+			ERR_PRINTF3(_L("Number of POP accounts do not match ! expected = %d actual = %d"), 
+									  expectedCount, count);
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			INFO_PRINTF2(_L("Number of POP accounts matched value = %d !"), expectedCount);	
+			}			
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/src/T_VerifyPopSettings.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,175 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// VerifyPopSettings
+// [Paramaters]
+// PopAccountName		:		Name of the Pop account
+// VerifyPopSettings is intended to populate the default POP and SMTP settings,
+// Load the settings of the account created with the default settings, and compare 
+// the settings objects.The test passes if all the settings objects match else it fails.
+// [APIs Used]
+// GetPopAccountL
+// LoadPopSettingsL
+// LoadPopIapSettingsL
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User include
+#include "T_VerfiyPopSettings.h"
+#include <t_utilsreademailsettingsfromconfigfile.h>
+#include <t_utilscentralrepository.h>
+
+
+// epoc inlcudes
+#include <cemailaccounts.h>
+#include <pop3set.h>
+#include <iapprefs.h>
+#include <smtpset.h>
+
+
+// Literals used
+_LIT(KPopAccountName,"PopAccountName");
+
+
+/**
+CT_MsgVerifyPopSettings()
+Sets the teststep name to KCheckChildrenCountPop
+
+@param aSharedDataPOP
+Data shared across the POP test steps. Ex. Sessoin 
+*/
+CT_MsgVerifyPopSettings::CT_MsgVerifyPopSettings(CT_MsgSharedDataPop& aSharedDataPOP)
+:	CT_MsgSyncStepPOP(aSharedDataPOP) 
+	{
+	SetTestStepName(KVerifyPopSettings);
+	}
+
+
+/**
+~CT_MsgVerifyPopSettings()
+Destructor
+*/
+CT_MsgVerifyPopSettings::~CT_MsgVerifyPopSettings()
+	{
+	}
+
+
+/**
+doTestStepL()
+Populate the default POP and SMTP settings, Load the settings of the account 
+created with the default settings, and compares the settings objects.
+The test passes if all the settings objects match else it fails.
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgVerifyPopSettings::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: VerifyPopSettings"));
+	// Read the Pop account name from the ini file
+	TPtrC popAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
+		{
+		ERR_PRINTF1(_L("PopAccount Name is not specified"));
+		SetTestStepResult(EFail);
+		}
+	
+	else
+		{
+		// Retrieving the Pop service Id for the given Pop account
+		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+		INFO_PRINTF2(_L("Pop service id is %d"),popServiceId);
+		
+		if(popServiceId == KMsvNullIndexEntryId)
+			{
+			ERR_PRINTF1(_L("Invalid POP account name specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
+	
+			CImPop3Settings* popSettings1 = new(ELeave) CImPop3Settings();
+			CleanupStack::PushL(popSettings1);
+			
+			CImIAPPreferences* popIapPrefs1 = CImIAPPreferences::NewLC();
+			
+			CImSmtpSettings* smtpSettings1 = new(ELeave) CImSmtpSettings();
+			CleanupStack::PushL(smtpSettings1);
+
+			CImIAPPreferences* smtpIapPrefs1 = CImIAPPreferences::NewLC();
+
+			emailAccounts->PopulateDefaultPopSettingsL(*popSettings1, *popIapPrefs1);
+			emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings1, *smtpIapPrefs1);
+
+			
+	
+			CImPop3Settings* popSettings2 = new(ELeave) CImPop3Settings();
+			CleanupStack::PushL(popSettings2);
+			
+			CImIAPPreferences* popIapPrefs2 = CImIAPPreferences::NewLC();
+			
+			CImSmtpSettings* smtpSettings2 = new(ELeave) CImSmtpSettings();
+			CleanupStack::PushL(smtpSettings2);
+
+			CImIAPPreferences* smtpIapPrefs2 = CImIAPPreferences::NewLC();
+
+			TPopAccount popAccount;
+			emailAccounts->GetPopAccountL(popServiceId, popAccount);
+			emailAccounts->LoadPopSettingsL(popAccount, *popSettings2);
+			emailAccounts->LoadPopIapSettingsL(popAccount, *popIapPrefs2);
+			
+			TSmtpAccount smtpAccount;
+			emailAccounts->GetSmtpAccountL(popAccount.iSmtpService, smtpAccount);
+			emailAccounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings2);
+			emailAccounts->LoadSmtpIapSettingsL(smtpAccount, *smtpIapPrefs2);
+
+			TVerdict result = EPass;
+			if (!(*popSettings1 == *popSettings2))   
+				{
+				// failed
+				ERR_PRINTF1(_L("Pop3 Settings objects do not match !"));
+				result = EFail;
+				}
+			else if (!(*smtpSettings1 == *smtpSettings2))
+				{
+				// failed
+				ERR_PRINTF1(_L("SMTP Settings objects do not match !"));
+				result = EFail;
+				}
+			else if (!CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(*popIapPrefs1, *popIapPrefs2))
+				{
+				// failed
+				ERR_PRINTF1(_L("Pop3 IAP Preference objects do not match !"));
+				result = EFail;
+				}
+			else if (!CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(*smtpIapPrefs1, *smtpIapPrefs2))
+				{
+				// failed
+				ERR_PRINTF1(_L("SMTP IAP Preference objects do not match !"));
+				result = EFail;
+				}
+			SetTestStepResult(result);
+			CleanupStack::PopAndDestroy(9,emailAccounts);
+			}
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/testdata/EmailMessage/20KBody.txt	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,348 @@
+From: test908@msexchange2k.closedtest.intra
+To: test908@msexchange2k.closedtest.intra
+Subject: 20KBody
+Date: Wed, 10 Jan 2007 10:30:31 +0530
+MIME-Version: 1.0
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Content-Transfer-Encoding: 8bit
+X-Priority: 3
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook Express 6.00.2800.1807
+X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896
+
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian: Developer: homeThe people behind the EPOC operating system.
+Symbian's mission is to set the standard for mobile wireless operating
+systems and to enable a mass market for ...
+www.symbian.com/developer/ - Similar pages
+Symbian OS - Wikipedia, the free encyclopediaArticle discussing the
+operating system, its history and devices that use it.
+en.wikipedia.org/wiki/Symbian_OS - 64k - Cached - Similar pages
+My-Symbian.com - Symbian OS Communicators and Smartphones Info CenterPortal
+for users of Symbian based communicators and smartphones. Includes news,
+software downloads and both English and Polish language discussion forums.
+www.my-symbian.com/ - 82k - 8 Jan 2007 - Cached - Similar pages
+All About Symbian - News, Reviews, and Software for Symbian ...Community
+offering user support, news, reviews and software for Symbian based phones.
+www.allaboutsymbian.com/ - 42k - 8 Jan 2007 - Cached - Similar pages
+The premier place for symbian users, supported with the No. one ...The
+premier place for symbian users introduces various researches for smarth
+phone users like: Error Fixes, Modding, Guides, Tutorials tips & tricks, ...
+www.symbian-freak.com/ - 102k - Cached - Similar pages
+Symbian OS mobile smartphone operating system - News, articles ...Resource
+site for Symbian developers. Includes news, product review, technical
+information on Symbian based devices and discussion forums.
+www.symbianone.com/ - 93k - Cached - Similar pages
+Symbian Themes: WelcomeThe premier site for sharing and customzing themes,
+wallpapers, ringtones and more for a wide variety of mobile devices such as
+mobile phones, ...
+symbian.mobilethemes.com/ - 92k - Cached - Similar pages
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian: Developer: homeThe people behind the EPOC operating system.
+Symbian's mission is to set the standard for mobile wireless operating
+systems and to enable a mass market for ...
+www.symbian.com/developer/ - Similar pages
+Symbian OS - Wikipedia, the free encyclopediaArticle discussing the
+operating system, its history and devices that use it.
+en.wikipedia.org/wiki/Symbian_OS - 64k - Cached - Similar pages
+My-Symbian.com - Symbian OS Communicators and Smartphones Info CenterPortal
+for users of Symbian based communicators and smartphones. Includes news,
+software downloads and both English and Polish language discussion forums.
+www.my-symbian.com/ - 82k - 8 Jan 2007 - Cached - Similar pages
+All About Symbian - News, Reviews, and Software for Symbian ...Community
+offering user support, news, reviews and software for Symbian based phones.
+www.allaboutsymbian.com/ - 42k - 8 Jan 2007 - Cached - Similar pages
+The premier place for symbian users, supported with the No. one ...The
+premier place for symbian users introduces various researches for smarth
+phone users like: Error Fixes, Modding, Guides, Tutorials tips & tricks, ...
+www.symbian-freak.com/ - 102k - Cached - Similar pages
+Symbian OS mobile smartphone operating system - News, articles ...Resource
+site for Symbian developers. Includes news, product review, technical
+information on Symbian based devices and discussion forums.
+www.symbianone.com/ - 93k - Cached - Similar pages
+Symbian Themes: WelcomeThe premier site for sharing and customzing themes,
+wallpapers, ringtones and more for a wide variety of mobile devices such as
+mobile phones, ...
+symbian.mobilethemes.com/ - 92k - Cached - Similar pages
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian: Developer: homeThe people behind the EPOC operating system.
+Symbian's mission is to set the standard for mobile wireless operating
+systems and to enable a mass market for ...
+www.symbian.com/developer/ - Similar pages
+Symbian OS - Wikipedia, the free encyclopediaArticle discussing the
+operating system, its history and devices that use it.
+en.wikipedia.org/wiki/Symbian_OS - 64k - Cached - Similar pages
+My-Symbian.com - Symbian OS Communicators and Smartphones Info CenterPortal
+for users of Symbian based communicators and smartphones. Includes news,
+software downloads and both English and Polish language discussion forums.
+www.my-symbian.com/ - 82k - 8 Jan 2007 - Cached - Similar pages
+All About Symbian - News, Reviews, and Software for Symbian ...Community
+offering user support, news, reviews and software for Symbian based phones.
+www.allaboutsymbian.com/ - 42k - 8 Jan 2007 - Cached - Similar pages
+The premier place for symbian users, supported with the No. one ...The
+premier place for symbian users introduces various researches for smarth
+phone users like: Error Fixes, Modding, Guides, Tutorials tips & tricks, ...
+www.symbian-freak.com/ - 102k - Cached - Similar pages
+Symbian OS mobile smartphone operating system - News, articles ...Resource
+site for Symbian developers. Includes news, product review, technical
+information on Symbian based devices and discussion forums.
+www.symbianone.com/ - 93k - Cached - Similar pages
+Symbian Themes: WelcomeThe premier site for sharing and customzing themes,
+wallpapers, ringtones and more for a wide variety of mobile devices such as
+mobile phones, ...
+symbian.mobilethemes.com/ - 92k - Cached - Similar pages
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian: Developer: homeThe people behind the EPOC operating system.
+Symbian's mission is to set the standard for mobile wireless operating
+systems and to enable a mass market for ...
+www.symbian.com/developer/ - Similar pages
+Symbian OS - Wikipedia, the free encyclopediaArticle discussing the
+operating system, its history and devices that use it.
+en.wikipedia.org/wiki/Symbian_OS - 64k - Cached - Similar pages
+My-Symbian.com - Symbian OS Communicators and Smartphones Info CenterPortal
+for users of Symbian based communicators and smartphones. Includes news,
+software downloads and both English and Polish language discussion forums.
+www.my-symbian.com/ - 82k - 8 Jan 2007 - Cached - Similar pages
+All About Symbian - News, Reviews, and Software for Symbian ...Community
+offering user support, news, reviews and software for Symbian based phones.
+www.allaboutsymbian.com/ - 42k - 8 Jan 2007 - Cached - Similar pages
+The premier place for symbian users, supported with the No. one ...The
+premier place for symbian users introduces various researches for smarth
+phone users like: Error Fixes, Modding, Guides, Tutorials tips & tricks, ...
+www.symbian-freak.com/ - 102k - Cached - Similar pages
+Symbian OS mobile smartphone operating system - News, articles ...Resource
+site for Symbian developers. Includes news, product review, technical
+information on Symbian based devices and discussion forums.
+www.symbianone.com/ - 93k - Cached - Similar pages
+Symbian Themes: WelcomeThe premier site for sharing and customzing themes,
+wallpapers, ringtones and more for a wide variety of mobile devices such as
+mobile phones, ...
+symbian.mobilethemes.com/ - 92k - Cached - Similar pages
+
+
+
+From: test908@msexchange2k.closedtest.intra
+To: test908@msexchange2k.closedtest.intra
+Subject: 10KBody
+Date: Wed, 10 Jan 2007 10:30:31 +0530
+MIME-Version: 1.0
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Content-Transfer-Encoding: 8bit
+X-Priority: 3
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook Express 6.00.2800.1807
+X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896
+
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian: Developer: homeThe people behind the EPOC operating system.
+Symbian's mission is to set the standard for mobile wireless operating
+systems and to enable a mass market for ...
+www.symbian.com/developer/ - Similar pages
+Symbian OS - Wikipedia, the free encyclopediaArticle discussing the
+operating system, its history and devices that use it.
+en.wikipedia.org/wiki/Symbian_OS - 64k - Cached - Similar pages
+My-Symbian.com - Symbian OS Communicators and Smartphones Info CenterPortal
+for users of Symbian based communicators and smartphones. Includes news,
+software downloads and both English and Polish language discussion forums.
+www.my-symbian.com/ - 82k - 8 Jan 2007 - Cached - Similar pages
+All About Symbian - News, Reviews, and Software for Symbian ...Community
+offering user support, news, reviews and software for Symbian based phones.
+www.allaboutsymbian.com/ - 42k - 8 Jan 2007 - Cached - Similar pages
+The premier place for symbian users, supported with the No. one ...The
+premier place for symbian users introduces various researches for smarth
+phone users like: Error Fixes, Modding, Guides, Tutorials tips & tricks, ...
+www.symbian-freak.com/ - 102k - Cached - Similar pages
+Symbian OS mobile smartphone operating system - News, articles ...Resource
+site for Symbian developers. Includes news, product review, technical
+information on Symbian based devices and discussion forums.
+www.symbianone.com/ - 93k - Cached - Similar pages
+Symbian Themes: WelcomeThe premier site for sharing and customzing themes,
+wallpapers, ringtones and more for a wide variety of mobile devices such as
+mobile phones, ...
+symbian.mobilethemes.com/ - 92k - Cached - Similar pages
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian: Developer: homeThe people behind the EPOC operating system.
+Symbian's mission is to set the standard for mobile wireless operating
+systems and to enable a mass market for ...
+www.symbian.com/developer/ - Similar pages
+Symbian OS - Wikipedia, the free encyclopediaArticle discussing the
+operating system, its history and devices that use it.
+en.wikipedia.org/wiki/Symbian_OS - 64k - Cached - Similar pages
+My-Symbian.com - Symbian OS Communicators and Smartphones Info CenterPortal
+for users of Symbian based communicators and smartphones. Includes news,
+software downloads and both English and Polish language discussion forums.
+www.my-symbian.com/ - 82k - 8 Jan 2007 - Cached - Similar pages
+All About Symbian - News, Reviews, and Software for Symbian ...Community
+offering user support, news, reviews and software for Symbian based phones.
+www.allaboutsymbian.com/ - 42k - 8 Jan 2007 - Cached - Similar pages
+The premier place for symbian users, supported with the No. one ...The
+premier place for symbian users introduces various researches for smarth
+phone users like: Error Fixes, Modding, Guides, Tutorials tips & tricks, ...
+www.symbian-freak.com/ - 102k - Cached - Similar pages
+Symbian OS mobile smartphone operating system - News, articles ...Resource
+site for Symbian developers. Includes news, product review, technical
+information on Symbian based devices and discussion forums.
+www.symbianone.com/ - 93k - Cached - Similar pages
+Symbian Themes: WelcomeThe premier site for sharing and customzing themes,
+wallpapers, ringtones and more for a wide variety of mobile devices such as
+mobile phones, ...
+symbian.mobilethemes.com/ - 92k - Cached - Similar pages
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian: Developer: homeThe people behind the EPOC operating system.
+Symbian's mission is to set the standard for mobile wireless operating
+systems and to enable a mass market for ...
+www.symbian.com/developer/ - Similar pages
+Symbian OS - Wikipedia, the free encyclopediaArticle discussing the
+operating system, its history and devices that use it.
+en.wikipedia.org/wiki/Symbian_OS - 64k - Cached - Similar pages
+My-Symbian.com - Symbian OS Communicators and Smartphones Info CenterPortal
+for users of Symbian based communicators and smartphones. Includes news,
+software downloads and both English and Polish language discussion forums.
+www.my-symbian.com/ - 82k - 8 Jan 2007 - Cached - Similar pages
+All About Symbian - News, Reviews, and Software for Symbian ...Community
+offering user support, news, reviews and software for Symbian based phones.
+www.allaboutsymbian.com/ - 42k - 8 Jan 2007 - Cached - Similar pages
+The premier place for symbian users, supported with the No. one ...The
+premier place for symbian users introduces various researches for smarth
+phone users like: Error Fixes, Modding, Guides, Tutorials tips & tricks, ...
+www.symbian-freak.com/ - 102k - Cached - Similar pages
+Symbian OS mobile smartphone operating system - News, articles ...Resource
+site for Symbian developers. Includes news, product review, technical
+information on Symbian based devices and discussion forums.
+www.symbianone.com/ - 93k - Cached - Similar pages
+Symbian Themes: WelcomeThe premier site for sharing and customzing themes,
+wallpapers, ringtones and more for a wide variety of mobile devices such as
+mobile phones, ...
+symbian.mobilethemes.com/ - 92k - Cached - Similar pages
+Symbian OS - the mobile operating systemSoftware licensing company that
+develops and licenses Symbian OS, an open industry standard operating system
+for data enabled mobile phones.
+www.symbian.com/ - Similar pages
+Phones - www.symbian.com/phones/index.html
+OS - www.symbian.com/symbianos/index.html
+Fast facts - www.symbian.com/about/fastfacts/fastfacts.html
+Developer tools & downloads - www.symbian.com/developer/downloads/index.html
+More results from www.symbian.com »
+Symbian: Developer: homeThe people behind the EPOC operating system.
+Symbian's mission is to set the standard for mobile wireless operating
+systems and to enable a mass market for ...
+www.symbian.com/developer/ - Similar pages
+Symbian OS - Wikipedia, the free encyclopediaArticle discussing the
+operating system, its history and devices that use it.
+en.wikipedia.org/wiki/Symbian_OS - 64k - Cached - Similar pages
+My-Symbian.com - Symbian OS Communicators and Smartphones Info CenterPortal
+for users of Symbian based communicators and smartphones. Includes news,
+software downloads and both English and Polish language discussion forums.
+www.my-symbian.com/ - 82k - 8 Jan 2007 - Cached - Similar pages
+All About Symbian - News, Reviews, and Software for Symbian ...Community
+offering user support, news, reviews and software for Symbian based phones.
+www.allaboutsymbian.com/ - 42k - 8 Jan 2007 - Cached - Similar pages
+The premier place for symbian users, supported with the No. one ...The
+premier place for symbian users introduces various researches for smarth
+phone users like: Error Fixes, Modding, Guides, Tutorials tips & tricks, ...
+www.symbian-freak.com/ - 102k - Cached - Similar pages
+Symbian OS mobile smartphone operating system - News, articles ...Resource
+site for Symbian developers. Includes news, product review, technical
+information on Symbian based devices and discussion forums.
+www.symbianone.com/ - 93k - Cached - Similar pages
+Symbian Themes: WelcomeThe premier site for sharing and customzing themes,
+wallpapers, ringtones and more for a wide variety of mobile devices such as
+mobile phones, ...
+symbian.mobilethemes.com/ - 92k - Cached - Similar pages
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/testdata/EmailSettings/POPSettings_test908.txt	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,39 @@
+#  ban-pramodd02 server
+__type__   = Pop3Settings
+
+#ServerName = msexchange2k.closedtest.intra
+PopServerAddress = msexchange2k.closedtest.intra
+#PopLoginName  = test908
+#PopPassword   = test908
+
+PopIapList = POP001 POP002
+#PopIAP = 1
+#PopCommDbDialogPref 
+#PopIAPIndex = 0
+
+POP001_PopIAP = 1
+POP001_PopCommDbDialogPref = TCommDbDialogPref::ECommDbDialogPrefDoNotPrompt
+POP001_PopIAPIndex = 0
+
+POP002_PopIAP = 1
+POP002_PopCommDbDialogPref = TCommDbDialogPref::ECommDbDialogPrefDoNotPrompt
+POP002_PopIAPIndex = 0
+
+SmtpServerAddress = msexchange2k.closedtest.intra
+#SmtpEmailAddress = test908@msexchange2k.closedtest.intra
+#SmtpReceiptAddress = test908@msexchange2k.closedtest.intra
+#SmtpUserAddress = test908@msexchange2k.closedtest.intra
+#SmtpSetReplyToAddress = test908@msexchange2k.closedtest.intra
+#SmtpSetLoginName = test908
+#SmtpSetPassword = test908
+
+SmtpIapList = SMTP001 SMTP002 
+
+SMTP001_SmtpIAP = 1
+SMTP001_SmtpCommDbDialogPref = TCommDbDialogPref::ECommDbDialogPrefDoNotPrompt
+SMTP001_SmtpIAPIndex = 0
+
+
+SMTP001_SmtpIAP = 1
+SMTP001_SmtpCommDbDialogPref = TCommDbDialogPref::ECommDbDialogPrefDoNotPrompt
+SMTP001_SmtpIAPIndex = 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/pop/testdata/plainbody/smoketest_email.ini	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,691 @@
+#####################Start:MSG-POP3-CREATENEWMESSAGE-0001####################################
+
+[0001-InitNtRas]
+
+[0001-ResetMessageStore]
+
+[0001-CheckChildrenCountOutbox1]
+Expectedcount 		= 0
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0001-CreatePopAccount]
+PopAccountName		= PopAccountZ
+PopConfigFileName	= c:\smoketest\EmailSettings\POPSettings_test908.txt
+
+[0001-ConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0001-DeleteAllPopChildren]
+PopAccountName		= PopAccountZ
+
+[0001-CheckChildrenCountRemote0]
+PopAccountName		= PopAccountZ
+Expectedcount		= 0
+
+[0001-DisConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0001-SmtpCreateNewMessageWithPlainBodyText]
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+EmailFileName		= c:\smoketest\EmailMessage\20KBody.txt
+Subject			= 20KBody
+
+[0001-CheckChildrenCountOutbox2]
+Expectedcount 		= 1
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0001-SendSmtpMessage1]
+Subject			= 20KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0001-CheckChildrenCountSentItems]
+Expectedcount 		= 1
+FolderName 		= KMsvSentEntryId
+
+
+[0001-PopInvokeAsyncFunction1]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0001-CheckChildrenCountRemote1]
+PopAccountName		= PopAccountZ
+FolderName		= Inbox
+Expectedcount		= 1
+
+[0001-ComparePopEmailMsgs]
+InboxFolder		= KMsvLocalServiceIndexEntryId
+SentFolder 		= KMsvSentEntryId
+PopAccountName 		= PopAccountZ
+NumTest 		= 1
+
+NumOfLines0 		= 349
+FooterExpected0 	= 0
+NumOfLinesHtml0 	= 0
+Description0 		= 20KBody
+NumOfAttachments0 	= 0
+FooterSize0 		= 0
+#####################End:MSG-POP3-CREATENEWMESSAGE-0001####################################
+#####################Start:MSG-POP3-CREATENEWMESSAGE-0002####################################
+
+[0002-InitNtRas]
+
+[0002-ResetMessageStore]
+
+[0002-CheckChildrenCountOutbox1]
+Expectedcount 		= 0
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0002-CreatePopAccount]
+PopAccountName		= PopAccountZ
+PopConfigFileName	= c:\smoketest\EmailSettings\POPSettings_test908.txt
+
+[0002-ConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0002-DeleteAllPopChildren]
+PopAccountName		= PopAccountZ
+
+[0002-CheckChildrenCountRemote0]
+PopAccountName		= PopAccountZ
+Expectedcount		= 0
+
+[0002-DisConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0002-SmtpCreateNewMessageWithPlainBodyText]
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+EmailFileName		= c:\smoketest\EmailMessage\100KBody.txt
+Subject			= 100KBody
+
+[0002-CheckChildrenCountOutbox2]
+Expectedcount 		= 1
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0002-SendSmtpMessage1]
+Subject			= 100KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0002-CheckChildrenCountSentItems]
+Expectedcount 		= 1
+FolderName 		= KMsvSentEntryId
+
+
+[0002-PopInvokeAsyncFunction1]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0002-CheckChildrenCountRemote1]
+PopAccountName		= PopAccountZ
+FolderName		= Inbox
+Expectedcount		= 1
+
+[0002-ComparePopEmailMsgs]
+InboxFolder		= KMsvLocalServiceIndexEntryId
+SentFolder 		= KMsvSentEntryId
+PopAccountName 		= PopAccountZ
+NumTest 		= 1
+
+NumOfLines0 		= 1669
+FooterExpected0 	= 0
+NumOfLinesHtml0 	= 0
+Description0 		= 100KBody
+NumOfAttachments0 	= 0
+FooterSize0 		= 0
+#####################End:MSG-POP3-CREATENEWMESSAGE-0002####################################
+#####################Start:MSG-POP3-CREATEFORWARDMESSAGE-0001####################################
+
+[0003-InitNtRas]
+
+[0003-ResetMessageStore]
+
+[0003-CreatePopAccount]
+PopAccountName		= PopAccountZ
+PopConfigFileName	= c:\smoketest\EmailSettings\POPSettings_test908.txt
+
+[0003-ConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0003-DeleteAllPopChildren]
+PopAccountName		= PopAccountZ
+
+[0003-CheckChildrenCountRemote0]
+PopAccountName		= PopAccountZ
+Expectedcount		= 0
+
+[0003-DisConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0003-SmtpCreateNewMessageWithPlainBodyText]
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+EmailFileName		= c:\smoketest\EmailMessage\10KBody.txt
+Subject			= 10KBody
+
+[0003-CheckChildrenCountOutbox]
+Expectedcount 		= 1
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0003-SendSmtpMessage1]
+Subject			= 10KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0003-CheckChildrenCountSentItems]
+Expectedcount 		= 1
+FolderName 		= KMsvSentEntryId
+
+
+[0003-PopInvokeAsyncFunction1]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0003-CheckChildrenCountRemote1]
+PopAccountName		= PopAccountZ
+Expectedcount		= 1
+
+[0003-CreateForwardMessage]
+ServiceType		= POP
+PopAccountName		= PopAccountZ
+CommandName		= KSMTPMTMCreateForwardEmailMessage
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+SubjectOfExistingMsg	= 10KBody
+
+[0003-SendSmtpMessage2]
+Subject			= Fwd: 10KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0003-PopInvokeAsyncFunction2]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0003-CheckChildrenCountRemote2]
+PopAccountName		= PopAccountZ
+Expectedcount		= 2
+
+[0003-ComparePopEmailMsgs]
+InboxFolder		= KMsvLocalServiceIndexEntryId
+SentFolder 		= KMsvSentEntryId
+PopAccountName 		= PopAccountZ
+NumTest 		= 2
+
+NumOfLines0 		= 175
+FooterExpected0 	= 0
+NumOfLinesHtml0 	= 0
+Description0 		= 10KBody
+NumOfAttachments0 	= 0
+FooterSize0 		= 0
+
+NumOfLines1 		= 182
+FooterExpected1 	= 0
+NumOfLinesHtml1 	= 0
+Description1 		= Fwd: 10KBody
+NumOfAttachments1 	= 0
+FooterSize1 		= 0
+#####################End:MSG-POP3-CREATEFORWARDMESSAGE-0001####################################
+#####################Start:MSG-POP3-CREATEFORWARDMESSAGE-0002####################################
+
+[0004-InitNtRas]
+
+[0004-ResetMessageStore]
+
+[0004-CreatePopAccount]
+PopAccountName		= PopAccountZ
+PopConfigFileName	= c:\smoketest\EmailSettings\POPSettings_test908.txt
+
+[0004-ConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0004-DeleteAllPopChildren]
+PopAccountName		= PopAccountZ
+
+[0004-CheckChildrenCountRemote0]
+PopAccountName		= PopAccountZ
+Expectedcount		= 0
+
+[0004-DisConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0004-SmtpCreateNewMessageWithPlainBodyText]
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+EmailFileName		= c:\smoketest\EmailMessage\100KBody.txt
+Subject			= 100KBody
+
+[0004-CheckChildrenCountOutbox]
+Expectedcount 		= 1
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0004-SendSmtpMessage1]
+Subject			= 100KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0004-CheckChildrenCountSentItems]
+Expectedcount 		= 1
+FolderName 		= KMsvSentEntryId
+
+
+[0004-PopInvokeAsyncFunction1]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0004-CheckChildrenCountRemote1]
+PopAccountName		= PopAccountZ
+Expectedcount		= 1
+
+[0004-CreateForwardMessage]
+ServiceType		= POP
+PopAccountName		= PopAccountZ
+CommandName		= KSMTPMTMCreateForwardEmailMessage
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+SubjectOfExistingMsg	= 100KBody
+
+[0004-SendSmtpMessage2]
+Subject			= Fwd: 100KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0004-PopInvokeAsyncFunction2]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0004-CheckChildrenCountRemote2]
+PopAccountName		= PopAccountZ
+Expectedcount		= 2
+
+[0004-ComparePopEmailMsgs]
+InboxFolder		= KMsvLocalServiceIndexEntryId
+SentFolder 		= KMsvSentEntryId
+PopAccountName 		= PopAccountZ
+NumTest 		= 2
+
+NumOfLines0 		= 1669
+FooterExpected0 	= 0
+NumOfLinesHtml0 	= 0
+Description0 		= 100KBody
+NumOfAttachments0 	= 0
+FooterSize0 		= 0
+
+NumOfLines1 		= 1676
+FooterExpected1 	= 0
+NumOfLinesHtml1 	= 0
+Description1 		= Fwd: 100KBody
+NumOfAttachments1 	= 0
+FooterSize1 		= 0
+#####################End:MSG-POP3-CREATEFORWARDMESSAGE-0002####################################
+#####################Start:MSG-POP3-CREATEFORWARDMESSAGE-0003####################################
+
+[0005-InitNtRas]
+
+[0005-ResetMessageStore]
+
+[0005-CreatePopAccount]
+PopAccountName		= PopAccountZ
+PopConfigFileName	= c:\smoketest\EmailSettings\POPSettings_test908.txt
+
+[0005-ConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0005-DeleteAllPopChildren]
+PopAccountName		= PopAccountZ
+
+[0005-CheckChildrenCountRemote0]
+PopAccountName		= PopAccountZ
+Expectedcount		= 0
+
+[0005-DisConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0005-SmtpCreateNewMessageWithPlainBodyText]
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+EmailFileName		= c:\smoketest\EmailMessage\512KBody.txt
+Subject			= 512KBody
+
+[0005-CheckChildrenCountOutbox]
+Expectedcount 		= 1
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0005-SendSmtpMessage1]
+Subject			= 512KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0005-CheckChildrenCountSentItems]
+Expectedcount 		= 1
+FolderName 		= KMsvSentEntryId
+
+
+[0005-PopInvokeAsyncFunction1]
+PopAccountName		= PopAccountZ
+EmailSize		= 600000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0005-CheckChildrenCountRemote1]
+PopAccountName		= PopAccountZ
+Expectedcount		= 1
+
+[0005-CreateForwardMessage]
+ServiceType		= POP
+PopAccountName		= PopAccountZ
+CommandName		= KSMTPMTMCreateForwardEmailMessage
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+SubjectOfExistingMsg	= 512KBody
+
+[0005-SendSmtpMessage2]
+Subject			= Fwd: 512KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0005-PopInvokeAsyncFunction2]
+PopAccountName		= PopAccountZ
+EmailSize		= 600000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0005-CheckChildrenCountRemote2]
+PopAccountName		= PopAccountZ
+Expectedcount		= 2
+
+[0005-ComparePopEmailMsgs]
+InboxFolder		= KMsvLocalServiceIndexEntryId
+SentFolder 		= KMsvSentEntryId
+PopAccountName 		= PopAccountZ
+NumTest 		= 2
+
+NumOfLines0 		= 8483
+FooterExpected0 	= 0
+NumOfLinesHtml0 	= 0
+Description0 		= 512KBody
+NumOfAttachments0 	= 0
+FooterSize0 		= 0
+
+NumOfLines1 		= 8490
+FooterExpected1 	= 0
+NumOfLinesHtml1 	= 0
+Description1 		= Fwd: 512KBody
+NumOfAttachments1 	= 0
+FooterSize1 		= 0
+#####################End:MSG-POP3-CREATEFORWARDMESSAGE-0003####################################
+#####################Start:MSG-POP3-CREATEREPLYMESSAGE-0001####################################
+
+[0006-InitNtRas]
+
+[0006-ResetMessageStore]
+
+[0006-CreatePopAccount]
+PopAccountName		= PopAccountZ
+PopConfigFileName	= c:\smoketest\EmailSettings\POPSettings_test908.txt
+
+[0006-ConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0006-DeleteAllPopChildren]
+PopAccountName		= PopAccountZ
+
+[0006-CheckChildrenCountRemote0]
+PopAccountName		= PopAccountZ
+Expectedcount		= 0
+
+[0006-DisConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0006-SmtpCreateNewMessageWithPlainBodyText]
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+EmailFileName		= c:\smoketest\EmailMessage\10KBody.txt
+Subject			= 10KBody
+
+[0006-CheckChildrenCountOutbox]
+Expectedcount 		= 1
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0006-SendSmtpMessage1]
+Subject			= 10KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0006-CheckChildrenCountSentItems]
+Expectedcount 		= 1
+FolderName 		= KMsvSentEntryId
+
+
+[0006-PopInvokeAsyncFunction1]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0006-CheckChildrenCountRemote1]
+PopAccountName		= PopAccountZ
+Expectedcount		= 1
+
+[0006-CreateReplyMessage]
+ServiceType		= POP
+PopAccountName		= PopAccountZ
+CommandName		= KSMTPMTMCreateReplyEmailMessage
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+SubjectOfExistingMsg	= 10KBody
+
+[0006-SendSmtpMessage2]
+Subject			= Re: 10KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0006-PopInvokeAsyncFunction2]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0006-CheckChildrenCountRemote2]
+PopAccountName		= PopAccountZ
+Expectedcount		= 2
+
+[0006-ComparePopEmailMsgs]
+InboxFolder		= KMsvLocalServiceIndexEntryId
+SentFolder 		= KMsvSentEntryId
+PopAccountName 		= PopAccountZ
+NumTest 		= 2
+
+NumOfLines0 		= 175
+FooterExpected0 	= 0
+NumOfLinesHtml0 	= 0
+Description0 		= 10KBody
+NumOfAttachments0 	= 0
+FooterSize0 		= 0
+
+NumOfLines1 		= 182
+FooterExpected1 	= 0
+NumOfLinesHtml1 	= 0
+Description1 		= Re: 10KBody
+NumOfAttachments1 	= 0
+FooterSize1 		= 0
+#####################End:MSG-POP3-CREATEREPLYMESSAGE-0001####################################
+#####################Start:MSG-POP3-CREATEREPLYMESSAGE-0002####################################
+
+[0007-InitNtRas]
+
+[0007-ResetMessageStore]
+
+[0007-CreatePopAccount]
+PopAccountName		= PopAccountZ
+PopConfigFileName	= c:\smoketest\EmailSettings\POPSettings_test908.txt
+
+[0007-ConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0007-DeleteAllPopChildren]
+PopAccountName		= PopAccountZ
+
+[0007-CheckChildrenCountRemote0]
+PopAccountName		= PopAccountZ
+Expectedcount		= 0
+
+[0007-DisConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0007-SmtpCreateNewMessageWithPlainBodyText]
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+EmailFileName		= c:\smoketest\EmailMessage\100KBody.txt
+Subject			= 100KBody
+
+[0007-CheckChildrenCountOutbox]
+Expectedcount 		= 1
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0007-SendSmtpMessage1]
+Subject			= 100KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0007-CheckChildrenCountSentItems]
+Expectedcount 		= 1
+FolderName 		= KMsvSentEntryId
+
+
+[0007-PopInvokeAsyncFunction1]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0007-CheckChildrenCountRemote1]
+PopAccountName		= PopAccountZ
+Expectedcount		= 1
+
+[0007-CreateReplyMessage]
+ServiceType		= POP
+PopAccountName		= PopAccountZ
+CommandName		= KSMTPMTMCreateReplyEmailMessage
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+SubjectOfExistingMsg	= 100KBody
+
+[0007-SendSmtpMessage2]
+Subject			= Re: 100KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0007-PopInvokeAsyncFunction2]
+PopAccountName		= PopAccountZ
+EmailSize		= 500000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0007-CheckChildrenCountRemote2]
+PopAccountName		= PopAccountZ
+Expectedcount		= 2
+
+[0007-ComparePopEmailMsgs]
+InboxFolder		= KMsvLocalServiceIndexEntryId
+SentFolder 		= KMsvSentEntryId
+PopAccountName 		= PopAccountZ
+NumTest 		= 2
+
+NumOfLines0 		= 1669
+FooterExpected0 	= 0
+NumOfLinesHtml0 	= 0
+Description0 		= 100KBody
+NumOfAttachments0 	= 0
+FooterSize0 		= 0
+
+NumOfLines1 		= 1676
+FooterExpected1 	= 0
+NumOfLinesHtml1 	= 0
+Description1 		= Re: 100KBody
+NumOfAttachments1 	= 0
+FooterSize1 		= 0
+#####################End:MSG-POP3-CREATEREPLYMESSAGE-0002####################################
+#####################Start:MSG-POP3-CREATEREPLYMESSAGE-0003####################################
+
+[0008-InitNtRas]
+
+[0008-ResetMessageStore]
+
+[0008-CreatePopAccount]
+PopAccountName		= PopAccountZ
+PopConfigFileName	= c:\smoketest\EmailSettings\POPSettings_test908.txt
+
+[0008-ConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0008-DeleteAllPopChildren]
+PopAccountName		= PopAccountZ
+
+[0008-CheckChildrenCountRemote0]
+PopAccountName		= PopAccountZ
+Expectedcount		= 0
+
+[0008-DisConnectPop3Server]
+PopAccountName		= PopAccountZ
+
+[0008-SmtpCreateNewMessageWithPlainBodyText]
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+EmailFileName		= c:\smoketest\EmailMessage\512KBody.txt
+Subject			= 512KBody
+
+[0008-CheckChildrenCountOutbox]
+Expectedcount 		= 1
+FolderName 		= KMsvGlobalOutBoxIndexEntryId
+
+[0008-SendSmtpMessage1]
+Subject			= 512KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0008-CheckChildrenCountSentItems]
+Expectedcount 		= 1
+FolderName 		= KMsvSentEntryId
+
+
+[0008-PopInvokeAsyncFunction1]
+PopAccountName		= PopAccountZ
+EmailSize		= 600000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0008-CheckChildrenCountRemote1]
+PopAccountName		= PopAccountZ
+Expectedcount		= 1
+
+[0008-CreateReplyMessage]
+ServiceType		= POP
+PopAccountName		= PopAccountZ
+CommandName		= KSMTPMTMCreateReplyEmailMessage
+FolderName		= KMsvGlobalOutBoxIndexEntryId
+SubjectOfExistingMsg	= 512KBody
+
+[0008-SendSmtpMessage2]
+Subject			= Re: 512KBody
+ParentFolderName	= KMsvGlobalOutBoxIndexEntryId
+
+[0008-PopInvokeAsyncFunction2]
+PopAccountName		= PopAccountZ
+EmailSize		= 600000
+PopLimit		= -1
+PopCommand 		= KPOP3MTMPopulate
+
+[0008-CheckChildrenCountRemote2]
+PopAccountName		= PopAccountZ
+Expectedcount		= 2
+
+[0008-ComparePopEmailMsgs]
+InboxFolder		= KMsvLocalServiceIndexEntryId
+SentFolder 		= KMsvSentEntryId
+PopAccountName 		= PopAccountZ
+NumTest 		= 2
+
+NumOfLines0 		= 8483
+FooterExpected0 	= 0
+NumOfLinesHtml0 	= 0
+Description0 		= 512KBody
+NumOfAttachments0 	= 0
+FooterSize0 		= 0
+
+NumOfLines1 		= 8490
+FooterExpected1 	= 0
+NumOfLinesHtml1 	= 0
+Description1 		= Re: 512KBody
+NumOfAttachments1 	= 0
+FooterSize1 		= 0
+#####################End:MSG-POP3-CREATEREPLYMESSAGE-0003####################################
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/group/T_SmtpServer.mmp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,77 @@
+// Copyright (c) 2005-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Project definition file for Smtp test Server
+// 
+//
+
+	CAPABILITY 		ALL -TCB
+	TARGET			t_msgsmtpserver.exe
+	TARGETTYPE		exe
+	UID			0x1000007A 0x10274070
+	VENDORID 		0x70000001
+
+
+// Include the Framework 
+#include "../../../framework/group/T_MsgFramework.mph"
+
+
+SYSTEMINCLUDE		/epoc32/include
+SYSTEMINCLUDE		/epoc32/include/test
+SYSTEMINCLUDE		/epoc32/include/comms-infras
+
+USERINCLUDE 	../inc
+
+
+SOURCEPATH	../src
+SOURCE		T_SmtpServer.cpp
+SOURCE		T_MsgAsyncStepSMTP.cpp
+SOURCE		T_MsgSyncStepSMTP.cpp
+SOURCE		T_MsgSharedDataSmtp.cpp
+SOURCE		T_SendSmtpMessage.cpp
+SOURCE		T_UtilsSendEmail.cpp
+SOURCE		T_CreateSmtpMessageFromEmailFile.cpp
+SOURCE		T_SmtpSendEmail.cpp
+SOURCE		ImCltCvRecv.cpp
+SOURCE		Local_imcvrecv.cpp
+SOURCE		Local_imutdll.cpp
+SOURCE		T_StartRamUsageTimer.cpp
+SOURCE		T_StopRamUsageTimer.cpp
+SOURCE		T_RetrievePlainBodyTextAndCompare.cpp
+SOURCE		T_SmtpCreateNewMessageWithPlainBodyText.cpp
+SOURCE		T_SmtpCreateForwardMessage.cpp
+SOURCE		T_SmtpCreateReplyMessage.cpp
+SOURCE		T_CreateSmtpMobilityAccount.cpp
+SOURCE		T_CreateSmtpAccount.cpp
+SOURCE		T_CheckSmtpSNAPSetting.cpp
+SOURCE		T_ModifySmtpSettings.cpp
+SOURCE		T_RemoveSmtpSNAPSetting.cpp
+SOURCE		T_CheckSmtpBMSetting.cpp
+
+LIBRARY 	testexecuteutils.lib
+LIBRARY		testexecutelogclient.lib
+LIBRARY		imut.lib 
+LIBRARY		bafl.lib
+LIBRARY		etext.lib
+LIBRARY		msgs.lib
+LIBRARY		euser.lib
+LIBRARY		imcm.lib
+LIBRARY		efsrv.lib
+LIBRARY		charconv.lib
+LIBRARY		estor.lib
+LIBRARY		t_msgutilityserver.lib
+LIBRARY		hal.lib
+//LIBRARY		instrumentationhandler.lib
+LIBRARY		netmeta.lib
+
+EPOCHEAPSIZE 0x1000 0x800000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/group/bld.inf	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,19 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Component description file for Smtp test Server
+// 
+//
+
+PRJ_TESTMMPFILES
+T_SmtpServer.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/ImCltCvRecv.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,95 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __IM_CLT_CV_RECV_H__
+#define __IM_CLT_CV_RECV_H__
+
+
+// User includes
+#include "Local_imcvrecv.h"
+
+
+// Epoc includes
+#include <msvapi.h>
+
+
+/**
+Implements the Rfc822 specication for creating a message
+*/
+class CImCltRecvConvert : public CLocalImRecvConvert
+	{
+friend class CLocalMimeParser;
+public:
+	/*IMPORT_C*/ static CImCltRecvConvert* NewLC( RFs& anFs,CMsvEntry* aClientEntry,TUid aMsgType,TMsvId aEmailServiceId);
+	/*IMPORT_C*/ static CImCltRecvConvert* NewL( RFs& anFs,CMsvEntry* aClientEntry,TUid aMsgType,TMsvId aEmailServiceId);
+	/*IMPORT_C*/ ~CImCltRecvConvert();
+
+	/*IMPORT_C*/ void ResetL();
+	/*IMPORT_C*/ void ResetForHeadersL();
+
+	/*IMPORT_C*/ TInt ParseNextFieldL(const TDesC8& aSourceLine);
+	/*IMPORT_C*/ TMsvId MessageCompleteL();
+	/*IMPORT_C*/ void MessageCompleteL(TMsvEmailEntry aEmailEntry);
+	/*IMPORT_C*/ TMsvEmailEntry MessageEntryDetailsL();
+
+	inline void SetMsvId(TMsvId aId);
+	inline CMsvEntry& ClientEntry();
+	inline TMsvId EntryId();	
+
+private:
+	CImCltRecvConvert(RFs& anFs,CMsvEntry* aClientEntry,TUid aMsgType,TMsvId aEmailServiceId);
+	void ConstructL(RFs& anFs);
+
+	void ParseNextLineL(const TDesC8& aSourceLine);
+	void ParseBodyLineL(const TDesC8& aSourceLine);
+	void ParseMimeLineL(const TDesC8& aSourceLine);
+	void EndOfHeaderProcessingL();
+	TBool CreateNonMIMEFolderEntryL(TMsvId aCurrentId);
+
+	TInt Value(const TUint8*&);
+	void Whitespace(const TUint8*&);
+
+	TBool CreateAttachmentL();
+	void WriteToAttachmentL(const TDesC8& text);
+
+	void MoveUpFromFolderEntryL();
+	void MoveToParentEntryL();
+	void UpdateMultipartDataL();
+
+	TBool StoreEntryDataL();
+
+	void StoreEntryStreamsL();
+	void StoreEntryStreamsL(TInt aSettings);
+	void CreateEntryL();
+	void StoreMessageEntryDetailsL();
+	
+private:
+	CMsvEntry* iClientEntry;
+	CMsvServerEntry* iNullServerEntry;
+	};
+
+#include "ImCltCvRecv.inl"
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/ImCltCvRecv.inl	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,37 @@
+// Copyright (c) 2005-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file ImCltCvRecv.inl
+// 
+//
+
+
+inline void CImCltRecvConvert::SetMsvId(TMsvId aId)
+	{
+	iClientEntry->SetEntryL(aId);
+	iPopulateMessage = (iClientEntry->Entry().iType == KUidMsvMessageEntry);
+	iRootEntryId = aId;
+	}
+
+inline CMsvEntry& CImCltRecvConvert::ClientEntry()
+	{
+	return *iClientEntry;
+	}
+
+inline TMsvId CImCltRecvConvert::EntryId()
+	{
+	if (iClientEntry->Entry().Id() == KMsvRootIndexEntryId)
+		return iSavedEntryId;
+	else
+		return iClientEntry->Entry().Id();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/Local_imcvrecv.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,471 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __LOCAL_IMCVRECV_H__
+#define __LOCAL_IMCVRECV_H__
+
+// epoc include
+#include <s32mem.h>
+#include <badesca.h> // required for CBufSeg
+#include <msvstd.h>
+#include <msventry.h>
+#include <msvstore.h>
+#include <msvuids.h>
+#include <msvids.h>
+#include <miutatch.h>
+#include <miutlog.h>
+#include <imcvcodc.h>
+#include <imcvtext.h>
+
+// Forward Declaration
+class CImHeader;
+class CRichText;
+class CLocalMimeParser;
+class CLocalImRecvConvert;
+class RFs;
+class TImConvert;
+class TImAttachmentFile;
+class CImcvUtils;
+class CMsvBodyText;
+
+const TInt KHeaderBufferLength = 100;
+
+// Max filename length
+const TInt MaxMimeParameterValueLength = 256;
+// Likely maximum size of an encoded parameter value decoding to a length of 
+// MaxMimeParameterValueLength. In quoted printable usually 3 encoded characters
+// per decoded character. 60 characters is given to allow for delimiters and
+// charset information.
+const TInt KMimeEncodedParameterSize = MaxMimeParameterValueLength * 3 + 60;
+
+const TInt KConversionRemainderLength=20;
+
+//boundary stuff
+const TInt KBoundaryNotFound	=0;
+const TInt KBoundaryFound		=1;
+const TInt KBoundaryError		=2;
+
+
+/**
+Stores the details about a message nneded in the Message entry.
+*/
+struct TParentDetails
+	{
+	TInt				iSize;
+	TBool				iAttachment;
+	TBool				iMHTML;
+	TImEmailFolderType  iFolder;	// Only interested in the Related type
+	};
+
+
+/**
+@internalComponent
+@released
+*/
+class CLocalRfc822Token : public CBase
+	{
+public:
+	enum THeaderPart { EUnknown, ENotFinished, EFrom, EReplyTo, ETo, ECc, EBcc, ESubject, EDate, EMessageId, EPriority, EImportance, EReturnReceiptTo, EEndOfHeader };
+	THeaderPart iHeaderPart;
+	TBool iLastToken;
+	TBool iFirstLine;
+	TBool i822FieldsExist;
+
+	/*IMPORT_C*/ static CLocalRfc822Token* NewLC();
+	/*IMPORT_C*/ void Reset();
+	inline HBufC8* OutputLine();
+	/*IMPORT_C*/ virtual void ParseNextLineL( const TDesC8& aSourceLine );
+	/*IMPORT_C*/ ~CLocalRfc822Token();
+	inline TBool LastToken();
+
+	inline void SetImRecvConvert( CLocalImRecvConvert* );
+private:
+	TBool MatchAndRemoveL( const TDesC8& );
+	TBool PriorityAndReceiptsMatchAndRemoveL(THeaderPart aPriority);
+
+	CLocalRfc822Token();
+	void ConstructL();
+
+private:
+	TBuf8<KMaxIMailHeaderReadLineLength+1> iInputLine;
+	TBuf8<KMaxIMailHeaderReadLineLength+1> iBufferedInput;
+	HBufC8* iOutputLine;
+	CLocalImRecvConvert* iImRecvConvert;
+	};
+
+
+/**
+@internalTechnology
+@released
+*/
+class CLocalImRecvConvert : public CBase
+	{
+friend class CLocalMimeParser;
+public:
+	/*IMPORT_C*/ static CLocalImRecvConvert* NewLC( RFs& anFs, CMsvServerEntry* aServerEntry, 
+												TUid aMsgType, TMsvId aEmailServiceId);
+	/*IMPORT_C*/ static CLocalImRecvConvert* NewL( RFs& anFs, CMsvServerEntry* aServerEntry,
+												TUid aMsgType, TMsvId aEmailServiceId);
+	/*IMPORT_C*/ ~CLocalImRecvConvert();
+
+	/*IMPORT_C*/ void ResetL();
+	/*IMPORT_C*/ void ResetForHeadersL();
+
+	inline void SetAttachmentPathL(const TDesC& aFullPath);	// attachment path, if not set then IMCV will reject attachments
+	inline void SetMsvId(TMsvId aId);
+
+	/*IMPORT_C*/ virtual TInt ParseNextField(const TDesC8& aSourceLine);
+	/*IMPORT_C*/ void MessageCompleteL();
+	/*IMPORT_C*/ void MessageCompleteL(TMsvEmailEntry aEmailEntry);
+	/*IMPORT_C*/ void MessageCompleteL(TBool aPartialDownload);
+	/*IMPORT_C*/ TInt DeletedAttachmentSize();
+	/*IMPORT_C*/ void WritePartialFooterL(TInt aAmountLeft);
+	/*IMPORT_C*/ TMsvEmailEntry MessageEntryDetailsL();
+
+	enum TValidEntryType {EUnknownEntry, EMessageEntry, EFolderEntry, EAttachmentEntry, ETextEntry, EHtmlEntry};
+	enum TImEntryStreamSaveSettings
+		{
+		KStoreBodyText					= 0x00000001,
+		KStore822Header					= KStoreBodyText << 1,		//0x00000002
+		KStoreMIMEHeader				= KStore822Header << 1,	//0x00000004
+		};
+
+	inline const TTime Date() const;	// return RFC822 date
+	inline const TMsvPriority Priority() const;
+	inline void SaveAllAttachments(TBool aSave);
+	inline const TInt ReceiveError() const;
+	inline CMsvServerEntry& ServerEntry();
+	inline const CImHeader& Header() const;
+	inline const TBool ValidCompleteHeader() const;
+	//virtual inline const TMsvId EntryId() const;	
+	virtual TMsvId EntryId();	
+	inline TBool NotFinishedRfc822Header();
+	inline CImConvertCharconv& CharacterConverter();
+
+protected:
+	CLocalImRecvConvert(RFs& anFs, CMsvServerEntry* aServerEntry, 
+							TUid aMsgType, TMsvId aEmailServiceId);
+	void ConstructL(RFs& anFs);
+
+	void ParseNextLineL(const TDesC8& aSourceLine);
+	void ParseBodyLineL(const TDesC8& aSourceLine);
+	void ParseMimeLineL(const TDesC8& aSourceLine);
+	void EndOfHeaderProcessingL();
+	virtual void  EndOfHeaderMIMEProcessingL();
+	TBool CreateNonMIMEFolderEntryL(TMsvId aCurrentId);
+	void DecodeAndStoreLineL(const TDesC8& aSourceLine);
+
+	void ParseRecipientListL(CDesCArray& aRecipientList);
+	void PrepareDecoder();
+
+	void WriteToBodyL(const TDesC8& aText, TBool aBlankLine=EFalse);
+	void WriteToBodyL(const TDesC16& aText);
+
+	void AddFileExtension();
+	void ExtractFilename(TLex& aLex, TDes& rFileName);
+	void ReplaceInvalidCharacters(TDes& rFileName);
+	void SetAttachmentName(TDes& aFileName);
+	
+	TBool CheckUUEStartL(const TDesC8& aSourceLine);
+
+	// returns numeric value of text up to next delimiter
+	TInt Value(const TUint8*&);
+	void Whitespace(const TUint8*&);
+	TBool LineIsAllWhitespace();	
+
+	TBool CreateAttachmentL();
+	virtual void WriteToAttachmentL(const TDesC8& text);
+	void CloseAttachmentFileL();
+
+	// Message Entry specific functions
+	void ResetForNewEntryL(TValidEntryType entryType);
+	void ResetForNonMimeEntryL();
+	void MoveUpFromFolderEntryL();
+	virtual void MoveToParentEntryL();
+	void UpdateMultipartDataL();
+
+	TBool StoreEntryDataL();
+
+	virtual void StoreEntryStreamsL();
+	virtual void StoreEntryStreamsL(TInt aSettings);
+	void Store822HeaderL(CMsvStore& aStore, TBool& aCommit);
+	void StoreMIMEHeaderL(CMsvStore& aStore, TBool& aCommit);
+	void StoreBodyTextL(CMsvStore& aStore, TBool& aCommit);
+
+	virtual void CreateEntryL();
+	void Logging(const TDesC8& aString1, const TDesC8& aString2);
+	void StoreMessageEntryDetailsL();
+	
+protected:
+	enum { KNoPart = 0, KParentPart, KMultiPart };
+	TInt iEmailPart;
+	TMsvId iCurrentMultipartFolderEntryId;
+
+	TBool iMessageEntryCalled;
+	TBool iReceivingHeadersOnly;
+	TInt iReceiveError; // indicates if any anomalies were observed whilst the message was received
+	TInt iLeaveError; // keeps any errors that have caused a leave (ie Out of memory, Corrupt file, Server error)
+
+	TMsvId iRootEntryId;
+	TMsvId iTopMessagePart;
+
+	TInt8 iBCPadding[1348]; // Padding to maintain BC - TImAttachmentFile used to be here before it's size was expanded to buffer more data.
+	CMsvServerEntry* iServerEntry;
+	TUid iNewMsgType;
+
+	CLocalRfc822Token* iRfc822Token;
+
+	TValidEntryType iDefaultEntryType;
+	TValidEntryType iEntryType;
+
+	TMsvEmailEntry* iEmailEntry;
+	CImHeader* iOutputHeader;
+	
+	CParaFormatLayer* iParaLayer;
+	CCharFormatLayer* iCharLayer;
+	CRichText* iOutputBody;
+	
+	CImConvertCharconv* iCharConv;
+	CCnvCharacterSetConverter* iConverter;
+	TBool iPreparedToConvert;
+	
+	TBool iMIMEPart_822Header;	
+	TInt iEmptyHeaderSize;
+	TImBodyConvAlgorithm iAlgorithm;
+
+	TBool iCommitLine;	
+	TBool iFinalLine;	
+	TBool iPrepared;
+	TBool iFinishedHeader;
+	TBool iNotFinishedRfc822Header;
+	TBool iNewNonMIMEBodyPart;
+	TBool iFirstBoundaryReached;
+
+	CCnvCharacterSetConverter* iCharacterConverter;
+	CImConvertHeader* iHeaderConverter;
+
+	TImRfc822DateField iRfc822Date;
+
+	RFs* iFsSession;  
+
+	TBool iSkipData;
+	TBool iEncounteredLineEndingInCarriageReturn;
+
+	TBool iCurrentPartIsRichText;	//indicates if current body part is RichText, set on every Close Attachment()
+	TImCodecQP iQPCodec;
+	TImCodecB64 iB64Codec;
+	TImCodecUU iUUCodec;
+	TPtrC8 iThisLine;
+	
+	HBufC* iRemovedAttachmentTag;		// resource text which is put into the body in place of a removed MIME attachment
+	HBufC* iRetainedAttachmentTag;		// Not used at all - resource text which is put into the body next to a retained MIME attachment
+	HBufC* iDefaultAttachmentName;		// used when no name found	
+	HBufC* iAttachmentFullPath;			// full path to current message file
+
+	TBool iSavingAttachments;			// Turn on/off saving of attachments
+
+	TBuf8<KMaxBoundaryTextLength> iSeekBoundary;
+	
+	TInt iGlobalIndent;
+	TInt iPreviousLineLength;
+	TInt iPreviousTrailingWhitespace;
+	TChar iLastChar;
+	TInt iLongestLine;
+	TBool iNewEntry;
+
+	TImAttachmentFileState iAttachmentFileState;
+	TUint32 iEntryDataSize;
+
+	TBool	iLogFileExists;
+	RFile	iLogFile;
+	TLex8	iLineLex;
+	TTime   iTimeDate;
+
+	//priorities   //vk
+	TInt iPriority;		//{1..5}
+	TInt iXPriority;   // {1..5} 1,2-high, 3-normal, 4,5-low
+	TBuf8<KMaxPriorityTextLength> iPrecedence;  //   {bulk-low, list-normal,first class,special delivery-0}
+	TBuf8<KMaxPriorityTextLength> iImportance;  // {high, low, normal}
+	TMsvPriority iImPriority;
+
+	TMsvId	iEmailServiceId;
+	TBool	iPopulateMessage;
+	CImcvUtils* iImcvUtils;
+
+	TBuf8<KConversionRemainderLength> iLeftOver;
+
+	TMsvId	iSavedEntryId;
+	CArrayFixFlat<TParentDetails>* iParent;
+	// Logging
+	CImLog*					iImcvLog;
+	TMsvId					iBodyId;
+	
+public:
+	TFileName iAttachmentName;
+	CLocalMimeParser* iMimeParser;
+protected:
+	TBool	iRelatedAttachments;
+	CBufBase* iBodyBuf;
+	CMsvBodyText *iBodyText;
+	TInt iStore8BitData;
+	TImAttachmentFile iAttachmentFile;
+	TBool iParsedMimeBoundaryLast;
+	TInt iSizeOfAttachmentsRemoved;
+	HBufC* iPartialEmailFooter;
+	TInt iTopPartialDownloadCounter; // added to support correct attachment downloading after partial download
+	TBool iPartialEmail;
+	RFile*	iFile;
+	};
+
+
+/**
+@internalComponent
+@released
+*/
+class CLocalMimeParser : public CBase
+	{
+public:
+	/*IMPORT_C*/ static CLocalMimeParser* NewLC(CLocalImRecvConvert& aImRecvConvert);
+	/*IMPORT_C*/ static CLocalMimeParser* NewL(CLocalImRecvConvert& aImRecvConvert);
+	/*IMPORT_C*/ ~CLocalMimeParser();
+	void Reset();
+	void ResetForNewEntry();
+	void ParseLineL(const TDesC8& aSourceLine);
+
+	void SetBoundaryL(const TDesC8& aBoundaryText);
+	TBool IsBoundary(const TDesC8& aSourceLine);
+	void RemoveBoundary();
+	
+	inline void StoreMimeHeaderL(CMsvStore& entryStore);
+	inline void StoreMimeHeaderWithoutCommitL(CMsvStore& entryStore);
+	inline void RestoreMimeHeaderL(CMsvStore& entryStore);
+
+	inline TImEncodingType ContentEncoding();
+	inline TMimeContentType ContentType();
+	TPtrC8 ContentSubType() const;
+	TUint CurrentCharsetL() const;
+
+	inline const TBool MessageIsMime() const;
+	inline const TBool IsTerminatingBoundary() const;
+	inline const TBool BoundaryExists() const;
+	inline const TBool BoundaryFound() const;
+	inline const TInt MimeHeaderSize() const;
+	inline const TInt ReceiveError() const;
+	inline const TDesC& ContentDescription() const;
+	inline const TPtrC ContentLocation() const;
+	inline const TPtrC8 ContentId() const;
+	inline const TPtrC8 ContentDisposition() const;
+	inline TBool IsMessageDigest();
+
+	TBool VCard() const;
+	TBool VCalendar() const;
+	TImEmailFolderType MessageFolderType() const;
+	void SetMessageFolderType(TImEmailFolderType aFolderType);
+	TBool StartPart() const;
+	void RestoreMimeParserL(CMsvStore& entryStore);
+	void ExtractParameterInfoL(const TDesC8& aTag, TDes16& rBuffer, TDes8& rBuffer8);	
+	void ExtractParameterInfoL(const TDesC8& aTag, HBufC8*& rBuffer);	
+	TBool MimeFieldsExist() const;
+	void ResetMimeFieldsExist();
+	void DoMultipartTypeForNonMIMEL();
+
+#if defined (_DEBUG)
+	inline TLex8& Lex() {return iLex;};
+#endif
+
+private:
+	CLocalMimeParser(CLocalImRecvConvert& aImRecvConvert);
+	void ConstructL();
+
+	// String scanning functions
+	TBool IsSpecialChar(const TUint8 aChar);
+	TBool MatchAndRemoveToken(const TDesC8& aToken);
+
+	// MIME token recognition functions
+	void DoMimeVersion();
+	void DoContentTypeL();
+	void DoContentLocationL();
+	void DoContentBaseL();
+	void DoContentIdL();
+	void DoEncodingL();
+	void DoDescriptionL();
+	void DoDispositionL();
+
+	// MIME Content-Type type recognition functions
+	void DoTextTypeL();
+	void DoMultipartTypeL();
+	void DoMessageTypeL();
+	void DoAttachmentTypeL();
+
+	// Will be moved to MIUT, but for now ..
+	const TPtrC8 GetContentTypeValue(const TDesC8& aContentTypeParameter) const;
+	      
+	TBool ParseRfc2047ParameterInfoL( const TDesC8& aParam, TDes& rBuffer);
+	TBool ParseRfc2231ParameterInfoL( const TDesC8& aTag, TDes& rBuffer, TInt aOffset );
+	TBool DecodeRfc2231ParameterInfoL( TDes8& aInput, TDes& rBufOut, 
+											TPtrC8 aCharset/*, TPtrC8 aLanguage*/);
+	TPtrC8 ExtractParameterString(TLexMark8& rMark);
+
+private:
+	CLocalImRecvConvert& iImRecvConvert;
+	
+	CImMimeHeader* iMimeHeader;
+	TInt iEmptyMimeHeaderSize;
+	
+	TBool isMime;
+	TBool iCorrectMimeVersion;
+	TImEncodingType iContentEncoding;
+	TMimeContentType iContentType;
+	TFileName iContentDescription;
+	TBool iVCard;
+	TBool iVCalendar;
+	TBool iStartPart;
+	TImEmailFolderType iMessageFolderType;
+	TUint iCharset;
+	TUint iDefaultCharset;
+	HBufC8* iStartId;
+
+	// Boundary stuff
+	CDesC8ArrayFlat* iBoundaryText;
+	TInt iBoundaryIndex;
+	TInt iBoundaryLength;
+	TBool iTerminatingBoundary;
+	TBool iBoundaryFound;
+	TInt iReceiveError; // Indicates if any anomalies were observed whilst the message was received
+						// Can be accessed via the inline ReceiveError()
+	TPtrC8 iTestLine;
+
+	HBufC8* iMimeHeaderLine;
+	TLexMark8 iMark;
+	TLex8 iLex;
+	TLex8 iTestLex;	
+	TBool isMessageDigest;
+	TBool iMimeFieldsExist;
+	};
+
+#include "local_imcvrecv.inl"
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_CheckSmtpBMSetting.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,45 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgCheckSmtpBMSetting class
+// 
+//
+
+#ifndef T_CHECK_SMTP_BM_SETTING_H
+#define T_CHECK_SMTP_BM_SETTING_H
+
+/* User include */
+#include "T_MsgSyncStepSMTP.h"
+
+/* Literal used */
+_LIT(KCheckSmtpBMSetting,"CheckSmtpBMSetting");
+
+/* Implements a test step to check if bearer mobility is supported by SMTP service */
+class CT_MsgCheckSmtpBMSetting : public CT_MsgSyncStepSMTP
+	{
+public:
+	CT_MsgCheckSmtpBMSetting(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	
+	/* CTestStep implementation */
+	virtual TVerdict doTestStepL();
+	
+private:
+	TBool ReadIni();
+	
+private:
+	TPtrC iSmtpAccountName;
+	TBool iExpectedBMSupport;
+	
+	};
+	
+#endif /* T_CHECK_SMTP_BM_SETTING_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_CheckSmtpSNAPSetting.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,45 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgCheckSmtpSNAPSetting class
+// 
+//
+
+#ifndef T_CHECK_SMTP_SNAP_SETTING_H
+#define T_CHECK_SMTP_SNAP_SETTING_H
+
+/* User include */
+#include "T_MsgSyncStepSMTP.h"
+
+/* Literal used */
+_LIT(KCheckSmtpSNAPSetting,"CheckSmtpSNAPSetting");
+
+/* Implements a test step to check the SMTP SNAP information for the account */
+class CT_MsgCheckSmtpSNAPSetting : public CT_MsgSyncStepSMTP
+	{
+public:
+	CT_MsgCheckSmtpSNAPSetting(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	
+	/* CTestStep implementation */
+	virtual TVerdict doTestStepL();
+	
+private:
+	TBool ReadIni();
+	
+private:
+	TPtrC iSmtpAccountName;
+	TBool iExpectedSNAPDefinition;
+	
+	};
+	
+#endif /* T_CHECK_SMTP_SNAP_SETTING_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_CreateSmtpAccount.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,44 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgCreateSmtpAccount class
+// 
+//
+
+#ifndef T_CREATE_SMTP_ACCOUNT_H
+#define T_CREATE_SMTP_ACCOUNT_H
+
+/* User include */
+#include "T_MsgSyncStepSMTP.h"
+
+/* Literal used */
+_LIT(KCreateSmtpAccount,"CreateSmtpAccount");
+
+/* Implements a test step to create an SMTP account reading the settings from a config file */
+class CT_MsgCreateSmtpAccount : public CT_MsgSyncStepSMTP
+	{
+public:
+	CT_MsgCreateSmtpAccount(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+
+	/* CTestStep implementation */
+	virtual TVerdict doTestStepL();
+	
+private:
+	TBool ReadIni();
+
+private:
+	TPtrC iSmtpAccountName;
+	TPtrC iConfigFileName;
+	
+	};
+#endif /* T_CREATE_SMTP_ACCOUNT_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_CreateSmtpMessageFromEmailFile.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,54 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_CREATE_SMTP_MESSAGE_FROM_EMAIL_FILE_H__
+#define __T_CREATE_SMTP_MESSAGE_FROM_EMAIL_FILE_H__
+
+
+// User Includes 
+#include "T_MsgSyncStepSMTP.h"
+#include "T_MsgSharedDataSmtp.h"
+
+
+// Literals Used  
+_LIT(KCreateSmtpMessageFromEmailFile,"CreateSmtpMessageFromEmailFile");
+
+
+/**
+This class implements the test step that creates the SMTP message
+*/
+class CT_MsgCreateSmtpMessageFromEmailFile : public CT_MsgSyncStepSMTP
+	{
+public:	
+	static CT_MsgCreateSmtpMessageFromEmailFile* NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	~CT_MsgCreateSmtpMessageFromEmailFile();
+
+	//	CTestStep implementation
+	TVerdict doTestStepL(); 	
+private:
+	CT_MsgCreateSmtpMessageFromEmailFile(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	};
+#endif //__T_CREATE_SMTP_MESSAGE_FROM_EMAIL_FILE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_CreateSmtpMobilityAccount.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,34 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef __T_CREATESMTPMOBILITYACCOUNT_H__
+#define __T_CREATESMTPMOBILITYACCOUNT_H__
+
+#include "T_MsgSyncStepSMTP.h"
+
+_LIT(KCreateSmtpMobilityAccount, "CreateSmtpMobilityAccount");
+
+class CT_MsgCreateSmtpMobilityAccount : public CT_MsgSyncStepSMTP
+	{
+public:	
+	static CT_MsgCreateSmtpMobilityAccount* NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+
+	//	CTestStep implementation
+	TVerdict doTestStepL();
+private:
+	CT_MsgCreateSmtpMobilityAccount(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	};
+
+#endif //__T_CREATESMTPMOBILITYACCOUNT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_ModifySmtpSettings.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,39 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgModifySmtpSettings class
+// 
+//
+
+#ifndef T_MODIFY_SMTP_SETTINGS_H
+#define T_MODIFY_SMTP_SETTINGS_H
+
+/* User include */
+#include "T_MsgSyncStepSMTP.h"
+
+/* Literal used */
+_LIT(KModifySmtpSettings,"ModifySmtpSettings");
+
+/* Implements a test step that modifies the settings of the specified Smtp account
+   via the given config file */
+class CT_MsgModifySmtpSettings : public CT_MsgSyncStepSMTP
+	{
+public :
+	CT_MsgModifySmtpSettings(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+
+	~CT_MsgModifySmtpSettings();
+
+	/* CTestStep implementation */
+	TVerdict doTestStepL();
+	};
+#endif /* T_MODIFY_SMTP_SETTINGS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_MsgAsyncStepSMTP.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,48 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* References SMTP shared data for use by derived test steps.
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+#ifndef __T_MSG_ASYNCSTEPSMTP_H__
+#define __T_MSG_ASYNCSTEPSMTP_H__
+
+//user includes
+#include "T_MsgAsyncStep.h"
+#include "T_MsgSharedDataSmtp.h"
+
+
+/**
+Base class for asynchronous SMTP teststeps.
+*/
+class CT_MsgAsyncStepSMTP : public CT_MsgAsyncStep
+	{
+protected:
+	CT_MsgAsyncStepSMTP(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+
+protected:
+	CT_MsgSharedDataSmtp&	iSharedDataSMTP;
+	};
+
+#endif // __T_MSG_ASYNCSTEPSMTP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_MsgSharedDataSmtp.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,62 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This contains CT_MsgSharedDataSmtp
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_MSG_SHARED_DATA_SMTP_H__
+#define __T_MSG_SHARED_DATA_SMTP_H__
+
+
+// User includes
+#include "T_MsgSharedDataBase.h"
+
+
+/**
+Implements the class for sharing data across the test steps created by SMTP test server.  
+*/
+class CT_MsgSharedDataSmtp : public CT_MsgSharedDataBase
+	{
+public:
+	static CT_MsgSharedDataSmtp* NewL();
+	~CT_MsgSharedDataSmtp();
+
+protected:
+	virtual CBaseMtm*	NewMtmL();
+	CT_MsgSharedDataSmtp();
+
+private:
+	void ConstructL();
+
+public:
+	CPeriodic* 	iPeriodic;
+	TInt  		iMaxRamValue;
+	TInt  		iMinRamValue;
+	TInt  		iStartRamValue;
+	TInt  		iEndRamValue;
+	TBool 		iMark;
+	};
+
+#endif // __T_MSG_SHARED_DATA_SMTP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_MsgSyncStepSMTP.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,49 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Sync step class owning SMTP shared data for use by derived test steps.
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_MSG_SYNC_STEP_SMTP_H__
+#define __T_MSG_SYNC_STEP_SMTP_H__
+
+//user includes
+#include "T_MsgStep.h"
+#include "T_MsgSharedDataSmtp.h"
+
+
+/**
+Base class for synchronous SMTP teststeps.
+*/
+class CT_MsgSyncStepSMTP : public CT_MsgStep
+	{
+protected:
+	CT_MsgSyncStepSMTP(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+
+protected:
+	CT_MsgSharedDataSmtp&	iSharedDataSMTP;
+	};
+
+#endif // __T_MSG_SYNC_STEP_SMTP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_RemoveSmtpSNAPSetting.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,44 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgRemoveSmtpSNAPSetting class
+// 
+//
+
+#ifndef T_REMOVE_SMTP_SNAP_SETTING_H
+#define T_REMOVE_SMTP_SNAP_SETTING_H
+
+/* User include */
+#include "T_MsgSyncStepSMTP.h"
+
+/* Literal used */
+_LIT(KRemoveSmtpSNAPSetting,"RemoveSmtpSNAPSetting");
+
+/* Implements a test step to remove the SMTP SNAP information for the account */
+class CT_MsgRemoveSmtpSNAPSetting : public CT_MsgSyncStepSMTP
+	{
+public:	
+	CT_MsgRemoveSmtpSNAPSetting(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	
+	/* CTestStep implementation */
+	virtual TVerdict doTestStepL();
+	
+private:
+	TBool ReadIni();
+	
+private:
+	TPtrC iSmtpAccountName;
+	
+	};
+	
+#endif /* T_REMOVE_SMTP_SNAP_SETTING_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_RetrievePlainBodyTextAndCompare.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_RetrievePlainBodyTextAndCompare
+* 
+*
+*/
+
+
+
+
+
+
+
+#ifndef __T_RETRIEVEPLAINBODYTEXTANDCOMPARE_H__
+#define __T_RETRIEVEPLAINBODYTEXTANDCOMPARE_H__
+
+
+// User includes
+#include "T_MsgAsyncStepSMTP.h"
+#include "T_MsgSharedDataSmtp.h"
+
+
+// Literals used 
+_LIT(KRetrievePlainBodyTextAndCompare,"RetrievePlainBodyTextAndCompare");
+
+
+/* 
+ * Implements a test step that edit a message body text 
+ */
+class CT_RetrievePlainBodyTextAndCompare : public CT_MsgAsyncStepSMTP
+	{
+public:
+	static CT_RetrievePlainBodyTextAndCompare* NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	~CT_RetrievePlainBodyTextAndCompare();
+
+	// CTestStep implementation 
+	virtual TVerdict doTestStepL();
+
+
+private:
+	CT_RetrievePlainBodyTextAndCompare(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+
+	virtual void ProgressL(TBool bFinal);
+	virtual void CancelStep();
+	};
+#endif // __T_RETRIEVEPLAINBODYTEXTANDCOMPARE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_SendSmtpMessage.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,67 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file for CT_MsgSendSmtpMessage
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_SEND_SMTP_MESSAGE_H__
+#define __T_SEND_SMTP_MESSAGE_H__
+
+
+// User Includes
+#include "T_MsgAsyncStepSMTP.h"
+#include "T_MsgSharedDataSmtp.h"
+
+
+//Literals Used
+_LIT(KSendSmtpMessage,"SendSmtpMessage");
+
+
+/**
+Implements a test step to send a message
+*/
+class CT_MsgSendSmtpMessage :  public CT_MsgAsyncStepSMTP
+	{
+public:
+	static CT_MsgSendSmtpMessage* NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+   ~CT_MsgSendSmtpMessage();
+
+	//	CTestStep implementation
+	virtual TVerdict	doTestStepL();
+
+private:
+	CT_MsgSendSmtpMessage(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+
+	//	CT_MsgAsyncStep implementation
+	virtual void	ProgressL(TBool bFinal);
+
+	//	MT_MsgActiveCallback implementation
+	virtual void	CancelStep();
+
+private:
+	CMsvOperation*	iOperation;
+	};
+
+#endif //__T_SEND_SMTP_MESSAGE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_SmtpCreateForwardMessage.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_SmtpCreateForwadMessage
+* 
+*
+*/
+
+
+
+
+
+
+#ifndef __T_SMTPCREATE_FORWARDMESSAGE_H__
+#define __T_SMTPCREATE_FORWARDMESSAGE_H__
+
+
+// User includes
+#include "T_MsgAsyncStepSMTP.h"
+
+
+// Literals used 
+_LIT(KSmtpCreateForwadMessage,"SmtpCreateForwadMessage");
+
+
+/* 
+ * Implements a test step that create a forwrad message using the SMTP client MTM command
+ */
+class CT_SmtpCreateForwadMessage : public CT_MsgAsyncStepSMTP
+	{
+public:
+	static CT_SmtpCreateForwadMessage* NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	~CT_SmtpCreateForwadMessage();
+
+	// CTestStep implementation 
+	virtual TVerdict doTestStepL();
+
+private:
+	CT_SmtpCreateForwadMessage(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	void SetHeaderPartL();
+	void GetDefaultAddressL();
+
+	virtual void ProgressL(TBool bFinal);
+	virtual void CancelStep();
+
+private:
+	HBufC* iRecipientAddress;
+	CMsvOperation*	iOperation;
+	};
+#endif // __T_SMTPCREATE_FORWARDMESSAGE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_SmtpCreateReplyMessage.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_SmtpCreateReplyMessage
+* 
+*
+*/
+
+
+
+
+
+
+#ifndef __T_SMTPCREATE_REPLYMESSAGE_H__
+#define __T_SMTPCREATE_REPLYMESSAGE_H__
+
+
+// User includes
+#include "T_MsgAsyncStepSMTP.h"
+
+
+// Literals used 
+_LIT(KSmtpCreateReplyMessage,"SmtpCreateReplyMessage");
+
+
+/* 
+ * Implements a test step that create a reply message using the SMTP client MTM command
+ */
+class CT_SmtpCreateReplyMessage : public CT_MsgAsyncStepSMTP
+	{
+public:
+	static CT_SmtpCreateReplyMessage* NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	~CT_SmtpCreateReplyMessage();
+
+	// CTestStep implementation 
+	virtual TVerdict doTestStepL();
+
+private:
+	CT_SmtpCreateReplyMessage(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	void SetHeaderPartL();
+	
+	virtual void ProgressL(TBool bFinal);
+	virtual void CancelStep();
+	
+private:
+	CMsvOperation*	iOperation;
+	};
+#endif // __T_SMTPCREATE_REPLYMESSAGE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_SmtpSendEmail.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,75 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file for CT_MsgSmtpSendEmail
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_SMTP_SEND_EMAIL_H__
+#define __T_SMTP_SEND_EMAIL_H__
+
+
+// user includes
+#include <testexecutestepbase.h>
+#include "T_MsgAsyncStepSMTP.h"
+#include "T_MsgSharedDataSmtp.h"
+
+
+//Literals Used
+_LIT(KSmtpSendEmail,"SmtpSendEmail");
+_LIT(KNone, "NONE");
+
+
+// Forward declaration
+class CT_MsgUtilsSendEmail;
+class CT_MsgUtilsConfigFileMachineName;
+
+
+/**
+Implements a test step to send an email
+*/
+class CT_MsgSmtpSendEmail :  public CT_MsgAsyncStepSMTP
+	{
+public:
+	static CT_MsgSmtpSendEmail* NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	~CT_MsgSmtpSendEmail();
+
+	//	CTestStep implementation
+	virtual TVerdict	doTestStepL();
+
+private:
+	CT_MsgSmtpSendEmail(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+
+	//	CT_MsgAsyncStep implementation
+	virtual void	ProgressL(TBool bFinal);
+
+	//	MT_MsgActiveCallback implementation
+	virtual void	CancelStep();
+
+public:
+ 	CT_MsgUtilsSendEmail*				iSendEmail;  
+ 	CT_MsgUtilsConfigFileMachineName*	iMachineNameFile;   
+	};
+
+#endif //__T_SMTP_SEND_EMAIL_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_SmtpServer.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,62 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This contains the header file for SMTP server
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_SMTP_SERVER_H__
+#define __T_SMTP_SERVER_H__
+
+
+// User defined classes
+#include "T_MsgServer.h"
+#include "T_MsgSharedDataSmtp.h"
+
+
+//Literals Used
+_LIT(KSmtpServer,"T_MsgSmtpServer");
+
+
+/**
+Implements the SMTP test server
+*/
+class CT_MsgSmtpServer : public CT_MsgServer
+	{
+public:
+	static CT_MsgSmtpServer* NewL();
+
+private:
+	CT_MsgSmtpServer();
+	// Creates the test steps based on the test step name 
+	virtual CTestStep*	CreateTestStepL(const TDesC& aStepName);
+
+	// Creates an object of Shared Data
+	virtual CT_MsgSharedDataBase* NewSharedDataL();
+
+public:
+	// Creates session object and SMTP MTM					
+	CT_MsgSharedDataSmtp* iSharedDataSMTP;
+	};
+#endif //__T_SMTP_SERVER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_StartRamUsageTimer.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_StartRamUsageTimer
+* 
+*
+*/
+
+
+
+
+
+
+
+#ifndef _T_START_RAM_USAGE_TIMER_
+#define _T_START_RAM_USAGE_TIMER_
+
+
+// User includes 
+#include "T_MsgAsyncStepSMTP.h"
+
+// Literals used 
+_LIT(KStartRamUsageTimer,"StartRamUsageTimer");
+
+/**
+Implement a wrapper class over HAL APIs and 
+setting the periodic Timer to monitor the RAM usage
+ */
+class CT_StartRamUsageTimer : public CT_MsgAsyncStepSMTP
+	{
+public:
+	CT_StartRamUsageTimer(CT_MsgSharedDataSmtp& aSharedDataSMTP);	
+	~CT_StartRamUsageTimer();
+
+	static TInt RamUsage(TAny* aObject);
+	void DoRamUsage();
+
+private:
+     void ProgressL(TBool aFinal);
+     void CancelStep();
+     
+	// CTestStep implementation 
+	virtual TVerdict	doTestStepL();	
+	};
+
+
+#endif // _T_START_RAM_USAGE_TIMER_ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_StopRamUsageTimer.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_StopRamUsageTimer
+* 
+*
+*/
+
+
+
+
+
+
+
+#ifndef _T_STOP_RAM_USAGE_TIMER_
+#define _T_STOP_RAM_USAGE_TIMER_
+
+
+// User includes 
+#include "T_MsgAsyncStepSMTP.h"
+
+// Literals used 
+_LIT(KStopRamUsageTimer,"StopRamUsageTimer");
+
+// Implement a test step to stop the periodic Timer 
+class CT_StopRamUsageTimer :public CT_MsgAsyncStepSMTP
+	{
+public:
+	CT_StopRamUsageTimer(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	~CT_StopRamUsageTimer();
+private:
+     void ProgressL(TBool aFinal);
+     void CancelStep();
+     
+	// CTestStep implementation 
+	virtual TVerdict	doTestStepL();	
+	};
+
+
+#endif // _T_STOP_RAM_USAGE_TIMER_ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/T_UtilsSendEmail.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,97 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file for CT_MsgUtilsSendEmail
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_UTILS_SMTP_SEND_EMAIL_H__
+#define __T_UTILS_SMTP_SEND_EMAIL_H__
+
+
+// User  Includes
+#include <testexecutestepbase.h>
+
+
+// Epoc includes
+#include <imsk.h>
+
+// Forward Declaration
+class CImIAPPreferences;
+
+
+/**
+Implements a utility that performs the sending of the email
+*/
+class CT_MsgUtilsSendEmail : public CActive
+	{
+public:
+	static CT_MsgUtilsSendEmail* NewL(CTestStep& aTestStep);
+	~CT_MsgUtilsSendEmail();
+public:	
+	void StartL(TPtrC aSender,TPtrC aReceipient,TPtrC aMailFile,TPtrC aServerIP,
+											TRequestStatus& aStatus);
+protected:
+	void DoCancel();
+	void RunL();
+private:
+	CT_MsgUtilsSendEmail(CTestStep& aTestStep);
+private:
+	enum TSmtpSendState
+		{
+		ESmtpNotConnected,
+		ESmtpConnecting,
+		ESmtpSendHELO,
+		ESmtpSendMailFrom,
+		ESmtpSendRcptTo,
+		ESmtpSendData,
+		ESmtpSendContent,
+		ESmtpSendEndData,
+		ESmtpSendLogout,
+		ESmtpReceiveReply
+		};
+
+	enum TSmtpReceiveState
+		{
+		ESmtpHeloReply,
+		ESmtpFromReply,
+		ESmtpRcptReply,
+		ESmtpDataReply,
+		ESmtpContentReply,
+		ESmtpLogoutReply
+		};
+public:
+	TPtrC iSender;
+	TPtrC iReceipient;
+private:
+	TRequestStatus* iRequestStatus;
+	CImTextServerSession* iImSocket;
+	TInt iSendState;
+	TInt iRecvState;
+	RFs iFs;
+	RFile iFile;
+	CImIAPPreferences* iIapPrefs;
+	CTestStep& iTestStep;
+	};
+#endif //__T_UTILS_SMTP_SEND_EMAIL_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/local_imcvrecv.inl	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,203 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Class CRfc822Token Inline functions
+* 
+*
+*/
+
+
+
+
+
+
+/**
+ @file
+*/
+
+inline HBufC8* CLocalRfc822Token::OutputLine()
+	{
+	return iOutputLine;
+	}
+
+inline TBool CLocalRfc822Token::LastToken()
+	{
+	return iLastToken;
+	}
+
+inline void CLocalRfc822Token::SetImRecvConvert( CLocalImRecvConvert* aImRecvConvert )
+	{
+	iImRecvConvert = aImRecvConvert;
+	}
+
+
+/****************************************************************************
+	Class CLocalImRecvConvert Inline functions
+*****************************************************************************/
+
+inline void CLocalImRecvConvert::SetAttachmentPathL(const TDesC& aFullPath)
+	{
+	// get full path to current message file = directory path
+	if (iAttachmentFullPath)
+		{
+		delete iAttachmentFullPath;
+		iAttachmentFullPath=NULL;
+		}
+	iAttachmentFullPath=aFullPath.AllocL();
+	}
+
+inline void CLocalImRecvConvert::SetMsvId(TMsvId aId)
+	{
+	iServerEntry->SetEntry(aId);
+	iPopulateMessage = (iServerEntry->Entry().iType == KUidMsvMessageEntry);
+	iRootEntryId = aId;
+	}
+
+inline const TTime CLocalImRecvConvert::Date() const
+	{
+	return iTimeDate;
+	}
+
+inline const TMsvPriority CLocalImRecvConvert::Priority() const
+	{
+	return iImPriority;
+	}
+
+inline void CLocalImRecvConvert::SaveAllAttachments(TBool aSave)
+	{
+	iSavingAttachments=aSave;
+	}
+
+inline const TInt CLocalImRecvConvert::ReceiveError() const
+	{
+	return iReceiveError;
+	}
+
+inline CMsvServerEntry& CLocalImRecvConvert::ServerEntry()
+	{
+	return *iServerEntry;
+	}
+
+inline const TBool CLocalImRecvConvert::ValidCompleteHeader() const
+	{
+	return (iEmptyHeaderSize<(iOutputHeader->DataSize()) && iFinishedHeader);
+	}
+
+inline const CImHeader& CLocalImRecvConvert::Header() const
+	{
+	return *iOutputHeader;
+	}
+
+inline TBool CLocalImRecvConvert::NotFinishedRfc822Header()
+	{
+	return iNotFinishedRfc822Header;
+	}
+
+inline CImConvertCharconv& CLocalImRecvConvert::CharacterConverter()
+	{
+	return *iCharConv;
+	}
+
+/****************************************************************************
+	Class CLocalMimeParser Inline functions
+*****************************************************************************/
+inline void CLocalMimeParser::StoreMimeHeaderL(CMsvStore& entryStore)
+	{
+	iMimeHeader->StoreL(entryStore);
+	}
+
+inline void CLocalMimeParser::StoreMimeHeaderWithoutCommitL(CMsvStore& entryStore)
+	{
+	iMimeHeader->StoreL(entryStore);
+	}
+
+inline void CLocalMimeParser::RestoreMimeHeaderL(CMsvStore& entryStore)
+	{
+	RestoreMimeParserL(entryStore);
+	}
+
+inline TMimeContentType CLocalMimeParser::ContentType()
+	{
+	return iContentType;
+	}
+
+inline TImEncodingType CLocalMimeParser::ContentEncoding()
+	{
+	return iContentEncoding;
+	}
+
+inline const TBool CLocalMimeParser::MessageIsMime() const
+	{
+	return isMime;
+	}
+
+inline const TDesC& CLocalMimeParser::ContentDescription() const
+	{
+	return iContentDescription;
+	}
+
+inline const TPtrC CLocalMimeParser::ContentLocation() const
+	{
+	return iMimeHeader->ContentLocation();
+	}
+
+inline const TPtrC8 CLocalMimeParser::ContentId() const
+	{
+	return iMimeHeader->ContentID();
+	}
+
+inline const TPtrC8 CLocalMimeParser::ContentDisposition() const
+	{
+	return iMimeHeader->ContentDisposition();
+	}
+
+inline const TBool CLocalMimeParser::IsTerminatingBoundary() const
+	{
+	return iTerminatingBoundary;
+	}
+
+inline const TBool CLocalMimeParser::BoundaryExists() const
+	{
+	return (iBoundaryLength!=0);
+	}
+
+inline const TBool CLocalMimeParser::BoundaryFound() const
+	{
+	return iBoundaryFound;
+	}
+
+inline const TInt CLocalMimeParser::MimeHeaderSize() const
+	{
+	return iEmptyMimeHeaderSize-iMimeHeader->Size();
+	}
+
+inline const TInt CLocalMimeParser::ReceiveError() const
+	{
+	return iReceiveError;
+	}
+
+inline TBool CLocalMimeParser::IsMessageDigest()
+	{
+	return (ContentType()==EMimeMultipart && ContentSubType().Compare(KImcvDigest)==0);
+	}
+
+inline TBool CLocalMimeParser::MimeFieldsExist() const
+	{
+	return iMimeFieldsExist;
+	}
+
+inline void CLocalMimeParser::ResetMimeFieldsExist()
+	{
+	iMimeFieldsExist=EFalse;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/local_imutdll.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,88 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __LOCAL_IMUTDLL_H__
+#define __LOCAL_IMUTDLL_H__
+
+#ifndef __E32STD_H__
+#include <e32std.h>
+#endif
+
+#ifndef __BARSC_H__
+#include <barsc.h>		// RResourceFile
+#endif
+
+
+/**
+Panics and errors codes for email message creation.
+*/
+enum TImutErrorReason {	KPanicNoRfc822Header = 1,
+						KPanicNoRichText,
+						EPanicNullTokenizer,
+						KPanicBoundaryTooLong,
+						KPanicUnknownSendingMethod,
+						KPanicInvalidSMTPLine,
+						KPanicAttachmentPathNotSet,
+						KPanicNoMimeClassAvailable,
+						KPanicUnknownAlgorithm,
+						KPanicSetAlgorithmLNotCalled,
+						KPanicNoResourceFile,
+						KPanicDescriptorToSmall,
+						KPanicReadLengthTooLarge,
+						KPanicFileNotFlushed,
+						KPanicEntryIsNotMessage,
+						KPanicMessageEntryNotCalled,
+						KPanicMessageEntryIdHasChanged,
+						KPanicServiceIdNotValid,
+						KPanicIncorrectResetState,
+						KPanicNoMimeHeader,
+						KPanicInvalidDefaultCharacterSet,
+						KPanicUnknownFolderType,
+						KPanicInvalidEncodingType,
+						EPanicInvalidHeaderState,
+						EImskSocketNotConnected,
+						EImskSocketStillActive,
+						EImskSocketOpen,
+						EImskUnknownState,
+						EImskInvalidPortNumber,
+						EImskInvalidSocketEncryptionMethod,
+						EImskSecurityFailed,
+						EImskDatabaseTypeUnspecified,
+						EImskNotSupported,
+	 					EImskUnknownBearer,
+						EImskNoTLSResponseString	
+						};
+
+// and some error codes
+const TInt KErrCorruptHeader = 1;
+
+GLDEF_C void gPanic( TImutErrorReason aReason );
+
+GLREF_C void OpenResourceFileL(RResourceFile& aFile, RFs& anFs);
+
+GLDEF_C void CloseResourceFile( TAny* aResourceFile );
+
+#endif // __LOCAL_IMUTDLL_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/inc/t_smtpcreatenewmessagewithplainbodytext.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_SmtpCreateNewMessageWithPlainBodyText
+* 
+*
+*/
+
+
+
+
+
+
+#ifndef __T_SMTP_CREATENEWMESSAGE_WITHPLAINBODYTEXT_H__
+#define __T_SMTP_CREATENEWMESSAGE_WITHPLAINBODYTEXT_H__
+
+
+// User includes
+#include "T_MsgAsyncStepSMTP.h"
+#include "T_MsgSharedDataSmtp.h"
+
+// Epoc includes 
+#include <imapcmds.h>
+#include <msvstd.h>
+#include <mtclbase.h>
+
+// Literals used 
+_LIT(KSmtpCreateNewMessageWithPlainBodyText,"SmtpCreateNewMessageWithPlainBodyText");
+
+
+/* 
+ * Implements a test step that create a message with plain body text
+ */
+class CT_SmtpCreateNewMessageWithPlainBodyText : public CT_MsgAsyncStepSMTP
+	{
+public:
+	static CT_SmtpCreateNewMessageWithPlainBodyText* NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	~CT_SmtpCreateNewMessageWithPlainBodyText();
+
+	// CTestStep implementation 
+	virtual TVerdict doTestStepL();
+
+private:
+	CT_SmtpCreateNewMessageWithPlainBodyText(CT_MsgSharedDataSmtp& aSharedDataSMTP);
+	void SetHeaderPartL();
+	void GetDefaultAddressL();
+	void PopulateBodyPartL();
+
+	virtual void ProgressL(TBool bFinal);
+	virtual void CancelStep();
+	
+private:
+	HBufC* iRecipientAddress;	
+	CMsvOperation*	iOperation;
+	};
+#endif // __T_SMTP_CREATENEWMESSAGE_WITHPLAINBODYTEXT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/ImCltCvRecv.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,1444 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+*/
+
+#include <imcm.rsg>
+#include <barsread.h>
+
+#include <imcvcodc.h>
+#include <imcvutil.h>
+#include <cmsvbodytext.h>
+#include "ImCltCvRecv.h"
+
+#ifdef __WINS__
+#include <e32wins.h> 
+#include <msvapi.h>
+#endif
+
+#ifndef __WINS__
+#include <msvapi.h>
+#endif
+#include <cmsvattachment.h> 
+#include <mmsvattachmentmanager.h>
+#include <mmsvattachmentmanagersync.h>
+
+#ifndef _MSG_NO_LOGGING
+#define __IMUT_LOGGING
+_LIT(KLogFilePath, "c:\\logs\\mailtext\\in.txt");
+_LIT8(KNewLogHeader, "\r\n------ New Receive Session ------\r\n");
+_LIT8(KFound, "found: ");
+_LIT8(KPartLine, "unknown or part line");
+_LIT8(KEndOFHeader, "End of header");
+_LIT8(KSkippingData, "Skipping data");
+
+_LIT8(KFoundMIMEBoundary, "MIME boundary");
+_LIT8(KRemoveBoundary, "Remove boundary");
+_LIT8(KRemovedBoundary, "Removed boundary");
+_LIT8(KSectionHeader, "Section header");
+_LIT8(KWritingToFile, "writing attachment");
+_LIT8(KWroteToFile, "wrote attachment");
+_LIT8(KFailedToWriteToFile, "Failed to write to attachment file");
+_LIT8(KFoundUUEStartBoundary, "UUE start boundary");
+_LIT8(KFoundUUEEndBoundary, "UUE end boundary");
+_LIT8(KReset, "Resetting CImRecvConvert");
+_LIT8(KReseted, "Resetting CImRecvConvert");
+_LIT8(KLastToken, "That was the last token");
+_LIT8(KResetForNewEntry, "Reset for a New Entry");
+_LIT8(KResetedForNewEntry, "Reseted for a New Entry");
+_LIT8(KCreatingEntry, "Creating Entry");
+_LIT8(KCreatedEntry, "Created Entry");
+_LIT8(KUpdatingEntry, "Updating Entry");
+_LIT8(KUpdatedEntry, "Updated Entry");
+_LIT8(KMoveToParentEntry, "Moved to parent entry");
+_LIT8(KMovedToParentEntry, "End of Moved to parent entry");
+
+_LIT8(KIgnoringStreams, "Discarding streams");
+_LIT8(KStartMessageComplete, "Start Message Complete");
+_LIT8(KMessageComplete, "Message Complete");
+_LIT8(KHeaderComplete, "Message Header complete");
+_LIT8(KReturnReceiptTo, "return-receipt-To is set");
+_LIT8(KStartStoringEntryStream, "Starting Storing Entry Stream");
+_LIT8(KStoringEntryStream, "Storing Entry Stream");
+_LIT8(KDoneStoringEntryStream, "Done Storing Entry Stream");
+
+#endif // _MSG_NO_LOGGING
+
+// uncomment the line below if logging is to be enabled
+
+#if defined(__IMUT_LOGGING)
+#define RECVLOG(text) (iImcvLog?iImcvLog->AppendComment(text):void(0));
+#define RECVLOG_OUT(text) (iImcvLog?iImcvLog->AppendOut(text):void(0));
+#define LOGGING(string1, string2) (Logging(string1, string2));
+#else
+#define RECVLOG(text) (void(0));
+#define RECVLOG_OUT(text) (void(0));
+#define LOGGING(string1, string2) (void(0));
+#endif
+
+
+const TInt KBodyTextChunkSizeBytes = 512;
+
+
+/**
+NewLC()
+Static factory constructor. Uses two phase construction 
+and pushes the newly created object into the Cleanup stack.
+
+@param anFs
+@param aClientEntry
+@param aMsgType
+@param aEmailServiceId
+@return
+*/
+ CImCltRecvConvert* CImCltRecvConvert::NewLC(RFs& anFs,CMsvEntry* aClientEntry,TUid aMsgType,TMsvId aEmailServiceId)
+	{
+	CImCltRecvConvert* self = new (ELeave) CImCltRecvConvert(anFs,aClientEntry,aMsgType,aEmailServiceId);
+	CleanupStack::PushL(self);
+	self->ConstructL(anFs);
+	return self;
+	}
+
+
+/**
+NewL()
+Static factory constructor. Uses two phase construction.
+
+@param anFs
+@param aClientEntry
+@param aMsgType
+@param aEmailServiceId
+@return
+*/
+ CImCltRecvConvert* CImCltRecvConvert::NewL(RFs& anFs,CMsvEntry* aClientEntry,TUid aMsgType,TMsvId aEmailServiceId)
+	{
+	CImCltRecvConvert* self = CImCltRecvConvert::NewLC(anFs,aClientEntry,aMsgType,aEmailServiceId);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+/**
+ConstructL()
+
+@param anFs
+*/
+void CImCltRecvConvert::ConstructL(RFs& anFs)
+	{
+	iFsSession = &anFs;  
+
+	RResourceFile resFile;
+	OpenResourceFileL(resFile, anFs);	// NB leaves if file not found
+
+	// make sure the resource file will be closed if anything goes wrong
+	// CloseResourceFile is declared in IMUTDLL.H and defined in IMUTDLL.CPP
+	TCleanupItem close( CloseResourceFile, &resFile );
+	CleanupStack::PushL( close );
+	
+	// Read iStore8BitData flag.
+	HBufC8* buf = resFile.AllocReadLC(STORE_8BIT_BODY_TEXT);
+	TResourceReader reader;
+	reader.SetBuffer(buf);
+	iStore8BitData = reader.ReadInt8();
+	CleanupStack::PopAndDestroy(buf);
+
+	buf = resFile.AllocReadLC(REMOVED_ATTACHMENT_TAG);
+	reader.SetBuffer(buf);
+	iRemovedAttachmentTag = reader.ReadTPtrC().AllocL();
+	CleanupStack::PopAndDestroy(buf);
+	
+	buf = resFile.AllocReadLC(DEFAULT_ATTACHMENT_NAME);
+	reader.SetBuffer(buf);
+	iDefaultAttachmentName = reader.ReadTPtrC().AllocL();
+	CleanupStack::PopAndDestroy(buf);
+	buf = resFile.AllocReadLC(PARTIAL_DOWNLOAD_FOOTER_MESSAGE);
+	reader.SetBuffer(buf);
+	iPartialEmailFooter = (reader.ReadTPtrC()).AllocL();
+	CleanupStack::PopAndDestroy(buf);
+	buf = NULL;
+	CleanupStack::PopAndDestroy(&resFile);
+
+	// create CImHeader object to store Rfc822 header info...
+	iOutputHeader = CImHeader::NewLC();
+	CleanupStack::Pop();			   
+
+	if (iStore8BitData)
+		{
+		//Create body text storage helper.
+		iBodyText = CMsvBodyText::NewL();
+		}
+	else
+		{
+		// create CRichText object to store body...
+		iParaLayer = CParaFormatLayer::NewL();
+		iCharLayer = CCharFormatLayer::NewL();
+		iOutputBody = CRichText::NewL(iParaLayer, iCharLayer);
+		}
+	
+	// Create Rfc822 filter object...
+	iRfc822Token = CLocalRfc822Token::NewLC();
+	CleanupStack::Pop();				 
+	iRfc822Token->SetImRecvConvert(this);
+
+	// Create converter objects...
+	iCharacterConverter = CCnvCharacterSetConverter::NewL();
+	iCharConv = CImConvertCharconv::NewL(*iCharacterConverter, anFs);
+	iHeaderConverter = CImConvertHeader::NewL(*iCharConv); 
+
+	
+	// Create MIME filter object...
+	iMimeParser = CLocalMimeParser::NewL(*this);
+	
+	
+	// logfile stuff
+	iImcvLog=NULL;
+
+#ifdef __IMUT_LOGGING	
+	TRAP_IGNORE(iImcvLog=CImLog::NewL(KLogFilePath, EAppend));
+#endif
+
+	iRootEntryId = EntryId();
+
+	iNotFinishedRfc822Header = ETrue;
+	
+	iEmailEntry = new (ELeave) TMsvEmailEntry;
+	iReceivingHeadersOnly=EFalse;	
+
+	iParent = new (ELeave) CArrayFixFlat<TParentDetails>(3);
+
+	iFirstBoundaryReached=EFalse;
+
+	ResetL();
+	
+	RECVLOG( KNewLogHeader )
+	}
+
+
+/**
+CImCltRecvConvert()
+
+@param anFs
+@param aClientEntry
+@param aMsgType
+@param aEmailServiceId
+*/
+
+CImCltRecvConvert::CImCltRecvConvert(RFs& anFs,CMsvEntry* aClientEntry,TUid aMsgType,TMsvId aEmailServiceId)
+	: CLocalImRecvConvert(anFs,iNullServerEntry,aMsgType,aEmailServiceId),
+	  iClientEntry(aClientEntry)
+	{
+	__DECLARE_NAME(_S("CImCltRecvConvert"));
+	}
+
+
+/**
+~CImCltRecvConvert()
+Destructor
+*/
+CImCltRecvConvert::~CImCltRecvConvert()
+	{
+	}
+
+
+/**
+ResetForHeadersL()
+*/
+ void CImCltRecvConvert::ResetForHeadersL()
+	{
+	// This function is used in preference to ResetL() when the owner
+	// only wishes to create  email entries in the remote mailbox - 
+	// they do not wish to create any stores associated with the message
+	// entry
+	ResetL();
+	iReceivingHeadersOnly = ETrue;
+	}
+
+
+/**
+ResetL()
+*/
+ void CImCltRecvConvert::ResetL()
+	{
+	RECVLOG(KReset) 
+
+	iBodyId=KMsvNullIndexEntryId;
+	iSizeOfAttachmentsRemoved=0;
+	iClientEntry->SetEntryL(iRootEntryId);
+	
+	iReceivingHeadersOnly=EFalse;
+	iMessageEntryCalled=EFalse;
+	iLeaveError=KErrNone; 		
+	iCurrentMultipartFolderEntryId=0;
+
+	TParentDetails parent;
+	parent.iAttachment=parent.iMHTML=EFalse;
+	parent.iSize=0;
+	iParent->InsertL(0,parent);
+
+	if(iEmailEntry)
+		{
+		delete iEmailEntry;
+		iEmailEntry=NULL;
+		}
+	iEmailEntry = new (ELeave) TMsvEmailEntry;
+
+	// "iSavingAttachments" commands this code to store attachments in files.
+	// Currently this is always set to ETrue as we intend to save all attachments
+	// However, if the user wishes to discard (ie do not save) any 
+	// attachments in incoming email messages - then this member variable
+	// may be set to EFalse by the inline accessor function "SaveAllAttachments(TBool)"
+	iSavingAttachments=ETrue;
+	iAttachmentFileState=EFileIsClosed;
+
+	// iLeaveError contains the error value of any functions that leaves (ie CRichText::InsertL)
+	// or any returned error value that generates a leave from within CImRecvConvert (ie RFile::Create)
+
+	iGlobalIndent=0;
+	iLongestLine=50;
+	
+	iImPriority=EMsvMediumPriority;
+	if(NULL!=iImcvUtils)
+		{
+		delete iImcvUtils;
+		iImcvUtils=NULL;
+		}
+	iImcvUtils=CImcvUtils::NewL();
+
+	// reset internal date
+	iTimeDate.HomeTime();
+	
+	iMimeParser->Reset();
+	
+	iNewEntry=EFalse; //EFalse if the entry was moved to. ETrue if the entry was just created
+	iTopMessagePart=KMsvRootIndexEntryId;
+	ResetForNewEntryL(iDefaultEntryType);
+	iMIMEPart_822Header = EFalse;
+	iPartialEmail=EFalse;
+
+	RECVLOG(KReseted) 
+	}
+
+
+/**
+ParseNextFieldL()
+
+@param aSourceLine
+@return
+*/
+ TInt CImCltRecvConvert::ParseNextFieldL(const TDesC8& aSourceLine) 
+	{
+	__ASSERT_DEBUG(iRootEntryId!=KMsvRootIndexEntryId, gPanic(KPanicServiceIdNotValid));
+	RECVLOG_OUT(aSourceLine);
+
+	if ((iLeaveError == KErrNone) && (iClientEntry->Entry().Id() == KMsvRootIndexEntryId))
+		{
+		iClientEntry->SetEntryL(iSavedEntryId);
+		}
+
+	if(iLeaveError==KErrNone)
+		{
+		TRAP(iLeaveError, ParseNextLineL(aSourceLine));		
+		}
+
+	if (iLeaveError==KErrNone)
+		iSavedEntryId = iClientEntry->Entry().Id();
+	TUid type = iClientEntry->Entry().iType;
+	if( type != KUidMsvMessageEntry    &&
+		type != KUidMsvEmailTextEntry  &&
+		type != KUidMsvEmailHtmlEntry  &&
+		type != KUidMsvAttachmentEntry)
+		{
+		iClientEntry->SetEntryL(KMsvRootIndexEntryId);
+		}
+
+
+	return iLeaveError;
+	}
+
+
+/**
+ParseNextLineL()
+
+@param aSourceLine
+*/
+void CImCltRecvConvert::ParseNextLineL(const TDesC8& aSourceLine)
+	{
+	iParsedMimeBoundaryLast=0;
+	if(!iFinishedHeader)
+		{
+		// start by getting the next token from the header
+		iRfc822Token->ParseNextLineL(aSourceLine);
+
+		switch(iRfc822Token->iHeaderPart)
+			{
+			case CLocalRfc822Token::EUnknown:
+			case CLocalRfc822Token::ENotFinished:
+				RECVLOG(KPartLine)
+				break;
+			case CLocalRfc822Token::EFrom:
+				iOutputHeader->SetFromL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvFromPrompt);
+				break;
+			case CLocalRfc822Token::EReplyTo:
+				iOutputHeader->SetReplyToL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvReplyToPrompt);
+				break;
+			case CLocalRfc822Token::ETo:
+				ParseRecipientListL(iOutputHeader->ToRecipients());
+				LOGGING(KFound,KImcvToPrompt);
+				break;
+			case CLocalRfc822Token::ECc: 
+				ParseRecipientListL(iOutputHeader->CcRecipients());
+				LOGGING(KFound,KImcvCcPrompt);
+				break;
+			case CLocalRfc822Token::EBcc: 
+				ParseRecipientListL(iOutputHeader->BccRecipients());
+				LOGGING(KFound,KImcvBccPrompt);
+				break;
+			case CLocalRfc822Token::ESubject:
+				iOutputHeader->SetSubjectL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvSubjectPrompt);
+				break;
+			case CLocalRfc822Token::EDate:
+				iRfc822Date.ParseDateField(*iRfc822Token->OutputLine() , iTimeDate); 
+				if (iEmailEntry->Id() != iTopMessagePart)
+					{
+					iEmailEntry->iDate = iTimeDate;
+					}
+				LOGGING(KFound,KImcvDatePrompt);
+				break;
+			case CLocalRfc822Token::EMessageId:
+				iOutputHeader->SetImMsgIdL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvMessageIdPrompt);
+				break;
+			case CLocalRfc822Token::EPriority:
+				iImPriority=iImcvUtils->EvaluatePriorityText(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvPriorityPrompt);
+				break;
+			case CLocalRfc822Token::EReturnReceiptTo:
+				iOutputHeader->SetReceiptAddressL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KReturnReceiptTo);
+				break;
+			case CLocalRfc822Token::EEndOfHeader:
+				// the next line goes in the body part
+				iFinishedHeader = ETrue;
+				RECVLOG(KEndOFHeader)
+				break;
+			default:
+				RECVLOG(KEndOFHeader)
+				break;
+			}
+
+
+		if(iRfc822Token->iHeaderPart != CLocalRfc822Token::ENotFinished)
+			{
+			// Now that we've used the data, we also need to clear the output line from the tokeniser....
+			iRfc822Token->OutputLine()->Des() = KNullDesC8;
+
+			// whatever part we just read, we may also have read the empty line that separates
+			// the header from the body
+			if((iFinishedHeader = iRfc822Token->LastToken()) != EFalse)	//iFinishedHeader set to 1 on CRLF-
+				{
+				RECVLOG(KLastToken);
+				iNotFinishedRfc822Header = EFalse;
+
+				iHeaderConverter->SetMessageType(iMimeParser->MessageIsMime());
+				iHeaderConverter->DecodeAllHeaderFieldsL(*iOutputHeader);
+
+				if (iMimeParser->MessageIsMime())
+					{
+					EndOfHeaderMIMEProcessingL();
+					}
+				else
+					{
+					EndOfHeaderProcessingL();
+					}
+
+				if (iStore8BitData)
+					{
+					iBodyText->SetDefaultCharacterSet(iCharConv->SystemDefaultCharset());
+					if ( iMimeParser->MessageIsMime() && iMimeParser->ContentType()==EMimeText )
+						{
+						iBodyText->SetCharacterSet(iMimeParser->CurrentCharsetL());
+						}
+					else
+						{
+						iBodyText->SetCharacterSet(0);
+						}
+					}
+				else
+					{
+					// Get charset for decoding.
+					if ( iMimeParser->MessageIsMime() && iMimeParser->ContentType()==EMimeText )
+						{
+						iCharConv->PrepareToConvertToFromOurCharsetL(iMimeParser->CurrentCharsetL());
+						}
+					else
+						{
+						iCharConv->PrepareToConvertToFromOurCharsetL(iCharConv->SystemDefaultCharset());
+						}
+					}
+				}
+			}
+		}
+	else if (iReceivingHeadersOnly==EFalse)
+		{	
+		//Set to EFalse when a single line is to be skipped (ie boundary line)
+		iCommitLine=ETrue; 
+
+		// read one line of the message body if I am processing a whole email message
+		if(iMimeParser->MessageIsMime())
+			{
+			ParseMimeLineL(aSourceLine);
+			}
+		else
+			{
+			ParseBodyLineL(aSourceLine);	
+			}
+
+		if((iCommitLine)&&(!iSkipData))
+			{
+			DecodeAndStoreLineL(aSourceLine);
+			}	
+		}
+	}
+
+
+/**
+MessageEntryDetailsL()
+
+@return
+*/
+ TMsvEmailEntry CImCltRecvConvert::MessageEntryDetailsL()
+	{
+
+	iMessageEntryCalled=ETrue;
+	CloseAttachmentFileL();
+
+	// A message requiring manual termination and not part way through a MIME part header
+	if( iTopMessagePart==EntryId() && iFinishedHeader) 
+		{
+		StoreEntryStreamsL(KStore822Header|KStoreMIMEHeader);
+		}
+	else
+		{
+		iClientEntry->SetEntryL(iTopMessagePart);         
+		if(iEmailEntry)
+			{
+			delete iEmailEntry;
+			iEmailEntry=NULL;
+			}
+	
+		iEmailEntry = new (ELeave) TMsvEmailEntry(iClientEntry->Entry());
+		}
+		
+	return *iEmailEntry;
+	}
+
+
+/**
+MessageCompleteL()
+
+@param aEmailEntry
+*/
+ void CImCltRecvConvert::MessageCompleteL(TMsvEmailEntry aEmailEntry)
+	{
+	if (iClientEntry->Entry().Id() == KMsvRootIndexEntryId)
+		{
+		iClientEntry->SetEntryL(iSavedEntryId);
+		}
+
+	__ASSERT_DEBUG(iMessageEntryCalled, gPanic(KPanicMessageEntryNotCalled));
+	__ASSERT_DEBUG(aEmailEntry.Id()==iTopMessagePart, gPanic(KPanicMessageEntryIdHasChanged));
+
+	// Called ResetL() to reset object instead of ResetForHeadersL()
+	__ASSERT_DEBUG(iReceivingHeadersOnly, gPanic(KPanicIncorrectResetState)); 
+
+	if(iEmailEntry)
+		{
+		if (iEmailEntry->Id())
+			{
+			if(iLeaveError==KErrNone)
+				{
+				// a remote email header cannot have any attachments or be marked as complete...
+				aEmailEntry.SetAttachment(EFalse);
+				aEmailEntry.SetMHTMLEmail(EFalse);
+				aEmailEntry.SetComplete(EFalse);
+				iClientEntry->SetEntryL(aEmailEntry.Id());
+				RECVLOG(KHeaderComplete)
+				}
+			else
+				{
+				if (!iPopulateMessage)
+					{
+					TMsvId currentId = EntryId();
+					iClientEntry->SetEntryL(iClientEntry->Entry().Parent());			
+					iClientEntry->DeleteL(currentId);
+					}
+				User::Leave(iLeaveError);
+				}
+			}
+		}
+
+	iSavedEntryId = iClientEntry->Entry().Id();
+	iClientEntry->SetEntryL(KMsvRootIndexEntryId);
+	}
+
+
+/**
+MessageCompleteL()
+
+@return
+*/
+ TMsvId CImCltRecvConvert::MessageCompleteL()
+	{
+	RECVLOG(KStartMessageComplete)
+	if (iClientEntry->Entry().Id() == KMsvRootIndexEntryId)
+		{
+		iClientEntry->SetEntryL(iSavedEntryId);
+		}
+	if (iParsedMimeBoundaryLast==EFalse && iAttachmentFileState==EFileIsOpen && iPartialEmail!=EFalse)
+		{
+		iAttachmentFileState=EFileTopIncomplete;
+		}
+
+	CloseAttachmentFileL();
+
+	if(!iEmailEntry->Id())
+		{
+		return 0;
+		}
+
+	if(iLeaveError!=KErrNone)
+		{
+		User::Leave(iLeaveError);
+		}
+
+	if (EntryId()!=iTopMessagePart)
+		{
+		iEmailEntry->SetComplete(ETrue);
+		StoreEntryStreamsL(KStoreBodyText);
+		MoveToParentEntryL();
+
+		if( iTopMessagePart==EntryId() && iFinishedHeader) 
+			{
+			iEmailEntry->SetVisible(ETrue);
+			iEmailEntry->SetInPreparation(EFalse);
+			iEmailEntry->SetBodyTextComplete(ETrue);
+			iEmailEntry->SetComplete(ETrue);
+			iEmailEntry->SetSendingState(KMsvSendStateWaiting);
+			// Main message.
+			StoreMessageEntryDetailsL();
+			return iEmailEntry->Id();
+			}
+		else if(iEmailEntry->iType == KUidMsvMessageEntry)
+			{
+			StoreMessageEntryDetailsL();
+			MoveToParentEntryL();
+			StoreMessageEntryDetailsL();
+			}
+		}
+
+	iClientEntry->SetEntryL(iTopMessagePart);         
+	if(NULL!=iEmailEntry)
+		{
+		delete iEmailEntry;
+		iEmailEntry=NULL;
+		}
+	iEmailEntry = new (ELeave) TMsvEmailEntry(iClientEntry->Entry());
+	iEmailEntry->SetVisible(ETrue);
+	iEmailEntry->SetInPreparation(EFalse);
+	iEmailEntry->SetComplete(ETrue);
+	iEmailEntry->SetBodyTextComplete(ETrue);
+
+	iEmailEntry->SetSendingState(KMsvSendStateWaiting);	
+
+
+	iEmailEntry->SetAttachment(iParent->At(0).iAttachment);
+	iEmailEntry->SetMHTMLEmail(iParent->At(0).iMHTML);
+
+	if(iEmailEntry->MHTMLEmail() == EFalse && iEmailEntry->Attachment() == EFalse && iRelatedAttachments !=EFalse)
+		{
+		iEmailEntry->SetAttachment(ETrue);
+		}
+	iRelatedAttachments=EFalse;
+	
+	iEmailEntry->iSize=iParent->At(0).iSize;
+	iEmailEntry->SetMessageFolderType(iParent->At(0).iFolder);
+
+	iClientEntry->ChangeL(*iEmailEntry);
+
+	iSavedEntryId = iClientEntry->Entry().Id();
+	iClientEntry->SetEntryL(KMsvRootIndexEntryId);
+	RECVLOG(KMessageComplete)
+	return iEmailEntry->Id();
+	}
+
+
+ /**
+ParseMimeLineL()
+
+@param aSourceLine
+*/ 
+void CImCltRecvConvert::ParseMimeLineL(const TDesC8& aSourceLine)  
+	{
+	iTopPartialDownloadCounter+=aSourceLine.Length(); // increment the number of bytes of the attachment downloaded so far
+	if(!iMimeParser->IsBoundary(aSourceLine))
+		{
+		if(!iPrepared) // first line of the body
+			{		
+			if (iMIMEPart_822Header)
+				{
+				// missing 822 part header. Revert to default.
+				EndOfHeaderMIMEProcessingL();
+				iMIMEPart_822Header=EFalse;
+				}
+
+			PrepareDecoder();
+			}
+
+		if (CheckUUEStartL(aSourceLine))
+			{
+			iAlgorithm=EUUDecode;
+			iCommitLine=EFalse;
+			}
+		}
+	else
+		{
+		iParsedMimeBoundaryLast=ETrue;
+		// found a MIME boundary so store the current parts data and update its entry.
+
+		RECVLOG(KFoundMIMEBoundary)
+		iCommitLine=EFalse; //Dont store this line as its a boundary.
+
+		if(!iFirstBoundaryReached && iEntryType==EFolderEntry)
+			{
+			iFirstBoundaryReached=ETrue;
+			if (!iCurrentMultipartFolderEntryId)
+				iCurrentMultipartFolderEntryId = EntryId();
+			MoveToParentEntryL();
+			ResetForNewEntryL(iDefaultEntryType);
+			return; // First boundary encountered.
+			}
+
+		CloseAttachmentFileL();
+		if(iNewEntry)
+			{
+			iEmailEntry->SetComplete(ETrue);
+			iEmailEntry->SetBodyTextComplete(ETrue);
+			StoreEntryStreamsL(KStoreMIMEHeader | KStoreBodyText);
+			if (iBodyId==KMsvNullIndexEntryId)
+				{
+				iBodyId=iEmailEntry->Id();
+				}
+			}
+
+		iSkipData = EFalse;
+
+		// check whether we just found the terminating boundary...
+		if(iMimeParser->IsTerminatingBoundary())
+			{
+			RECVLOG(KRemoveBoundary);
+			iMimeParser->RemoveBoundary();
+			RECVLOG(KRemovedBoundary);
+			iMIMEPart_822Header = EFalse;
+
+			if (EntryId()!=iTopMessagePart)
+				{
+				if(iEmailPart==KParentPart)
+					{
+					// rfc822 message which is not  not multipart.
+					iEmailPart=KNoPart;
+					MoveToParentEntryL();				
+
+					// Embedded message
+					iEmailEntry->SetComplete(ETrue);
+					iEmailEntry->SetBodyTextComplete(ETrue);
+					StoreMessageEntryDetailsL();
+					}
+				else if (iEmailEntry->iType==KUidMsvMessageEntry)
+					{
+					// Moving up from a multi embedded rfc822 message.
+					iEmailEntry->SetComplete(ETrue);
+					iEmailEntry->SetBodyTextComplete(ETrue);
+					StoreMessageEntryDetailsL();
+					}
+				}
+
+			MoveToParentEntryL();
+			iEntryDataSize = iEmailEntry->iSize;
+
+			if(iClientEntry->Entry().iType == KUidMsvFolderEntry)
+				{
+				iCurrentMultipartFolderEntryId = EntryId();
+				}
+			else if (EntryId()!=iTopMessagePart)
+				{
+				if(iEmailEntry->iType == KUidMsvMessageEntry)
+					{
+					iEmailEntry->SetComplete(ETrue);
+					iEmailEntry->SetBodyTextComplete(ETrue);
+					StoreMessageEntryDetailsL();
+					}
+				MoveToParentEntryL();
+				iEntryDataSize += iEmailEntry->iSize;
+				}
+
+			if(!iNewEntry)
+				ResetForNonMimeEntryL();
+
+			RECVLOG(KSkippingData)
+			iSkipData = ETrue;
+			iDefaultEntryType=ETextEntry;
+			}
+		else // if regular boundary
+			{ 
+			RECVLOG(KSectionHeader)
+			if(iEmailPart==KParentPart && EntryId()!=iTopMessagePart)
+				{
+				// rfc822 message which is not  not multipart.
+				iEmailPart=KNoPart;
+				MoveToParentEntryL();
+				// Embedded message
+				iEmailEntry->SetComplete(ETrue);
+				iEmailEntry->SetBodyTextComplete(ETrue);
+				StoreMessageEntryDetailsL();
+				}
+
+			if (!iCurrentMultipartFolderEntryId && iEmailPart==KNoPart)
+				MoveToParentEntryL();
+
+			ResetForNewEntryL(iDefaultEntryType);
+			}
+		}
+	}
+
+
+/**
+EndOfHeaderProcessingL()
+*/
+void CImCltRecvConvert::EndOfHeaderProcessingL()
+	{	
+	CreateEntryL();
+	StoreEntryStreamsL(KStore822Header);
+	iEntryDataSize = 0;
+	}
+
+
+/**
+ParseBodyLineL()
+
+@param aSourceLine
+*/
+void CImCltRecvConvert::ParseBodyLineL(const TDesC8& aSourceLine)
+	{
+	TInt len=aSourceLine.Length();
+	iTopPartialDownloadCounter+=len; // added for TOP. increment the number of bytes of the attachment downloaded so far
+
+	if (iBodyId==KMsvNullIndexEntryId)
+		{
+		iBodyId=iEmailEntry->Id();
+		}
+	
+	TMsvId id=0;
+	// first check whether this line is a UUEncode start boundary
+	if(CheckUUEStartL(aSourceLine)) 
+		{
+		RECVLOG(KFoundUUEStartBoundary)
+		TFileName tempStore = iAttachmentName;
+		id = EntryId();
+		if (!iNewNonMIMEBodyPart || id!=iTopMessagePart) // main message entry
+			{
+			iEmailEntry->SetComplete(ETrue);
+			iEmailEntry->SetBodyTextComplete(ETrue);
+			StoreEntryStreamsL(KStoreBodyText);
+			}
+		MoveToParentEntryL();
+		if ( !CreateNonMIMEFolderEntryL(id))
+			{
+			ResetForNonMimeEntryL();
+			}
+			
+		iEntryType = EAttachmentEntry;
+		CreateEntryL();
+		SetAttachmentName(tempStore);
+		
+		iCurrentPartIsRichText = EFalse;
+		iAlgorithm=EUUDecode;
+		iCommitLine=EFalse;
+		if(!iSavingAttachments)
+			{
+			RECVLOG(KSkippingData)
+			iSkipData=ETrue;
+			}
+		iNewNonMIMEBodyPart=EFalse;
+		}
+	else if(aSourceLine.CompareF(KImcvUueEnd)==0) // Checks for the UUEncode end boundary
+		{
+		RECVLOG(KFoundUUEEndBoundary)
+		CloseAttachmentFileL();
+		StoreEntryDataL();
+		MoveToParentEntryL();
+		iSkipData = EFalse;
+		iCommitLine=EFalse;
+		iNewNonMIMEBodyPart=ETrue; 
+		}
+	else if (iNewNonMIMEBodyPart && !( len==2 && aSourceLine[0]==KImcvCR && aSourceLine[1]==KImcvLF ))
+		{
+		id = EntryId();
+		if (!iNewNonMIMEBodyPart || id!=iTopMessagePart)
+			{
+			iEmailEntry->SetComplete(ETrue);
+			iEmailEntry->SetBodyTextComplete(ETrue);
+			StoreEntryStreamsL(KStoreBodyText);
+			}
+		MoveToParentEntryL();
+		if ( !CreateNonMIMEFolderEntryL(id))
+			ResetForNonMimeEntryL();
+		iAlgorithm=ENoAlgorithm;
+		iEntryType = ETextEntry;
+		CreateEntryL();
+		iNewNonMIMEBodyPart=EFalse;
+		}	
+	}
+
+
+/**
+CreateNonMIMEFolderEntryL()
+
+@param aCurrentId
+@return
+*/
+TBool CImCltRecvConvert::CreateNonMIMEFolderEntryL(TMsvId aCurrentId)
+	{
+	if ( aCurrentId==iTopMessagePart || iCurrentMultipartFolderEntryId )
+		return EFalse;
+
+	iClientEntry->SetEntryL(iTopMessagePart); 
+	iEmailPart = KMultiPart;
+	iEntryType = EFolderEntry;
+	CreateEntryL();
+
+	TMsvId destId = EntryId();
+	iClientEntry->SetEntryL(iTopMessagePart); 
+	iClientEntry->MoveL(aCurrentId, destId);
+	iClientEntry->SetEntryL(aCurrentId);
+	iClientEntry->SetEntryL(iClientEntry->Entry().Parent()); 
+
+	iEmailEntry->SetMessageFolderType(iMimeParser->MessageFolderType());
+
+	RECVLOG(KResetForNewEntry) 
+
+	iMimeParser->ResetForNewEntry();
+	
+	if (iStore8BitData)
+		{
+		//Create a buffer to hold the body text as it is down loaded.
+		delete iBodyBuf;
+		iBodyBuf = NULL;
+		iBodyBuf = CBufFlat::NewL(KBodyTextChunkSizeBytes);
+		}
+	else
+		{
+		iOutputBody->Reset();
+		}
+		
+	ResetForNonMimeEntryL(); 
+	RECVLOG(KResetedForNewEntry) 
+	return ETrue;
+	}
+
+
+/**
+CreateAttachmentL()
+
+@return
+*/
+TBool CImCltRecvConvert::CreateAttachmentL()
+	{
+	// added to support TOP command. Reset the download counter each time we have a new
+	// attachment
+	iTopPartialDownloadCounter = 0; 
+
+	// Need to check that the complete filename: iAttachmentFullPath & iAttachmentName	
+	// does not exceed 256 characters. Greater than this and it cannot be saved as a file.
+
+	TBool addExtension = ETrue;
+	if(iAttachmentName.Length() == 0)	//i.e. problem with Attachment name
+	    {
+		// No filename present. Generate one.
+		if(iMimeParser->ContentDescription().Length()!=0)
+			{
+			// Use ContentDescription() as default name 
+			// - as this is more informative than the default
+
+			TLex sourceLineLex = iMimeParser->ContentDescription();
+			ExtractFilename(sourceLineLex, iAttachmentName);
+			}
+		else
+			{
+			iAttachmentName = *iDefaultAttachmentName;	
+			}
+			
+		}
+	else
+		{
+		// Filename present. Check it is valid.
+		ReplaceInvalidCharacters(iAttachmentName);
+		if (iAttachmentName.Locate(KImcvFullStop)!=KErrNotFound)
+			{
+			addExtension=EFalse;
+			}
+			
+		}
+	if (addExtension)
+		{
+		AddFileExtension();
+		}
+	CMsvStore* store = iClientEntry->EditStoreL(); 
+	CleanupStack::PushL(store);
+	CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+	CleanupStack::PushL(attachment);
+	attachment->SetAttachmentNameL(iAttachmentName);
+	
+	RFile file; 
+	store->AttachmentManagerExtensionsL().CreateAttachmentL(iAttachmentName,file,attachment);
+	CleanupStack::Pop(attachment);
+	
+	iAttachmentFile.SetFileHandle(file,TImAttachmentFile::EImFileWrite);
+	store->CommitL();
+	CleanupStack::PopAndDestroy(store); // store
+
+	if(KErrNone!=iLeaveError)
+		{
+		iAttachmentFileState=EFileFailedToOpen;
+		CloseAttachmentFileL();
+		return EFalse;
+		}
+
+	iAttachmentFileState=EFileIsOpen;
+	return ETrue;
+	}
+
+	
+/**
+WriteToAttachmentL()
+
+@param text
+*/
+void CImCltRecvConvert::WriteToAttachmentL(const TDesC8& text)  
+	{
+	if ( (iAttachmentFileState==EFileIsClosed || iAttachmentFileState==EFileNotOpen) 
+		&& CreateAttachmentL() && iEntryType!=EHtmlEntry)
+			iEmailEntry->SetAttachment(ETrue);
+	
+	if(iAttachmentFileState!=EFileIsOpen || !text.Length())
+		{
+		RECVLOG(KSkippingData)
+		iSkipData = ETrue;
+		}
+
+	// write decoded data into a file if there is any data there to write.
+
+	RECVLOG(KWritingToFile)
+
+	// Convert text before writing to attachment.
+	
+	// Store as Binary files..
+	iLeaveError=iAttachmentFile.WriteFile(text);
+
+	if(KErrNone==iLeaveError)
+		{
+		iEntryDataSize += text.Length();	
+		}
+		
+	else	
+		{
+		// the file write failed (eg.there is no space left), set new file state and skip 
+		RECVLOG(KFailedToWriteToFile)
+		iAttachmentFileState=EFileIsIncomplete;
+		CloseAttachmentFileL();
+		}
+	RECVLOG(KWroteToFile)
+	}
+
+
+/**
+StoreEntryStreamsL()
+*/
+void CImCltRecvConvert::StoreEntryStreamsL()
+	{
+	StoreEntryStreamsL(KStoreBodyText | KStore822Header | KStoreMIMEHeader);
+	}
+
+
+
+/**
+StoreEntryStreamsL()
+
+@param aSettings
+*/
+void CImCltRecvConvert::StoreEntryStreamsL(TInt aSettings)
+	{
+	RECVLOG(KStartStoringEntryStream);
+	if (iReceivingHeadersOnly==EFalse)
+		{
+		CMsvStore* entryStore = NULL;
+		TBool commitStore = EFalse;
+
+		TRAPD(error, entryStore = iClientEntry->EditStoreL());
+		if(error==KErrNone) // if store does not exist then the entry is the wrong type
+			{
+			CleanupStack::PushL(entryStore);
+
+			if (aSettings & KStore822Header)
+				{
+				Store822HeaderL(*entryStore, commitStore);
+				}
+			
+			if (aSettings & KStoreMIMEHeader)
+				{
+				StoreMIMEHeaderL(*entryStore, commitStore);
+				}
+
+			if (aSettings & KStoreBodyText)
+				{
+				StoreBodyTextL(*entryStore, commitStore);
+				}
+			// only commit to the store if I wrote something into it
+			if (commitStore)
+				{
+				RECVLOG(KStoringEntryStream);
+				entryStore->CommitL();
+				}
+
+			StoreEntryDataL();
+			CleanupStack::PopAndDestroy(); //entryStore		
+			}
+
+		}
+	RECVLOG(KDoneStoringEntryStream);
+	}
+
+
+/**
+StoreEntryDataL()
+
+@return
+*/
+TBool CImCltRecvConvert::StoreEntryDataL()
+	{
+	// NB function should only be called if a whole email is being processed
+	TBool commit=EFalse;
+	RECVLOG(KUpdatingEntry)
+
+	if (iEmailEntry->iType==KUidMsvMessageEntry)
+		{
+		iParent->At(0).iSize += iEntryDataSize;
+		}
+	else
+		{
+		iEmailEntry->iSize += iEntryDataSize;
+		if (iEntryType==EAttachmentEntry || iEntryType==EHtmlEntry)
+			{
+			iEmailEntry->iDetails.Set(iAttachmentName);
+			}
+		}
+	iClientEntry->ChangeL(*iEmailEntry);
+
+	RECVLOG(KUpdatedEntry)
+	return commit;	// if I wrote data into the store, tell owner	
+	}
+
+
+/**
+MoveToParentEntryL()
+*/
+void CImCltRecvConvert::MoveToParentEntryL()
+	{
+	// This function changes the context to the current entry's parent entry.
+	RECVLOG(KMoveToParentEntry)
+
+	// Change context to the parent entry	
+	if (EntryId()==iTopMessagePart)
+		{
+		return; // Already there.
+		}
+
+	iClientEntry->SetEntryL(iClientEntry->Entry().Parent()); 
+
+	iNewEntry = EFalse;
+	
+	// only read and write to store if this is a real email message; headers stored in
+	// the remote mailbox do not require any store information.
+	if (iReceivingHeadersOnly)
+		{
+		RECVLOG(KIgnoringStreams)
+		return;
+		}
+
+	TBool allowAttachmentFlag=ETrue;
+	if(iClientEntry->Entry().iType == KUidMsvFolderEntry)
+		{
+		// Current entry is a folder entry signifying a MIME multipart.
+		// Change context to the parent entry
+		TMsvEmailEntry entry = (TMsvEmailEntry) iClientEntry->Entry();
+		iCurrentMultipartFolderEntryId = EntryId();
+		allowAttachmentFlag = !(entry.MessageFolderType()==EFolderTypeRelated || 
+								entry.MessageFolderType()==EFolderTypeAlternative);
+	
+
+		if (EntryId()!=iTopMessagePart)
+			{	
+			iClientEntry->SetEntryL(iClientEntry->Entry().Parent()); 
+			}
+		}
+
+	TBool childIsAttachment = (iEmailEntry->Attachment() || iEmailEntry->iType == KUidMsvMessageEntry) ? ETrue:EFalse;
+	TBool childIsMHTML=EFalse;
+	// Dont want the flag propogated 'up' past a message entry.
+	if(iEmailEntry->iType != KUidMsvMessageEntry)
+		{
+		childIsMHTML = iEmailEntry->MHTMLEmail() ? ETrue:EFalse;
+		}
+	//Make the parent entry the current entry 
+	if(iEmailEntry)
+		{
+		delete iEmailEntry;
+		iEmailEntry=NULL;
+		}
+	iEmailEntry = new (ELeave) TMsvEmailEntry(iClientEntry->Entry());
+
+	if (!iParent->Count())
+		{
+		TParentDetails parentDetails;
+		iParent->InsertL(0,parentDetails);
+		}
+
+	if (! iParent->At(0).iAttachment)
+		{
+		iParent->At(0).iAttachment=(childIsAttachment && allowAttachmentFlag)? ETrue:EFalse;
+
+		// if we aren't allowing attachments because of the folder type
+		// remember there where attachments and check at the end whether
+		// it was an MHTML message or not.
+		if(childIsAttachment && !allowAttachmentFlag)
+			{
+			iRelatedAttachments=ETrue;
+			}
+		}
+	if (!iParent->At(0).iMHTML)
+		{
+		iParent->At(0).iMHTML = childIsMHTML ? ETrue:EFalse;
+		}
+	iParent->At(0).iSize += iEntryDataSize;
+
+	iOutputHeader->Reset();
+	iEmptyHeaderSize=iOutputHeader->DataSize();
+	iMimeParser->ResetForNewEntry();
+
+	iEntryDataSize=0;
+
+	RECVLOG(KMovedToParentEntry)
+	}
+
+
+/**
+CreateEntryL()
+Creates a new entry.
+*/
+void CImCltRecvConvert::CreateEntryL()
+	{
+	RECVLOG(KCreatingEntry);
+	if(NULL!=iEmailEntry)
+		{
+		delete iEmailEntry;
+		iEmailEntry=NULL;
+		}
+
+	if (iCurrentMultipartFolderEntryId)
+		{
+		iClientEntry->SetEntryL(iCurrentMultipartFolderEntryId);
+		iCurrentMultipartFolderEntryId=0;
+		}
+		
+	iEmailEntry = new (ELeave) TMsvEmailEntry;
+
+	TValidEntryType previousEntryType = iEntryType;
+	if ((iTopMessagePart==KMsvRootIndexEntryId) || iMIMEPart_822Header)
+		{
+		// At the main header, want to create a message entry.
+		// The stored iEntryType will indicate ( from header info) the next entry to be created.
+		// Save temporarily.
+		// Also applies to the special case where a message contains ony 1 embedded message.
+
+		previousEntryType=iEntryType;
+		iEntryType=EMessageEntry;
+		}
+
+	if ((iPopulateMessage) && (iTopMessagePart==KMsvRootIndexEntryId))
+	// If this is the root of a message that is being populated then do not create it.
+		{
+		iClientEntry->SetEntryL(iRootEntryId);
+		*iEmailEntry = iClientEntry->Entry();
+		iTopMessagePart=iRootEntryId;
+
+		// Delete all the children of the message entry.  This is needed because if the
+		// message has been purged, the entries will still exist.  When the message is populated,
+		// new entries are created.  If the original entries are not removed, then duplicate 
+		// entries will exist.
+		CMsvEntrySelection*	children = iClientEntry->ChildrenL();
+		CleanupStack::PushL(children);
+		if (children->Count())
+		{
+		TMsvLocalOperationProgress prog;
+		iClientEntry->DeleteL(*children,prog);
+		}
+		CleanupStack::PopAndDestroy(children);
+		}
+	else
+		{
+		iEmailEntry->iMtm=iNewMsgType;
+		iEmailEntry->iServiceId = iEmailServiceId;
+		iEmailEntry->SetComplete(EFalse);
+		iEmailEntry->iSize = 0;
+		iEmailEntry->SetVisible(ETrue);
+		iEmailEntry->SetInPreparation(EFalse);
+		iEmailEntry->SetReceipt(EFalse);
+
+		iEmailEntry->SetVCard(iMimeParser->VCard());
+		iEmailEntry->SetVCalendar(iMimeParser->VCalendar());
+		iEmailEntry->SetMessageFolderType(iMimeParser->MessageFolderType());
+		iEmailEntry->SetPriority(iImPriority);
+		iEmailEntry->SetNew(EFalse);
+
+		if(iOutputHeader->ReceiptAddress().Length()>0)
+			{
+			iEmailEntry->SetReceipt(ETrue);
+			}
+
+		iEmailEntry->iDate=iTimeDate;
+		switch(iEntryType)
+			{
+			case EMessageEntry:
+				if(iTopMessagePart==KMsvRootIndexEntryId)
+					{
+					iEmailEntry->SetUnread(ETrue);
+					iEmailEntry->SetNew(ETrue);
+					iEmailEntry->SetVisible(EFalse);
+					iEmailEntry->SetInPreparation(ETrue);
+					iEmailEntry->SetSendingState(KMsvSendStateNotApplicable);
+					}
+				else
+					{
+					TParentDetails parentDetails;
+					parentDetails.iMHTML=EFalse;
+			        parentDetails.iAttachment=EFalse;
+					parentDetails.iSize=0;
+					iParent->InsertL(0,parentDetails);
+					}
+				iEmailEntry->iType=KUidMsvMessageEntry;
+				iEmailEntry->iDetails.Set(iOutputHeader->From());
+				iEmailEntry->iDescription.Set(iOutputHeader->Subject());
+				break;
+			case EFolderEntry:
+				iEmailEntry->iType=KUidMsvFolderEntry;
+				if (iMimeParser->MessageFolderType()==EFolderTypeUnknown)
+					{
+					// Get folder type of parent (the message)
+					TMsvEmailEntry entry=iClientEntry->Entry();
+					iEmailEntry->SetMessageFolderType(entry.MessageFolderType());
+					}
+				break;
+			case EAttachmentEntry:
+				iEmailEntry->iType=KUidMsvAttachmentEntry;
+				iEmailEntry->iDetails.Set(iAttachmentName);
+				iEmailEntry->iDescription.Set(iMimeParser->ContentDescription());
+				break; 
+			case ETextEntry:
+				if ( iMimeParser->ContentDisposition()!=KImcvAttachment)
+					iEmailEntry->iType=KUidMsvEmailTextEntry;
+				else 
+					{
+					iEmailEntry->iType=KUidMsvAttachmentEntry;
+					iEmailEntry->iDetails.Set(iAttachmentName);
+					iEmailEntry->iDescription.Set(iMimeParser->ContentDescription());
+					}
+				break;
+			case EHtmlEntry:
+				iEmailEntry->iType=KUidMsvEmailHtmlEntry;
+				// If disposition not set or is inline..
+				if ( iMimeParser->ContentDisposition()==KImcvAttachment)
+					iEmailEntry->iType=KUidMsvAttachmentEntry;
+				else
+					iEmailEntry->SetMHTMLEmail(ETrue);
+				iEmailEntry->iDetails.Set(iAttachmentName);
+				iEmailEntry->iDescription.Set(iMimeParser->ContentDescription());
+				break;
+			default:
+				iEmailEntry->iType=KUidMsvAttachmentEntry;
+				iEmailEntry->iDetails.Set(iAttachmentName);
+				iEmailEntry->iDescription.Set(iMimeParser->ContentDescription());
+			}
+
+		iClientEntry->CreateL(*iEmailEntry);
+		iEmailEntry->iServiceId = iEmailServiceId;
+		iClientEntry->SetEntryL(iEmailEntry->Id());
+		if(iTopMessagePart==KMsvRootIndexEntryId)
+			{
+			iTopMessagePart=iEmailEntry->Id();
+			}
+		}
+
+	iEntryType=previousEntryType;
+	iNewEntry = ETrue;
+	RECVLOG(KCreatedEntry);
+	}
+
+
+/**
+StoreMessageEntryDetailsL()
+Stores the details of a message entry.
+*/
+void CImCltRecvConvert::StoreMessageEntryDetailsL()
+	{
+	iEmailEntry->SetAttachment(iParent->At(0).iAttachment);
+	iEmailEntry->SetMHTMLEmail(iParent->At(0).iMHTML);
+
+	if(iEmailEntry->MHTMLEmail() == EFalse && iEmailEntry->Attachment() == EFalse && iRelatedAttachments !=EFalse)
+		{
+		iEmailEntry->SetAttachment(ETrue);
+		}
+	iRelatedAttachments=EFalse;
+	
+	iEmailEntry->iSize=iParent->At(0).iSize;
+	iEmailEntry->SetMessageFolderType(iParent->At(0).iFolder);
+	StoreEntryDataL();
+
+	if (iParent->Count()>1)
+		{
+		iParent->At(1).iSize+=iEmailEntry->iSize;
+		iParent->Delete(0);
+		}
+	else
+		{
+		iParent->At(0).iAttachment=iParent->At(0).iMHTML=EFalse;
+		iParent->At(0).iSize=0;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/Local_imcvrecv.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,4020 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+*/
+
+
+// epoc include
+#include <e32base.h>
+#include <imutdll.h>
+#include <imcvtext.h>
+#include "Local_imcvrecv.h"
+#include <imcvcodc.h>	// TImConvert
+#include <imcvutil.h>
+
+#include <miuthdr.h>	// CImHeader
+#include <miutatch.h>	// TImAttachmentFile
+#include <txtrich.h>
+#include <imcm.rsg>		// resource definition for IMCM
+
+#include <pop3set.h>	// For including KUidMsgTypePOP3
+#include <barsread.h>	// TResourceReader
+
+#include <cmsvbodytext.h>
+
+#ifdef __WINS__
+#include <e32wins.h>    // for maxfilename lengths
+#include <msvapi.h>
+#endif
+
+#ifndef __WINS__
+#include <msvapi.h>
+#endif
+#include <cmsvattachment.h> 
+#include <mmsvattachmentmanager.h>
+#include <mmsvattachmentmanagersync.h>
+#ifndef _MSG_NO_LOGGING
+#define __IMUT_LOGGING
+
+
+// literals used
+_LIT(KLogFilePath, "c:\\logs\\mailtext\\in.txt");
+_LIT8(KNewLogHeader, "\r\n------ New Receive Session ------\r\n");
+_LIT8(KFound, "found: ");
+_LIT8(KPartLine, "unknown or part line");
+_LIT8(KEndOFHeader, "End of header");
+_LIT8(KSkippingData, "Skipping data");
+_LIT8(KCollectingData7, "Collecting 7/8-bit data");
+_LIT8(KCollectingDataQP, "Collecting QP data");
+_LIT8(KCollectingBase64, "Collecting BASE64 data");
+_LIT8(KCollectingUU, "Collecting UU data");
+_LIT8(KDecodingBase64, "Decoding BASE64 data");
+_LIT8(KDecodedBase64, "Decoded BASE64 data");
+_LIT8(KDecodingUU, "Decoding UU data");
+_LIT8(KDecodedUU, "Decoded UU data");
+_LIT8(KDecodingQP, "Decoding QP data");
+_LIT8(KDecodedQP, "Decoded QP data");
+_LIT8(KUUEDataCorrupt, "UU Data is corrupt");
+_LIT8(KFoundUUEStartBoundary, "UUE start boundary");
+_LIT8(KFoundUUEEndBoundary, "UUE end boundary");
+_LIT8(KClosingAttachFile, "Closing attachment file");
+_LIT8(KDeletingAttachFile, "Deleting attachment file");
+_LIT8(KDeletedAttachFile, "Deleted attachment file");
+_LIT8(KFailedToWriteToFile, "Failed to write to attachment file");
+_LIT8(KSectionHeader, "Section header");
+_LIT8(KFoundMIMEBoundary, "MIME boundary");
+_LIT8(KWritingToBody, "writing body");
+_LIT8(KWroteToBody, "wrote body");
+_LIT8(KWritingToFile, "writing attachment");
+_LIT8(KWroteToFile, "wrote attachment");
+_LIT8(KReset, "Resetting CLocalImRecvConvert");
+_LIT8(KReseted, "Resetting CLocalImRecvConvert");
+_LIT8(KDeleted, "Deleting CLocalImRecvConvert");
+_LIT8(KLineHasLineBreak, "Linebreak");
+_LIT8(KLastToken, "That was the last token");
+_LIT8(KBlankLine, "Blank line");
+_LIT8(KRemoveBoundary, "Remove boundary");
+_LIT8(KRemovedBoundary, "Removed boundary");
+_LIT8(KResetForNewEntry, "Reset for a New Entry");
+_LIT8(KResetedForNewEntry, "Reseted for a New Entry");
+_LIT8(KResetForNonMimeEntry, "Reset for a New Non-Mime Entry");
+_LIT8(KResetedForNonMimeEntry, "Reseted for a New Non-Mime Entry");
+_LIT8(KCreatingEntry, "Creating Entry");
+_LIT8(KCreatedEntry, "Created Entry");
+_LIT8(KUpdatingEntry, "Updating Entry");
+_LIT8(KUpdatedEntry, "Updated Entry");
+_LIT8(KMoveToParentEntry, "Moved to parent entry");
+_LIT8(KMovedToParentEntry, "End of Moved to parent entry");
+_LIT8(KStoringHeader, "Storing CImHeader");
+_LIT8(KStoredHeader, "Stored CImHeader");
+_LIT8(KStoringBody, "Storing CRichText");
+_LIT8(KStoring8BitBody, "Storing CMsvBodyText");
+_LIT8(KStoredBody, "Stored CRichText");
+_LIT8(KStored8BitBody, "Stored CMsvBodyText");
+_LIT8(KStoringMIMEHeader, "Storing CImMimeHeader");
+_LIT8(KStoredMIMEHeader, "Stored CImMimeHeader");
+_LIT8(KIgnoringStreams, "Discarding streams");
+_LIT8(KStartMessageComplete, "Start Message Complete");
+_LIT8(KMessageComplete, "Message Complete");
+_LIT8(KHeaderComplete, "Message Header complete");
+_LIT8(KReturnReceiptTo, "return-receipt-To is set");
+_LIT8(KStartStoringEntryStream, "Starting Storing Entry Stream");
+_LIT8(KStoringEntryStream, "Storing Entry Stream");
+_LIT8(KDoneStoringEntryStream, "Done Storing Entry Stream");
+#endif // _MSG_NO_LOGGING
+
+// uncomment the line below if logging is to be enabled
+
+#if defined(__IMUT_LOGGING)
+#define RECVLOG(text) (iImcvLog?iImcvLog->AppendComment(text):void(0));
+#define RECVLOG_OUT(text) (iImcvLog?iImcvLog->AppendOut(text):void(0));
+#define LOGGING(string1, string2) (Logging(string1, string2));
+#else
+#define RECVLOG(text) (void(0));
+#define RECVLOG_OUT(text) (void(0));
+#define LOGGING(string1, string2) (void(0));
+#endif
+
+#define UNUSED_VAR( var ) var = var  // fix for armv5 build warnings
+const TInt KBodyTextChunkSizeBytes = 512;
+
+_LIT(KIntegerKey,"%d");
+const TInt KSpaceToAddNumber=20;
+
+// added this to handle DRM files
+_LIT8(KTImcvDrm, "testagent.drm");
+
+
+/**
+IsIllegalChar()
+Checks if the character is illegal in EPOC32 file system
+
+@param aChar
+@return
+*/
+LOCAL_C TBool IsIllegalChar(const TUint aChar)
+	{
+	// EPOC32 filenames must not contain any of the following chars
+    return (aChar == '*' || aChar == '\\' || aChar == '<' || aChar == '>' ||
+			aChar == ':'  || aChar == '"' ||  aChar    == '/' || aChar == '|' ||
+			aChar < ' ' || aChar == '?');
+	}
+
+/**
+RemoveSurroundingCharacters()
+
+@param aLeft
+@param aRight
+@param aString
+*/
+LOCAL_C void RemoveSurroundingCharacters( const TUint8& aLeft, const TUint8& aRight, HBufC8& aString)
+	{
+	TPtr8 des = aString.Des();
+	TInt len  = des.Length();
+	
+	if( len > 2 && des[0] == aLeft && des[len - 1] == aRight )
+		{
+		TPtrC8 mid = des.Mid(1, len - 1);
+		des.Copy(mid);
+		des.SetLength(len - 2);
+		}
+	}
+
+
+//****************************************************************************************
+//              Class CLocalRfc822Token Functions
+//****************************************************************************************
+
+
+/**
+NewLC()
+Static factory constructor. Uses two phase 
+construction.
+
+@leave KErrNoMemory
+@return
+A pointer to the newly created CLocalRfc822Token object.
+*/
+CLocalRfc822Token* CLocalRfc822Token::NewLC()
+	{
+	CLocalRfc822Token* self = new (ELeave) CLocalRfc822Token;
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+
+/**
+ConstructL()
+
+*/
+void CLocalRfc822Token::ConstructL()
+	{
+	iOutputLine = HBufC8::NewL(KMaxIMailHeaderReadLineLength + 1);
+	Reset();
+	}
+
+
+/**
+CLocalRfc822Token()
+Constructor
+*/
+CLocalRfc822Token::CLocalRfc822Token()
+	{
+	__DECLARE_NAME(_S("CLocalRfc822Token"));
+	}
+
+
+/**
+~CLocalRfc822Token()
+Destructor
+*/
+CLocalRfc822Token::~CLocalRfc822Token()
+	{
+	delete iOutputLine;
+	iOutputLine=NULL;
+	}
+
+
+/**
+Reset()
+
+*/
+void CLocalRfc822Token::Reset()
+	{
+	iOutputLine->Des().FillZ();
+	iBufferedInput.SetLength(0);
+	iBufferedInput.FillZ();
+
+	iLastToken = EFalse;
+	iFirstLine = ETrue;
+	i822FieldsExist=EFalse;
+	}
+
+
+/**
+ParseNextLineL()
+
+@param aSourceLine
+*/
+void CLocalRfc822Token::ParseNextLineL(const TDesC8& aSourceLine)
+	{
+	TBool hitEof = EFalse;
+	TBool endOfField = EFalse;
+	// Always read one more packet than we need so we know we've read the entire field.
+
+	// Consequently, we need to check whether there is any buffered input from the
+	// previous rfc822 field:*******
+
+	if(iBufferedInput.Length())
+		{
+		// the buffered input is never more than a line of text...
+		*iOutputLine = iBufferedInput;
+		
+ 		iBufferedInput.FillZ();
+		iBufferedInput.SetLength(0);
+		}
+	iInputLine = aSourceLine;
+
+	// discard any LF character from the begining of the line (this is abit strange?)
+	while(iInputLine.Length() > 0 && (iInputLine[0] == KImcvLF || iInputLine[0] == KImcvCR))
+		iInputLine.Delete(0, 1);
+
+	// remove the CR at the end but only if there's stuff before it
+	while(iInputLine.Length() > 0 && (iInputLine[iInputLine.Length() - 1] == KImcvLF || iInputLine[iInputLine.Length() - 1] == KImcvCR))
+		iInputLine.Delete(iInputLine.Length() - 1, 1);
+
+	// if the newly read line is now empty, then don't read any more through this tokeniser
+	iLastToken = !iInputLine.Length();
+
+	// only bother with the rest of the parsing if there's any data left
+	if(iInputLine.Length() > 0 || iOutputLine->Length() > 0)
+		{
+		// check whether we're on the next field or still on the current one
+		if(!iFirstLine && iInputLine.Length() > 0 && iInputLine[0] != KImcvSP && iInputLine[0] != KImcvTab)
+			{
+			// we've read the first line of the next field
+			iBufferedInput = iInputLine;
+			endOfField = ETrue; // flag the fact that the current field is ready for parsing
+			}
+		else // the line belongs in the current field, but without any leading whitespace
+			{
+			// find the first non-whitespace character
+			const TUint8* ptr = iInputLine.Ptr();
+			while((*ptr == KImcvSP || *ptr == KImcvTab) && (ptr - iInputLine.Ptr() < iInputLine.Length())) ptr++;
+		
+			// make sure we're not about to exceed the buffer
+			if((iOutputLine->Length() + iInputLine.Length()) > iOutputLine->Des().MaxLength())
+				iOutputLine = iOutputLine->ReAlloc(iOutputLine->Length() + iInputLine.Length());
+
+			// now copy the remaining data into the buffer
+			iOutputLine->Des().Append(iInputLine.Right(iInputLine.Length() - (ptr - iInputLine.Ptr())));
+			}
+		}
+	else
+		hitEof = ETrue;		//this means that EEndOfHeader is set if a line of zero length is parsed - ie. (clean CRLF - CRLF) = 0.
+	iFirstLine = EFalse;
+
+	if(endOfField || iLastToken)
+		{ 
+		// only parse the input when we have a whole field, 
+		// or we just found the blank line that
+		// separates the body from the header
+		if(MatchAndRemoveL(KImcvFromPrompt))
+			iHeaderPart = EFrom;
+		else if(MatchAndRemoveL(KImcvReplyToPrompt))
+			iHeaderPart = EReplyTo;
+		else if(MatchAndRemoveL(KImcvToPrompt))
+			iHeaderPart = ETo;
+		else if(MatchAndRemoveL(KImcvCcPrompt))
+			iHeaderPart = ECc;
+		else if(MatchAndRemoveL(KImcvBccPrompt))
+			iHeaderPart = EBcc;
+		else if(MatchAndRemoveL(KImcvSubjectPrompt))
+			iHeaderPart = ESubject;
+		else if(MatchAndRemoveL(KImcvDatePrompt))
+			iHeaderPart = EDate;
+		else if(MatchAndRemoveL(KImcvMessageIdPrompt))
+			{
+			iHeaderPart = EMessageId;
+			RemoveSurroundingCharacters(KImcvLeftChevron, KImcvRightChevron, *iOutputLine);
+			}
+		else if (PriorityAndReceiptsMatchAndRemoveL(EPriority))
+			iHeaderPart=EPriority;
+		else if (PriorityAndReceiptsMatchAndRemoveL(EReturnReceiptTo))
+			iHeaderPart=EReturnReceiptTo;
+		else if(hitEof)
+			iHeaderPart = EEndOfHeader;
+		else
+			{
+			iHeaderPart = EUnknown;
+			iImRecvConvert->iMimeParser->ParseLineL(*iOutputLine);
+			}
+		}
+	else 
+		iHeaderPart = ENotFinished;
+	}
+
+
+/**
+PriorityAndReceiptsMatchAndRemoveL()
+
+@param aPriority
+*/
+TBool CLocalRfc822Token::PriorityAndReceiptsMatchAndRemoveL(THeaderPart aPriority)
+	{
+	CDesC8Array* fields=new (ELeave)CDesC8ArrayFlat(6);
+	CleanupStack::PushL(fields);
+	if (aPriority==EPriority)
+		CImcvUtils::PriorityFieldsL(*fields);
+	else if (aPriority==EReturnReceiptTo)
+		CImcvUtils::ReceiptFieldsL(*fields);
+	else
+		{
+		CleanupStack::PopAndDestroy(); //fields
+		return EFalse;
+		}
+	TInt count=fields->Count();
+	TBool matched=EFalse;
+	for (TInt i=0;i<count;i++)
+		{
+		if (MatchAndRemoveL((*fields)[i]))
+			{
+			matched=ETrue;
+			break;
+			}
+		}
+	CleanupStack::PopAndDestroy(); //fields
+	return matched;
+	}
+
+
+/**
+MatchAndRemoveL()
+
+@param aString
+@return
+TBool
+*/
+TBool CLocalRfc822Token::MatchAndRemoveL(const TDesC8& aString)
+	{
+	TInt comparison;
+	TInt stringLength = aString.Length();
+	TInt desLength = (*iOutputLine).Length();
+	TInt compareLength = stringLength > desLength ? desLength : stringLength;
+	TPtrC8 left((*iOutputLine).Left(compareLength));
+	
+	// now see whether the current line contains the search string
+	comparison = left.CompareF(aString);
+	if(!comparison)
+		{
+		// found the match string at the start of the output line, so remove it
+		// get rid of any whitespace betweebn the tag and the data while we have a chance
+		if (!i822FieldsExist)
+			i822FieldsExist=ETrue;
+		TInt whitespaceLength=0;
+		TInt maxLength=desLength-stringLength;
+		const TUint8* ptr = (*iOutputLine).Ptr();
+		while(whitespaceLength <= maxLength && (ptr[stringLength+whitespaceLength] == KImcvSP || ptr[stringLength+whitespaceLength] == KImcvTab))
+			whitespaceLength++;
+		(iOutputLine->Des()).Delete(0, stringLength+whitespaceLength);
+		}
+	return (comparison==0);
+	}
+
+//****************************************************************************************
+//             Class CLocalImRecvConvert
+//****************************************************************************************
+
+
+/**
+NewLC()
+Static factory constructor. Uses two phase construction 
+and pushes the newly created object into the Cleanup stack.
+
+@param anFs
+@param aServerEntry
+@param aMsgType
+@param aEmailServiceId
+@leave KErrNoMemory
+@return
+A pointer to the newly created CLocalImRecvConvert object.
+*/
+CLocalImRecvConvert* CLocalImRecvConvert::NewLC(RFs& anFs, CMsvServerEntry* aServerEntry, 
+												TUid aMsgType, TMsvId aEmailServiceId)
+	{
+	CLocalImRecvConvert* self = new (ELeave) CLocalImRecvConvert(anFs, aServerEntry, aMsgType, 
+																		aEmailServiceId);
+	CleanupStack::PushL(self);
+	self->ConstructL(anFs);
+	return self;
+	}
+
+
+/**
+NewL()
+Static factory constructor. Uses two phase 
+construction.
+
+@param anFs
+@param aServerEntry
+@param aMsgType
+@param aEmailServiceId
+@leave KErrNoMemory
+@return
+A pointer to the newly created CLocalImRecvConvert object.
+*/
+CLocalImRecvConvert* CLocalImRecvConvert::NewL(RFs& anFs, CMsvServerEntry* aServerEntry, 
+												TUid aMsgType, TMsvId aEmailServiceId)
+	{
+	CLocalImRecvConvert* self = CLocalImRecvConvert::NewLC(anFs, aServerEntry, aMsgType, 
+																aEmailServiceId);
+	CleanupStack::Pop();
+	return self;
+	}
+
+  
+/**
+ConstructL()
+
+@param anFs
+*/
+void CLocalImRecvConvert::ConstructL(RFs& anFs)
+	{
+	iFsSession = &anFs;  
+
+	RResourceFile resFile;
+	OpenResourceFileL(resFile, anFs);	// NB leaves if file not found
+
+	// make sure the resource file will be closed if anything goes wrong
+	// CloseResourceFile is declared in IMUTDLL.H and defined in IMUTDLL.CPP
+	TCleanupItem close( CloseResourceFile, &resFile );
+	CleanupStack::PushL( close );
+	
+	// Read iStore8BitData flag.
+	HBufC8* buf = resFile.AllocReadLC( STORE_8BIT_BODY_TEXT );
+	TResourceReader reader;
+	reader.SetBuffer(buf);
+	iStore8BitData = reader.ReadInt8();
+	CleanupStack::PopAndDestroy(buf);
+
+	buf = resFile.AllocReadLC( REMOVED_ATTACHMENT_TAG );
+	reader.SetBuffer(buf);
+	iRemovedAttachmentTag = reader.ReadTPtrC().AllocL();
+	CleanupStack::PopAndDestroy(buf);
+	
+	buf = resFile.AllocReadLC( DEFAULT_ATTACHMENT_NAME );
+	reader.SetBuffer(buf);
+	iDefaultAttachmentName = reader.ReadTPtrC().AllocL();
+	CleanupStack::PopAndDestroy(buf);
+	buf = resFile.AllocReadLC(PARTIAL_DOWNLOAD_FOOTER_MESSAGE);
+	reader.SetBuffer(buf);
+	iPartialEmailFooter = (reader.ReadTPtrC()).AllocL();
+	CleanupStack::PopAndDestroy(buf);
+	buf = NULL;
+	CleanupStack::PopAndDestroy(&resFile); // resFile (Close resfile)
+
+	// create CImHeader object to store Rfc822 header info...
+	iOutputHeader = CImHeader::NewLC();	// PushL(iHeader)
+	CleanupStack::Pop();				// iHeader
+
+	if (iStore8BitData)
+		{
+		//Create body text storage helper.
+		iBodyText = CMsvBodyText::NewL();
+		}
+	else
+		{
+		// create CRichText object to store body...
+		iParaLayer = CParaFormatLayer::NewL();
+		iCharLayer = CCharFormatLayer::NewL();
+		iOutputBody = CRichText::NewL(iParaLayer, iCharLayer);
+		}
+	
+	// Create Rfc822 filter object...
+	iRfc822Token = CLocalRfc822Token::NewLC(); // PushL(iRfc822Token)
+	CleanupStack::Pop();				  // iRfc822Token
+	iRfc822Token->SetImRecvConvert(this);
+
+	// Create converter objects...
+	iCharacterConverter = CCnvCharacterSetConverter::NewL();
+	iCharConv = CImConvertCharconv::NewL(*iCharacterConverter, anFs);
+	iHeaderConverter = CImConvertHeader::NewL(*iCharConv); 
+
+	
+	// Create MIME filter object...
+	iMimeParser = CLocalMimeParser::NewL(*this);
+	
+	
+	// logfile stuff
+	iImcvLog=NULL;
+
+#ifdef __IMUT_LOGGING	
+	TRAPD(err,iImcvLog=CImLog::NewL(KLogFilePath, EAppend));
+	UNUSED_VAR( err );
+#endif
+
+	iRootEntryId = EntryId();
+
+	iNotFinishedRfc822Header = ETrue;
+	
+	iEmailEntry = new (ELeave) TMsvEmailEntry;
+	iReceivingHeadersOnly=EFalse;	
+
+	iParent = new (ELeave) CArrayFixFlat<TParentDetails>(3);
+
+	iFirstBoundaryReached=EFalse;
+
+	ResetL();
+	
+	RECVLOG( KNewLogHeader )
+	}
+
+
+/**
+CLocalImRecvConvert()
+
+@param anFs
+@param aServerEntry
+@param aMsgType
+@param aEmailServiceId
+*/
+CLocalImRecvConvert::CLocalImRecvConvert(RFs& anFs, CMsvServerEntry* aServerEntry, 
+							   TUid aMsgType, TMsvId aEmailServiceId)
+				: iServerEntry(aServerEntry), iNewMsgType(aMsgType), iDefaultEntryType(ETextEntry), 
+			  	  iEmailServiceId(aEmailServiceId), iAttachmentFile(anFs)
+	{
+	__DECLARE_NAME(_S("CLocalImRecvConvert"));
+	}
+
+  
+/**
+~CLocalImRecvConvert()
+Destructor
+*/
+CLocalImRecvConvert::~CLocalImRecvConvert()
+	{
+	delete iEmailEntry;
+	iEmailEntry=NULL;
+	delete iOutputHeader;
+	iOutputHeader=NULL;
+	delete iBodyText;
+	iBodyText=NULL;
+	delete iBodyBuf;
+	iBodyBuf=NULL;
+	delete iParaLayer;
+	iParaLayer=NULL;
+	delete iCharLayer;
+	iCharLayer=NULL;
+	delete iOutputBody;
+	iOutputBody=NULL;
+	delete iRemovedAttachmentTag;
+	iRemovedAttachmentTag=NULL;
+	delete iDefaultAttachmentName;
+	iDefaultAttachmentName=NULL;
+	delete iRfc822Token;
+	iRfc822Token=NULL;
+	delete iMimeParser;
+	iMimeParser=NULL;
+	delete iHeaderConverter;
+	iHeaderConverter=NULL;
+	delete iCharConv;
+	iCharConv=NULL;
+	delete iCharacterConverter;
+	iCharacterConverter=NULL;
+	delete iAttachmentFullPath;
+	iAttachmentFullPath=NULL;
+	delete iImcvUtils;
+	iImcvUtils=NULL;
+	delete iParent;
+	iParent=NULL;
+	RECVLOG(KDeleted)
+	delete iImcvLog;
+	iImcvLog=NULL;
+	delete iPartialEmailFooter;
+	iPartialEmailFooter=NULL;
+	}
+
+
+/**
+ResetForHeadersL()
+This function is used in preference to ResetL() when the owner
+only wishes to create  email entries in the remote mailbox - 
+they do not wish to create any stores associated with the message
+entry
+
+*/
+void CLocalImRecvConvert::ResetForHeadersL()
+	{
+	ResetL();
+	iReceivingHeadersOnly=ETrue;
+	}
+
+/**
+ResetL()
+
+*/
+void CLocalImRecvConvert::ResetL()
+	{
+	RECVLOG(KReset) 
+	iBodyId=KMsvNullIndexEntryId;
+	iSizeOfAttachmentsRemoved=0;
+
+	User::LeaveIfError(iServerEntry->SetEntry(iRootEntryId));
+	
+	iReceivingHeadersOnly=EFalse;
+	iMessageEntryCalled=EFalse;
+	iLeaveError=KErrNone; 		
+	iCurrentMultipartFolderEntryId=0;
+
+	TParentDetails parent;
+	parent.iAttachment=parent.iMHTML=EFalse;
+	parent.iSize=0;
+	iParent->InsertL(0,parent);
+
+	delete iEmailEntry;
+	iEmailEntry=NULL;
+	iEmailEntry = new (ELeave) TMsvEmailEntry;
+
+	// "iSavingAttachments" commands this code to store attachments in files.
+	// Currently this is always set to ETrue as we intend to save all attachments
+	// However, if the user wishes to discard (ie do not save) any 
+	// attachments in incoming email messages - then this member variable
+	// may be set to EFalse by the inline accessor function "SaveAllAttachments(TBool)"
+	iSavingAttachments=ETrue;
+	iAttachmentFileState=EFileIsClosed;
+
+	// iLeaveError contains the error value of any functions that leaves (ie CRichText::InsertL)
+	// or any returned error value that generates a leave from within CLocalImRecvConvert (ie RFile::Create)
+
+	iGlobalIndent=0;
+	iLongestLine=50;
+	
+	iImPriority=EMsvMediumPriority;
+	delete iImcvUtils;
+	iImcvUtils=NULL;
+	iImcvUtils=CImcvUtils::NewL();
+
+	// reset internal date
+	iTimeDate.HomeTime();
+	
+	iMimeParser->Reset();
+	
+	iNewEntry=EFalse; //EFalse if the entry was moved to. ETrue if the entry was just created
+	iTopMessagePart=KMsvNullIndexEntryId; //A value of NULL indicates the next entry created is a main message entry
+	ResetForNewEntryL(iDefaultEntryType);
+	iMIMEPart_822Header = EFalse;
+	iPartialEmail=EFalse;
+
+	RECVLOG(KReseted) 
+	}
+
+
+/**
+ResetForNewEntryL()
+
+@param entryType
+*/
+void CLocalImRecvConvert::ResetForNewEntryL(TValidEntryType entryType)
+	{
+	RECVLOG(KResetForNewEntry) 
+
+	iFinishedHeader = EFalse;
+
+	iPreviousLineLength = 0;
+	iPreviousTrailingWhitespace = 0;
+	iLastChar = 0;
+
+	// Reset the new entry state
+	ResetForNonMimeEntryL();
+
+	// Clear the storage classes
+	iMimeParser->ResetForNewEntry();
+	iRfc822Token->Reset();
+
+	iEmailPart = KNoPart;
+	iEntryType=entryType;
+
+	if (iEntryType==EMessageEntry)
+		{
+		iEmailPart = KParentPart;
+		iMimeParser->SetMessageFolderType(EFolderTypeRFC822);
+		}
+	}
+
+
+/**
+ResetForNonMimeEntryL()
+
+*/
+void CLocalImRecvConvert::ResetForNonMimeEntryL()
+	{
+	iEntryType = ETextEntry;
+	RECVLOG(KResetForNonMimeEntry) 
+
+	iSkipData = EFalse;
+	iPrepared = EFalse;
+	iNewNonMIMEBodyPart=ETrue;
+	iEncounteredLineEndingInCarriageReturn=EFalse;
+
+	iAlgorithm = ENoAlgorithm;
+	iCurrentPartIsRichText = ETrue;	
+	CloseAttachmentFileL();
+	iEntryDataSize = 0;
+	
+	if (iStore8BitData)
+		{
+		//Create a buffer to hold the body text as it is down loaded.
+		delete iBodyBuf;
+		iBodyBuf = NULL;
+		iBodyBuf = CBufSeg::NewL(KBodyTextChunkSizeBytes);
+		}
+	else
+		{
+		iOutputBody->Reset();
+		}
+	
+	iAttachmentName.Zero();
+	iFinalLine = EFalse;
+
+	iOutputHeader->Reset();
+	iEmptyHeaderSize=iOutputHeader->DataSize();
+	RECVLOG(KResetedForNonMimeEntry) 
+	}
+
+
+/**
+ParseNextField()
+
+@param aSourceLine
+*/
+TInt CLocalImRecvConvert::ParseNextField(const TDesC8& aSourceLine) 
+	{
+	__ASSERT_DEBUG(iRootEntryId!=KMsvNullIndexEntryId, gPanic(KPanicServiceIdNotValid));
+	RECVLOG_OUT(aSourceLine);
+
+	// If we are temporarily on the null entry then move back to the entry we are working on
+	if ((iLeaveError == KErrNone) && (iServerEntry->Entry().Id() == KMsvNullIndexEntryId))
+		iLeaveError = iServerEntry->SetEntry(iSavedEntryId);
+
+	if(iLeaveError==KErrNone)
+		TRAP(iLeaveError, ParseNextLineL(aSourceLine));		
+
+	// Save the current entry id for later.
+	if (iLeaveError==KErrNone)
+		iSavedEntryId = iServerEntry->Entry().Id();
+
+	TUid type = iServerEntry->Entry().iType;
+	if( type != KUidMsvMessageEntry    &&
+		type != KUidMsvEmailTextEntry  &&
+		type != KUidMsvEmailHtmlEntry  &&
+		type != KUidMsvAttachmentEntry)
+		{
+	// Set the current id to null so that we aren't locking any folders
+	iServerEntry->SetEntry(KMsvNullIndexEntryId);
+		}
+
+	return iLeaveError;
+	}
+
+
+/**
+ParseNextLineL()
+
+@param aSourceLine
+*/
+void CLocalImRecvConvert::ParseNextLineL(const TDesC8& aSourceLine)
+	{
+	iParsedMimeBoundaryLast=0;
+	if(!iFinishedHeader)
+		{
+		// start by getting the next token from the header
+		iRfc822Token->ParseNextLineL(aSourceLine);
+
+		switch(iRfc822Token->iHeaderPart)
+			{
+			case CLocalRfc822Token::EUnknown:
+			case CLocalRfc822Token::ENotFinished:
+				RECVLOG(KPartLine)
+				break;
+			case CLocalRfc822Token::EFrom:
+				iOutputHeader->SetFromL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvFromPrompt);
+				break;
+			case CLocalRfc822Token::EReplyTo:
+				iOutputHeader->SetReplyToL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvReplyToPrompt);
+				break;
+			case CLocalRfc822Token::ETo:
+				ParseRecipientListL(iOutputHeader->ToRecipients());
+				LOGGING(KFound,KImcvToPrompt);
+				break;
+			case CLocalRfc822Token::ECc: 
+				ParseRecipientListL(iOutputHeader->CcRecipients());
+				LOGGING(KFound,KImcvCcPrompt);
+				break;
+			case CLocalRfc822Token::EBcc: 
+				ParseRecipientListL(iOutputHeader->BccRecipients());
+				LOGGING(KFound,KImcvBccPrompt);
+				break;
+			case CLocalRfc822Token::ESubject:
+				iOutputHeader->SetSubjectL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvSubjectPrompt);
+				break;
+			case CLocalRfc822Token::EDate:
+				iRfc822Date.ParseDateField(*iRfc822Token->OutputLine() , iTimeDate); 
+				if (iEmailEntry->Id() != iTopMessagePart)
+					{
+					iEmailEntry->iDate = iTimeDate;
+					}
+				LOGGING(KFound,KImcvDatePrompt);
+				break;
+			case CLocalRfc822Token::EMessageId:
+				iOutputHeader->SetImMsgIdL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvMessageIdPrompt);
+				break;
+			case CLocalRfc822Token::EPriority:
+				iImPriority=iImcvUtils->EvaluatePriorityText(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KImcvPriorityPrompt);
+				break;
+			case CLocalRfc822Token::EReturnReceiptTo:
+				iOutputHeader->SetReceiptAddressL(*iRfc822Token->OutputLine());
+				LOGGING(KFound,KReturnReceiptTo);
+				break;
+			case CLocalRfc822Token::EEndOfHeader:
+				// the next line goes in the body part
+				iFinishedHeader = ETrue;
+				RECVLOG(KEndOFHeader)
+				break;
+			default:
+				RECVLOG(KEndOFHeader)
+				break;
+			}
+
+
+		if(iRfc822Token->iHeaderPart != CLocalRfc822Token::ENotFinished)
+			{
+			// Now that we've used the data, we also need to clear the output line from the tokeniser....
+			iRfc822Token->OutputLine()->Des() = KNullDesC8;
+
+			// whatever part we just read, we may also have read the empty line that separates
+			// the header from the body
+			if((iFinishedHeader = iRfc822Token->LastToken()) != EFalse)	//iFinishedHeader set to 1 on CRLF-
+				{
+				RECVLOG(KLastToken);
+				iNotFinishedRfc822Header = EFalse;
+
+				iHeaderConverter->SetMessageType(iMimeParser->MessageIsMime());
+				iHeaderConverter->DecodeAllHeaderFieldsL(*iOutputHeader);
+
+				if (iMimeParser->MessageIsMime())
+					EndOfHeaderMIMEProcessingL();
+				else
+					EndOfHeaderProcessingL();
+
+				if (iStore8BitData)
+					{
+					iBodyText->SetDefaultCharacterSet(iCharConv->SystemDefaultCharset());
+					if ( iMimeParser->MessageIsMime() && iMimeParser->ContentType()==EMimeText )
+						iBodyText->SetCharacterSet(iMimeParser->CurrentCharsetL());
+					else
+						iBodyText->SetCharacterSet(0);
+					}
+				else
+					{
+					// Get charset for decoding.
+					if ( iMimeParser->MessageIsMime() && iMimeParser->ContentType()==EMimeText )
+						iCharConv->PrepareToConvertToFromOurCharsetL(iMimeParser->CurrentCharsetL());
+					else
+						iCharConv->PrepareToConvertToFromOurCharsetL(iCharConv->SystemDefaultCharset());
+					}
+				}
+			}
+		}
+	else if (iReceivingHeadersOnly == EFalse)
+		{	
+		//Set to EFalse when a single line is to be skipped (ie boundary line)
+		iCommitLine=ETrue; 
+
+		// read one line of the message body if I am processing a whole email message
+		if(iMimeParser->MessageIsMime())
+			ParseMimeLineL(aSourceLine);
+		else
+			ParseBodyLineL(aSourceLine);	
+
+		if((iCommitLine) && (!iSkipData))
+			DecodeAndStoreLineL(aSourceLine);
+		}
+	}
+
+
+/**
+MessageEntryDetailsL()
+
+@return
+*/
+TMsvEmailEntry CLocalImRecvConvert::MessageEntryDetailsL()
+	{
+	iMessageEntryCalled=ETrue;
+	CloseAttachmentFileL();
+
+	// A message requiring manual termination and not part way through a MIME part header
+	if( iTopMessagePart==EntryId() && iFinishedHeader) 
+		StoreEntryStreamsL(KStore822Header|KStoreMIMEHeader);
+	else
+		{
+		User::LeaveIfError(iServerEntry->SetEntry(iTopMessagePart));         
+		delete iEmailEntry;
+		iEmailEntry=NULL;
+		iEmailEntry = new (ELeave) TMsvEmailEntry(iServerEntry->Entry());
+		}
+		
+	return *iEmailEntry;
+	}
+
+
+/**
+MessageCompleteL()
+
+@param aEmailEntry
+*/
+void CLocalImRecvConvert::MessageCompleteL(TMsvEmailEntry aEmailEntry)
+	{
+	// Restore the entry context
+	if (iServerEntry->Entry().Id() == KMsvNullIndexEntryId)
+		User::LeaveIfError(iServerEntry->SetEntry(iSavedEntryId));
+
+	__ASSERT_DEBUG(iMessageEntryCalled, gPanic(KPanicMessageEntryNotCalled));
+	__ASSERT_DEBUG(aEmailEntry.Id()==iTopMessagePart, gPanic(KPanicMessageEntryIdHasChanged)); // Id should be set to iTopMessagePart
+
+	// Called ResetL() to reset object instead of ResetForHeadersL()
+	__ASSERT_DEBUG(iReceivingHeadersOnly, gPanic(KPanicIncorrectResetState)); 
+
+	if(iEmailEntry)
+		{
+		if (iEmailEntry->Id())
+			{
+			if(iLeaveError==KErrNone)
+				{
+				// a remote email header cannot have any attachments or be marked as complete...
+				aEmailEntry.SetAttachment(EFalse);
+				aEmailEntry.SetMHTMLEmail(EFalse);
+				aEmailEntry.SetComplete(EFalse);
+				User::LeaveIfError(iServerEntry->ChangeEntry(aEmailEntry));
+				RECVLOG(KHeaderComplete)
+				}
+			else
+				{
+				if (!iPopulateMessage)
+					{
+					TMsvId currentId = EntryId();
+					User::LeaveIfError(iServerEntry->SetEntry(iServerEntry->Entry().Parent()));			
+					User::LeaveIfError(iServerEntry->DeleteEntry(currentId));
+					}
+				User::Leave(iLeaveError);
+				}
+			}
+		}
+
+	// Save the entry context and move it to null so that we're not locking any folders
+	iSavedEntryId = iServerEntry->Entry().Id();
+	User::LeaveIfError(iServerEntry->SetEntry(KMsvNullIndexEntryId));
+	}
+
+
+/**
+MessageCompleteL()
+
+@param aPartialDownload
+*/
+void CLocalImRecvConvert::MessageCompleteL(TBool aPartialDownload)
+	{
+	iPartialEmail=aPartialDownload;
+	MessageCompleteL();
+	}
+  
+
+/**
+MessageCompleteL()
+*/
+void CLocalImRecvConvert::MessageCompleteL()
+	{
+	// Restore the entry context
+	RECVLOG(KStartMessageComplete)
+	if (iServerEntry->Entry().Id() == KMsvNullIndexEntryId)
+		User::LeaveIfError(iServerEntry->SetEntry(iSavedEntryId));
+
+	if (iParsedMimeBoundaryLast==EFalse && iAttachmentFileState==EFileIsOpen && iPartialEmail!=EFalse)
+		{
+		iAttachmentFileState=EFileTopIncomplete;
+		}
+
+	CloseAttachmentFileL();
+
+	if(!iEmailEntry->Id())
+		return;
+
+	if(iLeaveError!=KErrNone)
+		{
+		User::Leave(iLeaveError);
+		}
+
+	if (EntryId()!=iTopMessagePart)
+		{
+		iEmailEntry->SetComplete(ETrue);
+		StoreEntryStreamsL(KStoreBodyText);
+		MoveToParentEntryL();
+
+		if( iTopMessagePart==EntryId() && iFinishedHeader) 
+			{
+			iEmailEntry->SetVisible(ETrue);
+			iEmailEntry->SetInPreparation(EFalse);
+			iEmailEntry->SetBodyTextComplete(ETrue);
+			iEmailEntry->SetComplete(ETrue);
+
+			// Main message.
+			StoreMessageEntryDetailsL();
+			return;
+			}
+		else if(iEmailEntry->iType == KUidMsvMessageEntry)
+			{
+			StoreMessageEntryDetailsL();
+			MoveToParentEntryL();
+			StoreMessageEntryDetailsL();
+			}
+		}
+
+	// A message requiring manual termination and not part way through 
+	// a MIME part header.
+
+	User::LeaveIfError(iServerEntry->SetEntry(iTopMessagePart));         
+	if(NULL!=iEmailEntry)
+		{
+		delete iEmailEntry;
+		iEmailEntry=NULL;
+		}
+	iEmailEntry = new (ELeave) TMsvEmailEntry(iServerEntry->Entry());
+	iEmailEntry->SetVisible(ETrue);
+	iEmailEntry->SetInPreparation(EFalse);
+	iEmailEntry->SetComplete(ETrue);
+	iEmailEntry->SetBodyTextComplete(ETrue);
+
+	iEmailEntry->SetAttachment(iParent->At(0).iAttachment);
+	iEmailEntry->SetMHTMLEmail(iParent->At(0).iMHTML);
+
+	if(iEmailEntry->MHTMLEmail() == EFalse && iEmailEntry->Attachment() == EFalse && iRelatedAttachments !=EFalse)
+		{
+		iEmailEntry->SetAttachment(ETrue);
+		}
+	iRelatedAttachments=EFalse;
+	
+	iEmailEntry->iSize=iParent->At(0).iSize;
+	iEmailEntry->SetMessageFolderType(iParent->At(0).iFolder);
+
+	User::LeaveIfError(iServerEntry->ChangeEntry(*iEmailEntry));
+
+	// Save the entry context and move it to null so that we're not locking any folders
+	iSavedEntryId = iServerEntry->Entry().Id();
+	User::LeaveIfError(iServerEntry->SetEntry(KMsvNullIndexEntryId));
+	RECVLOG(KMessageComplete)
+	}
+
+
+/**
+PrepareDecoder()
+
+*/
+void CLocalImRecvConvert::PrepareDecoder()
+	{
+	switch(iMimeParser->ContentEncoding())
+		{
+		case EEncodingTypeNone:
+		case EEncodingType7Bit:
+		case EEncodingType8Bit:
+			iAlgorithm = ENoAlgorithm;
+			RECVLOG(KCollectingData7)
+			break;
+		case EEncodingTypeQP:
+			iAlgorithm = EQPDecode;
+			RECVLOG(KCollectingDataQP)
+			break;
+		case EEncodingTypeBASE64:
+			iAlgorithm = EBase64Decode;
+			RECVLOG(KCollectingBase64)
+			break;	
+		case EEncodingTypeUU:
+			iAlgorithm = EUUDecode;
+			RECVLOG(KCollectingUU)
+			break;	
+		default:	// EEncodingTypeUnknown, EEncodingTypeNone, EEncodingTypeBinary	
+			iAlgorithm = ENoAlgorithm;
+			break;
+		} // switch
+	iPrepared = ETrue;
+	}
+
+  
+/**
+DecodeAndStoreLineL()
+
+@param aSourceLine
+*/
+void CLocalImRecvConvert::DecodeAndStoreLineL(const TDesC8& aSourceLine)
+	{
+	TInt sourceLineLength=aSourceLine.Length();
+	TBool blankLine = EFalse;
+
+	// create a temporary buffer to write the decoded data into. 
+	// This will always be as long as or shorter than the original.
+	
+	HBufC8* convertedLine = HBufC8::NewLC(sourceLineLength+KConversionRemainderLength);
+	TPtr8 des(convertedLine->Des());
+
+	if(iFinalLine)						
+		{
+		// We've got to the end of encoded section, so set in order to skip all
+		// trailing empty lines & postamble until we reach the next MIME/UUE boundary
+
+		RECVLOG(KSkippingData)
+		iSkipData = ETrue;
+		}
+	else
+		{
+		switch(iAlgorithm)
+			{
+			case EBase64Decode:
+				RECVLOG(KDecodingBase64);
+
+				iB64Codec.Decode(aSourceLine, des); 
+				RECVLOG(KDecodedBase64);
+				break;
+			case EUUDecode:
+				RECVLOG(KDecodingUU);
+				//used to end a Mime encoded UU section else no purpose
+				iFinalLine=(aSourceLine.CompareF(KImcvUueLastLine)==0);	
+				if(iFinalLine)
+					iCommitLine=EFalse;
+				else
+					{
+					//returns True on invalid data
+					if((!iFinalLine)&&(iUUCodec.Decode(aSourceLine, des))) 
+						{
+						RECVLOG(KUUEDataCorrupt)
+						if(iAttachmentFileState==EFileIsOpen)
+							{
+							iAttachmentFileState=EFileIsCorrupt;
+							iLeaveError=KErrCorrupt;
+							CloseAttachmentFileL();
+							}
+						else
+							User::Leave(KErrCorrupt);
+						}
+					}
+				RECVLOG(KDecodedUU);
+				break;
+			case EQPDecode:
+				RECVLOG(KDecodingQP);
+				iQPCodec.Decode(aSourceLine, des);
+				RECVLOG(KDecodedQP);
+				break;
+			case ENoAlgorithm:
+				{				
+				// If the data is to be stored in CRichText clean it up before copying it to the buffer
+				TLex8 lex(aSourceLine);
+				blankLine=ETrue;
+				while(blankLine && !lex.Eos())
+					{
+					blankLine = (lex.Peek()==KImcvSP || lex.Peek()==KImcvTab 
+						|| lex.Peek()==KImcvCR || lex.Peek()==KImcvLF);
+					lex.Inc();
+					}
+				des.Copy(aSourceLine);
+				}				
+			default:
+				break;
+			} // end switch
+	
+			// Commits the decoded data to the appropriate store or trashes the line 
+			if(iCommitLine) 
+				{
+				if (iLeftOver.Length())
+					{
+					des.Insert(0, iLeftOver);
+					iLeftOver.SetLength(0);
+					}
+
+				if(iCurrentPartIsRichText)
+					{
+					if (iStore8BitData)
+						iBodyBuf->InsertL(iBodyBuf->Size(), des);
+					else
+						WriteToBodyL(des, blankLine);
+					}
+				else
+					WriteToAttachmentL(des);
+				}
+		} // end else
+
+	CleanupStack::PopAndDestroy(); // convertedLine
+	}
+
+
+/**
+ParseMimeLineL()
+
+@param aSourceLine
+*/
+void CLocalImRecvConvert::ParseMimeLineL(const TDesC8& aSourceLine)
+	{
+
+	if(!iMimeParser->IsBoundary(aSourceLine))
+		{
+		if(!iPrepared) // first line of the body
+			{		
+			if (iMIMEPart_822Header)
+				{
+				// missing 822 part header. Revert to default.
+				EndOfHeaderMIMEProcessingL();
+				iMIMEPart_822Header=EFalse;
+				}
+
+			PrepareDecoder();
+			}
+
+		if (CheckUUEStartL(aSourceLine))
+			{
+			iAlgorithm=EUUDecode;
+			iCommitLine=EFalse;
+			}
+		}
+	else
+		{
+		// found a MIME boundary so store the current parts data and update its entry.
+
+		RECVLOG(KFoundMIMEBoundary)
+		iCommitLine=EFalse; //Dont store this line as its a boundary.
+
+		if(!iFirstBoundaryReached && iEntryType==EFolderEntry)
+			{
+			iFirstBoundaryReached=ETrue;
+			if (!iCurrentMultipartFolderEntryId)
+				iCurrentMultipartFolderEntryId = EntryId();
+			MoveToParentEntryL();
+			ResetForNewEntryL(iDefaultEntryType);
+			return; // First boundary encountered.
+			}
+
+		CloseAttachmentFileL();
+		if(iNewEntry)
+			{
+			iEmailEntry->SetComplete(ETrue);
+			iEmailEntry->SetBodyTextComplete(ETrue);
+			StoreEntryStreamsL(KStoreMIMEHeader | KStoreBodyText);
+			if (iBodyId==KMsvNullIndexEntryId)
+				{
+				iBodyId=iEmailEntry->Id();
+				}
+			}
+
+		iSkipData = EFalse;
+
+		// check whether we just found the terminating boundary...
+		if(iMimeParser->IsTerminatingBoundary())
+			{
+			RECVLOG(KRemoveBoundary);
+			iMimeParser->RemoveBoundary();
+			RECVLOG(KRemovedBoundary);
+			iMIMEPart_822Header = EFalse;
+
+			if (EntryId()!=iTopMessagePart)
+				{
+				if(iEmailPart==KParentPart)
+					{
+					// rfc822 message which is not  not multipart.
+					iEmailPart=KNoPart;
+					MoveToParentEntryL();				
+
+					// Embedded message
+					iEmailEntry->SetComplete(ETrue);
+					iEmailEntry->SetBodyTextComplete(ETrue);
+					StoreMessageEntryDetailsL();
+					}
+				else if (iEmailEntry->iType==KUidMsvMessageEntry)
+					{
+					// Moving up from a multi embedded rfc822 message.
+					iEmailEntry->SetComplete(ETrue);
+					iEmailEntry->SetBodyTextComplete(ETrue);
+					StoreMessageEntryDetailsL();
+					}
+				}
+
+			MoveToParentEntryL();
+			iEntryDataSize = iEmailEntry->iSize;
+
+			if(iServerEntry->Entry().iType == KUidMsvFolderEntry)
+				{
+				iCurrentMultipartFolderEntryId = EntryId();
+				}
+			else if (EntryId()!=iTopMessagePart)
+				{
+				if(iEmailEntry->iType == KUidMsvMessageEntry)
+					{
+					iEmailEntry->SetComplete(ETrue);
+					iEmailEntry->SetBodyTextComplete(ETrue);
+					StoreMessageEntryDetailsL();
+					}
+				MoveToParentEntryL();
+				iEntryDataSize += iEmailEntry->iSize;
+				}
+
+			if(!iNewEntry)
+				ResetForNonMimeEntryL();
+
+			RECVLOG(KSkippingData)
+			iSkipData = ETrue;
+			iDefaultEntryType=ETextEntry;
+			}
+		else // if regular boundary
+			{ 
+			RECVLOG(KSectionHeader)
+			if(iEmailPart==KParentPart && EntryId()!=iTopMessagePart)
+				{
+				// rfc822 message which is not  not multipart.
+				iEmailPart=KNoPart;
+				MoveToParentEntryL();
+				// Embedded message
+				iEmailEntry->SetComplete(ETrue);
+				iEmailEntry->SetBodyTextComplete(ETrue);
+				StoreMessageEntryDetailsL();
+				}
+
+			if (!iCurrentMultipartFolderEntryId && iEmailPart==KNoPart)
+				MoveToParentEntryL();
+
+			ResetForNewEntryL(iDefaultEntryType);
+			}
+		}
+	}
+
+  
+/**
+EndOfHeaderProcessingL()
+
+*/
+void CLocalImRecvConvert::EndOfHeaderProcessingL()
+	{	
+	CreateEntryL();
+	StoreEntryStreamsL(KStore822Header);
+	iEntryDataSize = 0;
+	}
+
+
+/**
+EndOfHeaderMIMEProcessingL()
+Have just finished processing header, what next.. ?
+All MIME entry entry creation takes place here.
+
+*/
+void CLocalImRecvConvert::EndOfHeaderMIMEProcessingL()
+	{	
+	if (iMimeParser->IsMessageDigest())
+		iDefaultEntryType=EMessageEntry;
+
+	if (iMimeParser->VCard() || iMimeParser->VCalendar())
+		{
+		iCurrentPartIsRichText = EFalse;	
+		iEntryType = EAttachmentEntry;
+		}
+
+	// Don't create entry if an embedded message header. 
+	if (!iMIMEPart_822Header || iTopMessagePart==EntryId() )
+		CreateEntryL(); 
+
+	if (!iMIMEPart_822Header && !iMimeParser->MimeFieldsExist() && iDefaultEntryType==EMessageEntry)
+		{
+		// MIME header not present. So expecting embedded 822 header
+		iEmailPart = KParentPart;
+		iMIMEPart_822Header=ETrue;
+		iEntryType=ETextEntry;
+		}
+	else if (iMimeParser->ContentType()==EMimeMessage)
+		{
+		// Having received A MIME header of type message/..., store and continue.
+
+		StoreEntryStreamsL(KStore822Header|KStoreMIMEHeader);
+		iMimeParser->ResetForNewEntry();
+		iMIMEPart_822Header=ETrue;
+
+		// Non-multipart embedded message.
+		if (iTopMessagePart==EntryId())
+			{
+			iEntryType = EMessageEntry;
+			ResetForNonMimeEntryL();
+			}
+		else
+			iEntryType=ETextEntry;
+		}
+	else if ( (iTopMessagePart==EntryId() || iMIMEPart_822Header)&&(!iReceivingHeadersOnly) )
+		{
+		// Main rfc822 header or embedded header.
+
+		TImEmailFolderType folderType=iMimeParser->MessageFolderType();
+		if (iMIMEPart_822Header)
+			{
+			iEmailEntry->iDetails.Set(iOutputHeader->From());
+			iEmailEntry->iDescription.Set(iOutputHeader->Subject());
+			iMIMEPart_822Header=EFalse;
+			}
+
+		if (iRfc822Token->i822FieldsExist)
+			StoreEntryStreamsL(KStore822Header|KStoreMIMEHeader);
+		else
+			StoreEntryStreamsL(KStoreMIMEHeader);
+
+
+		if (iMimeParser->ContentType()==EMimeMultipart)
+			{	
+			RECVLOG(KSkippingData)
+			ResetForNewEntryL(EFolderEntry);
+			iMimeParser->SetMessageFolderType(folderType);
+			iSkipData = ETrue;
+			iEmailPart = KMultiPart;
+			iCurrentMultipartFolderEntryId=0;
+			}
+		else 
+			{
+			// Not multipart but some header data to store.
+			iEntryDataSize = 0;
+			}
+
+		CreateEntryL();
+		}
+
+	iRfc822Token->i822FieldsExist=EFalse;
+	iMimeParser->ResetMimeFieldsExist();
+	
+	iFinishedHeader = iMIMEPart_822Header ? EFalse:ETrue;
+	iSkipData = iMimeParser->ContentType()==EMimeMultipart ? ETrue:EFalse;
+	}
+
+
+/**
+ParseBodyLineL()
+Non Mime body parsing
+
+@param aSourceLine
+*/
+void CLocalImRecvConvert::ParseBodyLineL(const TDesC8& aSourceLine)
+	{
+	TInt len=aSourceLine.Length();
+	iTopPartialDownloadCounter+=len; // added for TOP. increment the number of bytes of the attachment downloaded so far
+	TMsvId id=0;
+	if (iBodyId==KMsvNullIndexEntryId)
+		{
+		iBodyId=iEmailEntry->Id();
+		}
+
+	// first check whether this line is a UUEncode start boundary
+	if(CheckUUEStartL(aSourceLine)) 
+		{
+		RECVLOG(KFoundUUEStartBoundary)
+		TFileName tempStore = iAttachmentName;
+		id = EntryId();
+		if (!iNewNonMIMEBodyPart || id!=iTopMessagePart) // main message entry
+			{
+			iEmailEntry->SetComplete(ETrue);
+			iEmailEntry->SetBodyTextComplete(ETrue);
+			StoreEntryStreamsL(KStoreBodyText);
+			}
+		MoveToParentEntryL();
+		if ( !CreateNonMIMEFolderEntryL(id))
+			ResetForNonMimeEntryL();
+			
+		iEntryType = EAttachmentEntry;
+		CreateEntryL();
+		SetAttachmentName(tempStore);
+		
+		iCurrentPartIsRichText = EFalse;
+		iAlgorithm=EUUDecode;
+		iCommitLine=EFalse;
+		if(!iSavingAttachments)
+			{
+			RECVLOG(KSkippingData)
+			iSkipData=ETrue;
+			}
+		iNewNonMIMEBodyPart=EFalse;
+		}
+	else if(aSourceLine.CompareF(KImcvUueEnd)==0) // Checks for the UUEncode end boundary
+		{
+		RECVLOG(KFoundUUEEndBoundary)
+		CloseAttachmentFileL();
+		StoreEntryDataL();
+		MoveToParentEntryL();
+		iSkipData = EFalse;
+		iCommitLine=EFalse;
+		iNewNonMIMEBodyPart=ETrue; 
+		}
+	else if (iNewNonMIMEBodyPart && !( len==2 && aSourceLine[0]==KImcvCR && aSourceLine[1]==KImcvLF ))
+		{
+		id = EntryId();
+		if (!iNewNonMIMEBodyPart || id!=iTopMessagePart)
+			{
+			iEmailEntry->SetComplete(ETrue);
+			iEmailEntry->SetBodyTextComplete(ETrue);
+			StoreEntryStreamsL(KStoreBodyText);
+			}
+		MoveToParentEntryL();
+		if ( !CreateNonMIMEFolderEntryL(id))
+			ResetForNonMimeEntryL();
+		iAlgorithm=ENoAlgorithm;
+		iEntryType = ETextEntry;
+		CreateEntryL();
+		iNewNonMIMEBodyPart=EFalse;
+		}	
+	}
+
+
+/**
+CreateNonMIMEFolderEntryL()
+
+@param aCurrentId
+@return
+*/
+TBool CLocalImRecvConvert::CreateNonMIMEFolderEntryL(TMsvId aCurrentId)
+	{
+	if ( aCurrentId==iTopMessagePart || iCurrentMultipartFolderEntryId )
+		return EFalse;
+
+	// Create Folder.
+	iServerEntry->SetEntry(iTopMessagePart); 
+	iEmailPart = KMultiPart;
+	iEntryType = EFolderEntry;
+	CreateEntryL();
+
+	// Move existing child entry under folder.
+	TMsvId destId = EntryId();
+	iServerEntry->SetEntry(iTopMessagePart); 
+	iServerEntry->MoveEntryWithinService(aCurrentId, destId);
+	User::LeaveIfError(iServerEntry->SetEntry(aCurrentId));
+	User::LeaveIfError(iServerEntry->SetEntry(iServerEntry->Entry().Parent())); 
+
+	// Create MimeHeader.
+	iEmailEntry->SetMessageFolderType(iMimeParser->MessageFolderType());
+
+	RECVLOG(KResetForNewEntry) 
+
+	iMimeParser->ResetForNewEntry();
+	
+	if (iStore8BitData)
+		{
+		//Create a buffer to hold the body text as it is down loaded.
+		delete iBodyBuf;
+		iBodyBuf = NULL;
+		iBodyBuf = CBufFlat::NewL(KBodyTextChunkSizeBytes);
+		}
+	else
+		{
+		iOutputBody->Reset();
+		}
+		
+	ResetForNonMimeEntryL(); 
+	RECVLOG(KResetedForNewEntry) 
+	return ETrue;
+	}
+
+
+/**
+CreateAttachmentL()
+
+@return
+*/
+TBool CLocalImRecvConvert::CreateAttachmentL()
+	{
+	// Get and set Attachment File path
+	TFileName filepath;
+	// added to support TOP command. Reset the download counter each time we have a new
+	// attachment
+	iTopPartialDownloadCounter = 0; 
+
+	// Need to check that the complete filename: iAttachmentFullPath & iAttachmentName	
+	// does not exceed 256 characters. Greater than this and it cannot be saved as a file.
+
+	TBool addExtension=ETrue;
+	if(iAttachmentName.Length() == 0)	//i.e. problem with Attachment name
+	    {
+		// No filename present. Generate one.
+		if(iMimeParser->ContentDescription().Length()!=0)
+			{
+			// Use ContentDescription() as default name 
+			// - as this is more informative than the default
+
+			TLex sourceLineLex = iMimeParser->ContentDescription();
+			ExtractFilename(sourceLineLex, iAttachmentName);
+			}
+		else
+			iAttachmentName = *iDefaultAttachmentName;
+		}
+	else
+		{
+		// Filename present. Check it is valid.
+		ReplaceInvalidCharacters(iAttachmentName);
+		if (iAttachmentName.Locate(KImcvFullStop)!=KErrNotFound)
+			addExtension=EFalse;
+		}
+	if (addExtension)
+		AddFileExtension();
+
+	CMsvStore* store = iServerEntry->EditStoreL(); 
+	CleanupStack::PushL(store);
+	CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+	RFile file; 
+	store->AttachmentManagerExtensionsL().CreateAttachmentL(iAttachmentName,file,attachment);
+	
+	iAttachmentFile.SetFileHandle(file,TImAttachmentFile::EImFileWrite);
+	store->CommitL();
+	CleanupStack::PopAndDestroy(store); // store
+
+	if(KErrNone!=iLeaveError)
+		{
+		iAttachmentFileState=EFileFailedToOpen;
+		CloseAttachmentFileL();
+		return EFalse;
+		}
+
+	iAttachmentFileState=EFileIsOpen;
+	return ETrue;
+	}
+
+
+/**
+WriteToAttachmentL()
+
+@param text
+*/
+void CLocalImRecvConvert::WriteToAttachmentL(const TDesC8& text)
+	{
+	if ( (iAttachmentFileState==EFileIsClosed || iAttachmentFileState==EFileNotOpen) 
+		&& CreateAttachmentL() && iEntryType!=EHtmlEntry)
+			iEmailEntry->SetAttachment(ETrue);
+	
+	if(iAttachmentFileState!=EFileIsOpen || !text.Length())
+		{
+		RECVLOG(KSkippingData)
+		iSkipData = ETrue;
+		}
+
+	// write decoded data into a file if there is any data there to write.
+
+	RECVLOG(KWritingToFile)
+
+	// Convert text before writing to attachment.
+	
+	// Store as Binary files..
+	iLeaveError=iAttachmentFile.WriteFile(text);
+
+	if(KErrNone==iLeaveError)
+		iEntryDataSize += text.Length();
+	else	
+		{
+		// the file write failed (eg.there is no space left), set new file state and skip 
+		RECVLOG(KFailedToWriteToFile)
+		iAttachmentFileState=EFileIsIncomplete;
+		CloseAttachmentFileL();
+		}
+	RECVLOG(KWroteToFile)
+	}
+
+
+/**
+CloseAttachmentFileL()
+
+*/
+void CLocalImRecvConvert::CloseAttachmentFileL()
+	{
+	// If anything bad happened a message is sent to the parts CRichText
+	switch(iAttachmentFileState)
+		{
+		case EFileNotOpen:
+			iAttachmentFileState=EFileIsClosed;
+		case EFileIsClosed: //do nothing - this shouldn't happen	
+			break;
+		case EFileIsOpen:		//successful attachment decode
+			RECVLOG(KClosingAttachFile)
+			iAttachmentFile.CloseFile();
+			iAttachmentFileState=EFileIsClosed;
+			iEmailEntry->SetComplete(ETrue);
+			break;
+		case EFileIsIncomplete:		// file write failed
+		case EFileFailedToOpen:		// can't open attach file
+		case EFileIsCorrupt:		// UU data being decoded is corrupt
+			RECVLOG(KClosingAttachFile)
+			iAttachmentFile.CloseFile();	//file has to be closed before it can be deleted
+			RECVLOG(KDeletingAttachFile)
+			{ 
+			// NOTE - need the braces to stop error for re-definition of store
+			CMsvStore* store = iServerEntry->EditStoreL(); 
+			CleanupStack::PushL(store);
+		
+			// Remove the attachment and commit the store.	
+			store->AttachmentManagerExtensionsL().RemoveAttachmentL(0);
+			store->CommitL();
+			CleanupStack::PopAndDestroy(store);
+			}
+			iEmailEntry->SetAttachment(EFalse);
+			iAttachmentFileState=EFileIsClosed;
+			RECVLOG(KDeletedAttachFile)
+
+			if(iSavingAttachments && !iStore8BitData)
+				{
+				WriteToBodyL(KImcvParagraph);
+				WriteToBodyL(*iRemovedAttachmentTag);	//lost attachment - notify user
+				TBuf8<KMaxFileName> name;
+				name.Copy(iAttachmentName); //16 to 8
+				WriteToBodyL(name);
+				WriteToBodyL(KImcvParagraph);
+				}
+
+			User::Leave(iLeaveError);
+			// Skip any remaining encoded data in message
+			break;
+		case EFileTopIncomplete:
+			RECVLOG(KClosingAttachFile)
+			iAttachmentFile.CloseFile();	//file has to be closed before it can be deleted
+
+			// added for TOP command. Ensure we know correct amount of data for later redownload
+			iSizeOfAttachmentsRemoved+=iTopPartialDownloadCounter;
+
+
+			RECVLOG(KDeletingAttachFile)
+			{ 
+			// NOTE - need the braces to stop error for re-definition of store
+			CMsvStore* store = iServerEntry->EditStoreL(); 
+			CleanupStack::PushL(store);
+		
+			// Remove the attachment and commit the store.	
+			store->AttachmentManagerExtensionsL().RemoveAttachmentL(0);
+			store->CommitL();
+			CleanupStack::PopAndDestroy(store);
+			}
+			iEmailEntry->SetAttachment(EFalse);
+			iAttachmentFileState=EFileIsClosed;
+			RECVLOG(KDeletedAttachFile);
+			TMsvId id = EntryId();
+			TMsvId parent = iServerEntry->Entry().Parent();
+			MoveToParentEntryL();
+			TMsvId setTo=iServerEntry->Entry().Id();
+			if(setTo!=parent)
+				{
+				iServerEntry->SetEntry(parent);
+				}
+			User::LeaveIfError(iServerEntry->DeleteEntry(id));			
+			iServerEntry->SetEntry(setTo);
+			break;
+		}
+	}
+
+
+/**
+LineIsAllWhitespace()
+
+@return
+*/
+TBool CLocalImRecvConvert::LineIsAllWhitespace()
+	{// returns 1 if all elements of the current line are whitespace
+	TBool	spaceFound = 1;
+	TLex8	aLex = iLineLex;
+
+	while (spaceFound && aLex.Peek()!=KImcvCR)
+		{
+		if (aLex.Peek()==KImcvSP)
+			{
+			spaceFound = 1;
+			aLex.Inc();
+			}	
+		else spaceFound = 0;
+		}
+	return (spaceFound);
+	}
+
+  
+/**
+CheckUUEStartL()
+
+@param aSourceLine
+@return
+*/
+TBool CLocalImRecvConvert::CheckUUEStartL(const TDesC8& aSourceLine)
+	{
+	// Checks if the descriptor contains the UUE begin header
+	// Extracts the file name if it is
+	
+	TInt sourceLength = aSourceLine.Length();
+	if(sourceLength < KImcvUueStart().Length()+3) // can't be it, it's not long enough
+		return EFalse;
+
+	if(!aSourceLine.Left(KImcvUueStart().Length()).CompareF(KImcvUueStart)) // start of line might be UUE boundary
+		{
+		// we also need to check that the next three chars are numbers - Unix file access code
+		const TUint8* _ptr = aSourceLine.Ptr();
+		TInt length=KImcvUueStart().Length();// this defines length as 6 ie. "b e g i n  " 
+		if(TChar(_ptr[length]).IsDigit() && TChar(_ptr[length+1]).IsDigit() && TChar(_ptr[length+2]).IsDigit())
+			{
+			// we've found 'begin ###' at the start of a line -
+			// that's about as good as we can do 
+			// now grab the file name and paste it into the document
+			// Extract filename from string, removing any surrounding quote marks
+
+			HBufC16* pBuf16 = HBufC16::NewLC(aSourceLine.Length());
+			pBuf16->Des().Copy(aSourceLine);
+			TLex sourceLineLex = pBuf16->Ptr();
+			//parse until start of filename and mark
+			length+=3;					// length (init'd to 6 above) now equals 9 ie. "begin ###"
+			sourceLineLex.Inc(length);	// skips "begin ###"
+			sourceLineLex.SkipSpace();	// skips any leading whitespace
+
+			ExtractFilename(sourceLineLex, iAttachmentName);
+			CleanupStack::PopAndDestroy(); // pBuf8
+			return ETrue;
+			}
+		}
+		
+	return EFalse;
+	}
+
+  
+/**
+AddFileExtension()
+*/
+void CLocalImRecvConvert::AddFileExtension()
+	{
+	switch (iMimeParser->ContentType())
+		{
+		case EMimeText:
+			// Add on extension to make opening file from email editor possible.
+
+			if ( iMimeParser->ContentSubType()==KImcvHtml )
+				iAttachmentName.Append(KHtmlExtension);
+			else if (iMimeParser->VCard() || iMimeParser->VCalendar())
+				iAttachmentName.Append(KVCardExtension);
+			else //if ( iMimeParser->ContentSubType()==KImcvPlain)
+				iAttachmentName.Append(KTextExtension);
+			break;
+		case EMimeImage:
+		case EMimeAudio:
+		case EMimeVideo:
+			if ( (iMimeParser->ContentSubType()==KImcvBmp) 
+					|| (iMimeParser->ContentSubType()==KImcvGif)
+					|| (iMimeParser->ContentSubType()==KImcvJpeg)
+					|| (iMimeParser->ContentSubType()==KImcvTiff)
+					|| (iMimeParser->ContentSubType()==KImcvWav) )
+				{
+				TBuf<KMaxExtensionLength> buf;
+				buf.Copy(iMimeParser->ContentSubType());
+				iAttachmentName.Append(KImcvFullStop);
+				iAttachmentName.Append(buf);
+				}
+			break;
+		default:
+			break;
+		} // End switch
+	}
+
+  
+/**
+WriteToBodyL()
+
+@param aText
+@param aBlankLine
+*/
+void CLocalImRecvConvert::WriteToBodyL(const TDesC8& aText, TBool aBlankLine)
+	{
+	RECVLOG(KWritingToBody)
+
+	if(aText.Length() && aText[aText.Length()-1]==CEditableText::ELineBreak )
+		RECVLOG(KLineHasLineBreak)
+	TInt pos = iOutputBody->DocumentLength();
+
+	// Add bits of body text, converting along the way, till no characters left
+	// .. to convert.
+
+	if(aBlankLine)
+		{
+		RECVLOG(KBlankLine);
+		iOutputBody->InsertL(pos, CEditableText::EParagraphDelimiter);
+		pos++;
+		return;
+		}
+
+	// Convert text before writing to body.
+	TInt rem = 0;
+	HBufC16* text16=HBufC16::NewLC(aText.Length());
+	TPtr16 ptr16(text16->Des());
+	TInt unconvertedChars, firstPos; // not used 
+	rem = iCharConv->ConvertToOurCharsetL(aText, ptr16, unconvertedChars, firstPos);
+	if (rem < 0) // error
+		{
+		// Copy unconverted characters.
+		Append(ptr16, aText);
+		iOutputBody->InsertL(pos, ptr16);
+		CleanupStack::PopAndDestroy(); // text16
+		return;
+		}
+	else if (rem && rem < KConversionRemainderLength)
+		iLeftOver.Copy(aText.Right(rem));	
+	
+	// Make sure that the line is not CRLF terminated 
+	// - replace with a line break if necessary.
+
+	TInt length = ptr16.Length();
+	switch(iAlgorithm)
+		{
+		case EBase64Decode:
+		case EUUDecode:
+			{
+			// Check for CRLF throughout the string.
+
+			if (!length)
+				break; // String length zero.
+
+			if (iEncounteredLineEndingInCarriageReturn)
+				{
+				pos--; // overwrite the stored CR.
+				ptr16[0] = CEditableText::ELineBreak;
+				}
+			iEncounteredLineEndingInCarriageReturn = ptr16[length-1]==KImcvCR ? ETrue:EFalse;
+
+			TInt start = 0;
+			TInt offset = ptr16.Find(KImcvCRLF16);
+
+			while (offset != KErrNotFound)
+				{
+				ptr16[offset] = CEditableText::ELineBreak;
+				const TDesC& buf = ptr16.Mid(start, offset-start+1);
+				iOutputBody->InsertL(pos, buf);
+				pos += buf.Length();
+				start=offset+2; // Skip the LF char.
+				offset = ptr16.Find(KImcvCRLF16);
+				} 
+
+			if (start<length)
+				{
+				const TDesC& buf = ptr16.Right(length-start);
+				iOutputBody->InsertL(pos, buf);
+				pos += buf.Length();
+				}
+			}
+			break;
+
+		case EQPDecode:
+		case ENoAlgorithm:
+		default:
+			// Check for CRLF at end of line.
+			if(length>=2 && ptr16[length-2]==KImcvCR && ptr16[length-1]==KImcvLF)
+				{
+				ptr16[length-2] = CEditableText::ELineBreak;
+				ptr16.SetLength(length-1);
+				}	
+
+			const TDesC& buf = text16->Des();
+			iOutputBody->InsertL(pos, buf);
+			pos += buf.Length();
+		}	
+
+	CleanupStack::PopAndDestroy(text16);
+	
+	RECVLOG(KWroteToBody)
+	}
+
+
+/**
+WriteToBodyL()
+
+@param aText
+*/
+void CLocalImRecvConvert::WriteToBodyL(const TDesC16& aText)  
+	{
+	RECVLOG(KWritingToBody)
+	if (aText.Length() && aText[aText.Length()-1]==CEditableText::ELineBreak)
+		RECVLOG(KLineHasLineBreak)
+
+	TInt pos = iOutputBody->Read(0).Length();
+	// get the text in before the paragraph marker that's always there
+	pos = pos-1 < 0 ? 0 : pos-1;
+	iOutputBody->InsertL(pos,aText);
+	
+	RECVLOG(KWroteToBody)
+	}
+
+  
+/**
+ParseRecipientListL()
+
+@param aList
+*/
+void CLocalImRecvConvert::ParseRecipientListL(CDesCArray& aList)
+	{
+	HBufC8* pBuf = HBufC8::NewLC(KMaxIMailHeaderReadLineLength);
+	TPtrC8 source(iRfc822Token->OutputLine()->Ptr(), iRfc822Token->OutputLine()->Length());
+	const TUint8* ptr = source.Ptr();
+	TUint8 lookFor = 0;
+	TInt count = 0;
+	TBool finishedEntry = EFalse;
+
+	// get past white space
+	while(*ptr&&((*ptr==KImcvSP)||(*ptr==KImcvSemiColon))) ptr++;
+
+	while(*ptr&&((ptr-source.Ptr())<(source.Length())))
+		{
+		if(!pBuf->Length())
+			{
+			finishedEntry = EFalse;
+			}
+
+		switch(*ptr)
+			{
+			case KImcvLeftBracket:
+				if(lookFor==KImcvRightBracket)
+					count++;
+				else
+					{
+					lookFor = KImcvRightBracket;
+					count = 1;
+					}
+				break;
+			case KImcvLeftChevron:
+				if(lookFor==KImcvRightChevron)
+					count++;
+				else
+					{
+					lookFor = KImcvRightChevron;
+					count = 1;
+					}
+				break;
+			case KImcvDoubleQuote:
+ 				lookFor = (TUint8)(lookFor==KImcvDoubleQuote ? 0 : KImcvDoubleQuote);
+				count = (lookFor ? 1 : 0);
+				break;
+			case KImcvRightBracket:
+			case KImcvRightChevron:
+				count -= (*ptr == lookFor ? 1 : 0);
+				lookFor = (TUint8)((*ptr == lookFor)&&(count == 0) ? 0 : lookFor);
+				break;
+			case KImcvComma:
+			case KImcvSemiColon:
+				finishedEntry = !lookFor;
+				break;
+			}
+
+		if(!finishedEntry)
+			{
+			// check we're not about to blow the buffer
+			if(pBuf->Length() >= pBuf->Des().MaxLength())
+				{
+				pBuf = pBuf->ReAlloc(pBuf->Length() + 64); // arbitrary extension
+				}
+			pBuf->Des().Append((TChar)*ptr);
+			// move to the next character
+			ptr++;
+			}
+		else
+			{
+			// that's it! store the address away
+			HBufC16* pBuf16 = HBufC16::NewLC(pBuf->Des().Length());
+			pBuf16->Des().Copy(pBuf->Des());
+			aList.AppendL( (HBufC16&) *pBuf16 );
+			CleanupStack::PopAndDestroy(); // pBuf16
+			pBuf->Des().SetLength(0);
+
+			// get past the separator
+			ptr++;
+
+			// get past white space (& any other separators)
+			while(*ptr && (*ptr==KImcvSP || *ptr==KImcvTab || *ptr==KImcvComma || *ptr==KImcvSemiColon)) ptr++;
+			}
+		}
+		// catch the last name in the list
+		if (pBuf)
+			{
+			TInt recipientLength = pBuf->Length();
+			if (recipientLength)
+				{
+				HBufC16* pBuf16 = HBufC16::NewLC(recipientLength);
+				pBuf16->Des().Copy(*pBuf);
+				aList.AppendL(*pBuf16);
+				CleanupStack::PopAndDestroy(); // pBuf16
+				}
+			}
+
+		CleanupStack::PopAndDestroy(); // pBuf
+	}
+
+
+/**
+ExtractFilename()
+
+@param aLex
+@param rFileName
+*/
+void CLocalImRecvConvert::ExtractFilename(TLex& aLex, TDes& rFileName)
+	{
+	// This function steps through the filename extracting the bare name and checking 
+	//  the length is less than the max of 256 for EPOC ;checks that all chars are legal for EPOC32
+	
+	TChar endChar = KImcvSemiColon;
+
+	aLex.SkipSpace();
+	
+	if (aLex.Peek()==KImcvDoubleQuote)
+		{
+		aLex.Inc();	// step over the " character
+		endChar = KImcvDoubleQuote;
+		}
+
+	aLex.Mark();	// marks where we are as this is the first char of the filename
+	
+	TInt fileNameLength = 0;
+	TInt maxFileNameLength = rFileName.MaxLength();
+
+	while(!aLex.Eos() && aLex.Peek()!=endChar && aLex.Peek()!=KImcvCR && fileNameLength < maxFileNameLength)	
+		//spools through the string until the end and marks char before quote (such that 
+		//  it extracts only the filename), EOS or before the maximum buffer length is exceeded 
+		{
+		fileNameLength++;
+		aLex.Inc();
+		}
+
+	TPtrC marked = aLex.MarkedToken(); 
+	rFileName.Copy(marked);
+	
+	ReplaceInvalidCharacters(rFileName);
+	}
+
+
+/**
+SetAttachmentName()
+
+@param aFileName
+*/
+void CLocalImRecvConvert::SetAttachmentName(TDes& aFileName)
+	{
+	ReplaceInvalidCharacters(aFileName);
+	iAttachmentName.Zero();
+
+	TUint delimiter = '.';
+	TInt  maxLength = iAttachmentName.MaxLength();
+	
+	__ASSERT_DEBUG(
+		maxLength >= aFileName.Length(), gPanic(KPanicReadLengthTooLarge)
+		);
+
+	iAttachmentName.Copy(aFileName);
+	TInt attachmentLen = iAttachmentName.Length();
+	if (attachmentLen == 0)
+		iAttachmentName = *iDefaultAttachmentName;
+	else if (iAttachmentName[0] == delimiter && maxLength >= attachmentLen + iDefaultAttachmentName->Length())
+		iAttachmentName.Insert(0, *iDefaultAttachmentName);
+	}
+
+	
+/**
+ReplaceInvalidCharacters()
+
+@param rFileName
+*/
+void CLocalImRecvConvert::ReplaceInvalidCharacters(TDes& rFileName)
+	{
+	TInt length = rFileName.Length();
+	for(TInt index=0; index < length; index++)
+		{
+		//parse extracted filename and replace any illegal chars with a default.
+
+		if(IsIllegalChar((TUint)rFileName[index]))
+			rFileName[index] = KImcvDefaultChar;
+		}
+	}
+
+
+/**
+StoreEntryStreamsL()
+*/
+void CLocalImRecvConvert::StoreEntryStreamsL()	
+	{
+	StoreEntryStreamsL(KStoreBodyText|KStore822Header|KStoreMIMEHeader);
+	}
+
+
+/**
+StoreEntryStreamsL()
+
+@param aSettings
+*/
+void CLocalImRecvConvert::StoreEntryStreamsL(TInt aSettings)	
+	{
+	RECVLOG(KStartStoringEntryStream);
+	if (iReceivingHeadersOnly==EFalse)
+		{
+		CMsvStore* entryStore = NULL;
+		TBool commitStore = EFalse;
+
+		TRAPD(error, entryStore = iServerEntry->EditStoreL());
+		if(error==KErrNone) // if store does not exist then the entry is the wrong type
+			{
+			CleanupStack::PushL(entryStore);
+
+			if (aSettings & KStore822Header)
+				Store822HeaderL(*entryStore, commitStore);
+			
+			if (aSettings & KStoreMIMEHeader)
+				StoreMIMEHeaderL(*entryStore, commitStore);
+
+			if (aSettings & KStoreBodyText)
+				StoreBodyTextL(*entryStore, commitStore);
+
+			// only commit to the store if I wrote something into it
+			if (commitStore)
+				{
+				RECVLOG(KStoringEntryStream);
+				entryStore->CommitL();
+				}
+
+			StoreEntryDataL();
+			CleanupStack::PopAndDestroy(); //entryStore		
+			}
+
+		}
+	RECVLOG(KDoneStoringEntryStream);
+	}
+
+
+/**
+Store822HeaderL()
+
+@param aStore
+@param aCommit 
+*/
+void CLocalImRecvConvert::Store822HeaderL(CMsvStore& aStore, TBool& aCommit)	
+	{
+	if(iEmptyHeaderSize<(iOutputHeader->DataSize()))
+		{
+		iEntryDataSize += iOutputHeader->DataSize()-iEmptyHeaderSize;
+		RECVLOG(KStoringHeader);
+		iOutputHeader->StoreL(aStore);	
+		RECVLOG(KStoredHeader);
+		aCommit = ETrue;
+		}
+	}
+
+
+/**
+StoreMIMEHeaderL()
+
+@param aStore
+@param aCommit
+*/
+void CLocalImRecvConvert::StoreMIMEHeaderL(CMsvStore& aStore, TBool& aCommit)	
+	{
+	if(iMimeParser->MimeHeaderSize())
+		{
+		RECVLOG(KStoringMIMEHeader);
+ 		iMimeParser->StoreMimeHeaderWithoutCommitL(aStore);
+		aCommit = ETrue;
+		RECVLOG(KStoredMIMEHeader);
+		}
+	}
+
+
+/**
+StoreBodyTextL()
+
+@param aStore
+@param aCommit
+*/
+void CLocalImRecvConvert::StoreBodyTextL(CMsvStore& aStore, TBool& aCommit)	
+	{
+	if (iStore8BitData)
+		{
+		if(iBodyBuf->Size())
+			{
+			iEntryDataSize += iBodyBuf->Size();
+			RECVLOG(KStoring8BitBody);
+			iBodyText->StoreL(aStore, *iBodyBuf);
+			aCommit = ETrue;
+			RECVLOG(KStored8BitBody);
+			}
+		}
+	else
+		{
+		if(iOutputBody->DocumentLength())
+			{
+			iEntryDataSize += iOutputBody->DocumentLength();
+			RECVLOG(KStoringBody);
+			aStore.StoreBodyTextL(*iOutputBody);
+			aCommit = ETrue;
+			RECVLOG(KStoredBody);
+			}
+		}
+	}
+
+
+/**
+StoreEntryDataL()
+
+@return
+*/
+TBool CLocalImRecvConvert::StoreEntryDataL()
+	{
+	// NB function should only be called if a whole email is being processed
+	TBool commit=EFalse;
+	RECVLOG(KUpdatingEntry)
+
+	if (iEmailEntry->iType==KUidMsvMessageEntry)
+		iParent->At(0).iSize += iEntryDataSize;
+	else
+		{
+		iEmailEntry->iSize += iEntryDataSize;
+		if (iEntryType==EAttachmentEntry || iEntryType==EHtmlEntry)
+			iEmailEntry->iDetails.Set(iAttachmentName);
+		}
+	User::LeaveIfError(iServerEntry->ChangeEntry(*iEmailEntry));
+
+	RECVLOG(KUpdatedEntry)
+	return commit;	// if I wrote data into the store, tell owner	
+	}
+
+
+/**
+MoveToParentEntryL()
+*/
+void CLocalImRecvConvert::MoveToParentEntryL()
+	{
+	// This function changes the context to the current entry's parent entry.
+	RECVLOG(KMoveToParentEntry)
+
+	// Change context to the parent entry	
+	if (EntryId()==iTopMessagePart)
+		return; // Already there.
+
+	User::LeaveIfError(iServerEntry->SetEntry(iServerEntry->Entry().Parent())); 
+
+	iNewEntry = EFalse;
+	
+	// only read and write to store if this is a real email message; headers stored in
+	// the remote mailbox do not require any store information.
+	if (iReceivingHeadersOnly)
+		{
+		RECVLOG(KIgnoringStreams)
+		return;
+		}
+
+	TBool allowAttachmentFlag=ETrue;
+	if(iServerEntry->Entry().iType == KUidMsvFolderEntry)
+		{
+		// Current entry is a folder entry signifying a MIME multipart.
+		// Change context to the parent entry
+		
+		TMsvEmailEntry entry = (TMsvEmailEntry) iServerEntry->Entry();
+		iCurrentMultipartFolderEntryId = EntryId();
+		allowAttachmentFlag = !(entry.MessageFolderType()==EFolderTypeRelated || 
+								entry.MessageFolderType()==EFolderTypeAlternative);
+	
+
+		if (EntryId()!=iTopMessagePart)
+			User::LeaveIfError(iServerEntry->SetEntry(iServerEntry->Entry().Parent())); 
+		}
+
+	TBool childIsAttachment = (iEmailEntry->Attachment() || iEmailEntry->iType == KUidMsvMessageEntry) ? ETrue:EFalse;
+	TBool childIsMHTML=EFalse;
+	// Dont want the flag propogated 'up' past a message entry.
+	if(iEmailEntry->iType != KUidMsvMessageEntry)
+		childIsMHTML = iEmailEntry->MHTMLEmail() ? ETrue:EFalse;
+
+	//Make the parent entry the current entry 
+	if (NULL!=iEmailEntry)
+		{
+		delete iEmailEntry;
+		iEmailEntry=NULL;
+		}
+	iEmailEntry = new (ELeave) TMsvEmailEntry(iServerEntry->Entry());
+
+	if (!iParent->Count())
+		{
+		TParentDetails parentDetails;
+		iParent->InsertL(0,parentDetails);
+		}
+
+	if (! iParent->At(0).iAttachment)
+		{
+		iParent->At(0).iAttachment=(childIsAttachment && allowAttachmentFlag)? ETrue:EFalse;
+
+		// if we aren't allowing attachments because of the folder type
+		// remember there where attachments and check at the end whether
+		// it was an MHTML message or not.
+		if(childIsAttachment && !allowAttachmentFlag)
+			{
+			iRelatedAttachments=ETrue;
+			}
+		}
+	if (!iParent->At(0).iMHTML)
+		iParent->At(0).iMHTML = childIsMHTML ? ETrue:EFalse;
+	iParent->At(0).iSize += iEntryDataSize;
+
+	iOutputHeader->Reset();
+	iEmptyHeaderSize=iOutputHeader->DataSize();
+	iMimeParser->ResetForNewEntry();
+
+	iEntryDataSize=0;
+
+	RECVLOG(KMovedToParentEntry)
+	}
+
+/**
+WritePartialFooterL()
+Helper function to add the partial footer to the email if it exists
+
+@param aAmountLeft
+*/
+void CLocalImRecvConvert::WritePartialFooterL(TInt aAmountLeft)
+	{
+	TMsvId msgId=iBodyId;
+	if (msgId==KMsvNullIndexEntryId)
+		return;
+	TMsvId id = iServerEntry->Entry().Id();
+	if (iServerEntry->SetEntry(msgId)==KErrNone)
+		{
+		TBool storePresent = iServerEntry->HasStoreL();
+		if (storePresent && iPartialEmailFooter->Length()>0 && aAmountLeft>0)
+			{
+			CMsvStore* store = iServerEntry->ReadStoreL();
+			CleanupStack::PushL(store);
+			if (store->HasBodyTextL())
+				{
+				iOutputBody->Reset();
+				store->RestoreBodyTextL(*iOutputBody);
+				CleanupStack::PopAndDestroy(store);
+				HBufC* msg=NULL;
+				if (iPartialEmailFooter->Find(KIntegerKey)!=KErrNotFound)
+					{
+					// display k left on the server, rounded up if between 1 and 1023 bytes
+					TInt kBytesLeft = aAmountLeft / 1024;
+					if(kBytesLeft == 0)
+						kBytesLeft = 1;
+					msg = HBufC::NewLC(iPartialEmailFooter->Length()+KSpaceToAddNumber);
+					msg->Des().Format(*iPartialEmailFooter,kBytesLeft);
+					}
+				else
+					{
+					msg = iPartialEmailFooter->AllocLC();
+					}
+				iOutputBody->AppendParagraphL();
+				TInt length = iOutputBody->DocumentLength();
+				iOutputBody->InsertL(length,*msg);
+				CleanupStack::PopAndDestroy(msg);
+				store=NULL;
+				store = iServerEntry->EditStoreL();
+				CleanupStack::PushL(store);
+				store->StoreBodyTextL(*iOutputBody);
+				store->Commit();
+				CleanupStack::PopAndDestroy(store);
+				}
+			else
+				{
+				CleanupStack::PopAndDestroy(store);
+				}
+			}
+		}
+	iServerEntry->SetEntry(id);
+	}
+
+
+/**
+CreateEntryL()
+*/
+void CLocalImRecvConvert::CreateEntryL()
+	{
+	RECVLOG(KCreatingEntry);
+	if (NULL!=iEmailEntry)
+		{
+		delete iEmailEntry;
+		iEmailEntry=NULL;
+		}
+
+	if (iCurrentMultipartFolderEntryId)
+		{
+		User::LeaveIfError(iServerEntry->SetEntry(iCurrentMultipartFolderEntryId));
+		iCurrentMultipartFolderEntryId=0;
+		}
+		
+	iEmailEntry = new (ELeave) TMsvEmailEntry;
+
+	TValidEntryType previousEntryType = iEntryType;
+	if (!iTopMessagePart || iMIMEPart_822Header)
+		{
+		// At the main header, want to create a message entry.
+		// The stored iEntryType will indicate ( from header info) the next entry to be created.
+		// Save temporarily.
+		// Also applies to the special case where a message contains ony 1 embedded message.
+
+		previousEntryType=iEntryType;
+		iEntryType=EMessageEntry;
+		}
+
+	if ((iPopulateMessage) && (!iTopMessagePart))
+	// If this is the root of a message that is being populated then do not create it.
+		{
+		User::LeaveIfError(iServerEntry->SetEntry(iRootEntryId));
+		*iEmailEntry = iServerEntry->Entry();
+		iTopMessagePart=iRootEntryId;
+
+		// Delete all the children of the message entry.  This is needed because if the
+		// message has been purged, the entries will still exist.  When the message is populated,
+		// new entries are created.  If the original entries are not removed, then duplicate 
+		// entries will exist.
+		CMsvEntrySelection*	children = new(ELeave) CMsvEntrySelection;
+		CleanupStack::PushL(children);
+		User::LeaveIfError(iServerEntry->GetChildren(*children));
+		if (children->Count())
+			iServerEntry->DeleteEntries(*children);
+		CleanupStack::PopAndDestroy(children);
+		}
+	else
+		{
+		iEmailEntry->iMtm=iNewMsgType;
+		iEmailEntry->iServiceId = iEmailServiceId;
+		iEmailEntry->SetComplete(EFalse);
+		iEmailEntry->iSize = 0;
+		iEmailEntry->SetVisible(ETrue);
+		iEmailEntry->SetInPreparation(EFalse);
+		iEmailEntry->SetReceipt(EFalse);
+
+		iEmailEntry->SetVCard(iMimeParser->VCard());
+		iEmailEntry->SetVCalendar(iMimeParser->VCalendar());
+		iEmailEntry->SetMessageFolderType(iMimeParser->MessageFolderType());
+		iEmailEntry->SetPriority(iImPriority);
+		iEmailEntry->SetNew(EFalse);
+
+		if(iOutputHeader->ReceiptAddress().Length()>0)
+			iEmailEntry->SetReceipt(ETrue);
+
+		iEmailEntry->iDate=iTimeDate;
+		switch(iEntryType)
+			{
+			case EMessageEntry:
+				if(!iTopMessagePart)
+					{
+					iEmailEntry->SetUnread(ETrue);
+					iEmailEntry->SetNew(ETrue);
+					iEmailEntry->SetVisible(EFalse);
+					iEmailEntry->SetInPreparation(ETrue);
+					iEmailEntry->SetSendingState(KMsvSendStateNotApplicable);
+					}
+				else
+					{
+					TParentDetails parentDetails;
+					parentDetails.iMHTML=EFalse;
+			        parentDetails.iAttachment=EFalse;
+					parentDetails.iSize=0;
+					iParent->InsertL(0,parentDetails);
+					}
+				iEmailEntry->iType=KUidMsvMessageEntry;
+				iEmailEntry->iDetails.Set(iOutputHeader->From());
+				iEmailEntry->iDescription.Set(iOutputHeader->Subject());
+				break;
+			case EFolderEntry:
+				iEmailEntry->iType=KUidMsvFolderEntry;
+				if (iMimeParser->MessageFolderType()==EFolderTypeUnknown)
+					{
+					// Get folder type of parent (the message)
+					TMsvEmailEntry entry=iServerEntry->Entry();
+					iEmailEntry->SetMessageFolderType(entry.MessageFolderType());
+					}
+				break;
+			case EAttachmentEntry:
+				iEmailEntry->iType=KUidMsvAttachmentEntry;
+				iEmailEntry->iDetails.Set(iAttachmentName);
+				iEmailEntry->iDescription.Set(iMimeParser->ContentDescription());
+				break; 
+			case ETextEntry:
+				if ( iMimeParser->ContentDisposition()!=KImcvAttachment)
+					iEmailEntry->iType=KUidMsvEmailTextEntry;
+				else 
+					{
+					iEmailEntry->iType=KUidMsvAttachmentEntry;
+					iEmailEntry->iDetails.Set(iAttachmentName);
+					iEmailEntry->iDescription.Set(iMimeParser->ContentDescription());
+					}
+				break;
+			case EHtmlEntry:
+				iEmailEntry->iType=KUidMsvEmailHtmlEntry;
+				// If disposition not set or is inline..
+				if ( iMimeParser->ContentDisposition()==KImcvAttachment)
+					iEmailEntry->iType=KUidMsvAttachmentEntry;
+				else
+					iEmailEntry->SetMHTMLEmail(ETrue);
+				iEmailEntry->iDetails.Set(iAttachmentName);
+				iEmailEntry->iDescription.Set(iMimeParser->ContentDescription());
+				break;
+			default:
+				iEmailEntry->iType=KUidMsvAttachmentEntry;
+				iEmailEntry->iDetails.Set(iAttachmentName);
+				iEmailEntry->iDescription.Set(iMimeParser->ContentDescription());
+			}
+
+		User::LeaveIfError(iServerEntry->CreateEntry(*iEmailEntry));
+		User::LeaveIfError(iServerEntry->SetEntry(iEmailEntry->Id()));
+		if(!iTopMessagePart)
+			iTopMessagePart=iEmailEntry->Id();
+
+		//if (iEntryType==EHtmlEntry && iAttachmentFileState!=EFileIsOpen)
+		//	CreateAttachmentL();
+		}
+
+	iEntryType=previousEntryType;
+	iNewEntry = ETrue;
+	RECVLOG(KCreatedEntry);
+	}
+
+
+/**
+Logging()
+
+@param aString1
+@param aString2
+*/
+void CLocalImRecvConvert::Logging(const TDesC8& aString1, const TDesC8& aString2)  
+	{
+	TBuf8<1024> aBuf(aString1);
+
+	aBuf.Append(aString2);
+	RECVLOG(aBuf);
+	}
+
+
+/**
+StoreMessageEntryDetailsL()
+*/
+ void CLocalImRecvConvert::StoreMessageEntryDetailsL()  
+	{
+	iEmailEntry->SetAttachment(iParent->At(0).iAttachment);
+	iEmailEntry->SetMHTMLEmail(iParent->At(0).iMHTML);
+
+	if(iEmailEntry->MHTMLEmail() == EFalse && iEmailEntry->Attachment() == EFalse && iRelatedAttachments !=EFalse)
+		{
+		iEmailEntry->SetAttachment(ETrue);
+		}
+	iRelatedAttachments=EFalse;
+	
+	iEmailEntry->iSize=iParent->At(0).iSize;
+	iEmailEntry->SetMessageFolderType(iParent->At(0).iFolder);
+	StoreEntryDataL();
+
+	if (iParent->Count()>1)
+		{
+		iParent->At(1).iSize+=iEmailEntry->iSize;
+		iParent->Delete(0);
+		}
+	else
+		{
+		iParent->At(0).iAttachment=iParent->At(0).iMHTML=EFalse;
+		iParent->At(0).iSize=0;
+		}
+	}
+
+
+/**
+DeletedAttachmentSize()
+
+@return
+*/ 
+ TInt CLocalImRecvConvert::DeletedAttachmentSize()  
+	{
+	return iSizeOfAttachmentsRemoved;
+	}
+
+/****************************************************************************
+	Class CLocalMimeParser functions
+*****************************************************************************/
+
+/**
+NewLC()
+Static factory constructor. Uses two phase construction 
+and pushes the newly created object into the Cleanup stack.
+
+@param aImRecvConvert
+@return
+*/    
+CLocalMimeParser* CLocalMimeParser::NewLC(CLocalImRecvConvert& aImRecvConvert)  
+	{
+	CLocalMimeParser* self = new (ELeave) CLocalMimeParser(aImRecvConvert);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+
+/**
+NewL()
+Static factory constructor. Uses two phase construction.
+
+@param aImRecvConvert
+@return
+*/
+ CLocalMimeParser* CLocalMimeParser::NewL(CLocalImRecvConvert& aImRecvConvert)  
+	{
+	CLocalMimeParser* self = CLocalMimeParser::NewLC(aImRecvConvert);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+/**
+CLocalMimeParser()
+
+@param aImRecvConvert
+@return
+*/
+CLocalMimeParser::CLocalMimeParser(CLocalImRecvConvert& aImRecvConvert): iImRecvConvert(aImRecvConvert), 
+											iStartId(NULL)
+
+	{
+	__DECLARE_NAME(_S("CLocalMimeParser"));
+	}
+
+
+/**
+ConstructL()
+*/
+void CLocalMimeParser::ConstructL() 
+	{
+	iMimeHeader = CImMimeHeader::NewL();
+	// Create a Desc array to store the boundary strings of a Mime message
+	iBoundaryText = new (ELeave) CDesC8ArrayFlat(3);
+	
+	// Set charset default value
+	iDefaultCharset=iImRecvConvert.CharacterConverter().DefaultCharset();
+	iCharset = iDefaultCharset;
+	ResetMimeFieldsExist();
+
+	Reset();
+	}
+
+
+/**
+~CLocalMimeParser()
+*/
+CLocalMimeParser::~CLocalMimeParser() 
+	{
+	delete iMimeHeader;
+	iMimeHeader=NULL;
+	delete iBoundaryText;
+	iBoundaryText=NULL;
+	delete iMimeHeaderLine;
+	iMimeHeaderLine=NULL;
+	delete iStartId;
+	iStartId=NULL;
+	}
+
+
+/**
+Reset() 
+*/
+void CLocalMimeParser::Reset() 
+	{
+	iBoundaryText->Reset();
+	iBoundaryIndex = 0;
+	iBoundaryLength = 0;
+	isMime = EFalse;
+	
+	ResetForNewEntry();
+	}
+
+
+/**
+ResetForNewEntry()
+*/
+void CLocalMimeParser::ResetForNewEntry()
+	{
+	iMimeHeader->Reset();
+	iEmptyMimeHeaderSize=iMimeHeader->Size();
+		
+	iContentType = EMimeUnknownContent;
+	iContentEncoding = EEncodingTypeNone;
+	iContentDescription.Zero();
+	iVCard = EFalse;
+	iVCalendar = EFalse;
+	iStartPart=EFalse;
+	iMessageFolderType = EFolderTypeUnknown;
+	iTerminatingBoundary = EFalse;
+	iBoundaryFound = EFalse;
+	}
+
+
+/**
+RestoreMimeParserL()
+
+@param entryStore
+*/
+void CLocalMimeParser::RestoreMimeParserL(CMsvStore& entryStore)
+	{
+	iMimeHeader->RestoreL(entryStore);
+	if(iMimeHeader->ContentType().Compare(KImcvText)==0)
+		iContentType=EMimeText; 
+	else
+	if(iMimeHeader->ContentType().Compare(KImcvMessage)==0)
+		iContentType=EMimeMessage;
+	else
+	if(iMimeHeader->ContentType().Compare(KImcvMultipart)==0)
+		iContentType=EMimeMultipart; 
+	else
+	if(iMimeHeader->ContentType().Compare(KImcvImage)==0)
+		iContentType=EMimeImage; 
+	else
+	if(iMimeHeader->ContentType().Compare(KImcvApplication)==0)
+		iContentType=EMimeApplication; 
+	else
+	if(iMimeHeader->ContentType().Compare(KImcvAudio)==0)
+		iContentType=EMimeAudio; 
+	else
+	if(iMimeHeader->ContentType().Compare(KImcvVideo)==0)
+		iContentType=EMimeVideo; 
+	else
+		iContentType=EMimeUnknownContent; 
+
+	}
+
+
+/**
+ParseLineL()
+
+@param aSourceLine
+*/
+void CLocalMimeParser::ParseLineL(const TDesC8& aSourceLine)
+	{
+	if(iMimeHeaderLine==NULL)
+		{
+		iMimeHeaderLine = HBufC8::NewL(aSourceLine.Length());
+		*iMimeHeaderLine = aSourceLine;
+		}
+	
+	iLex = *iMimeHeaderLine;
+
+	// find out whether the current line has anything to do with currently understood MIME Content tokens
+	if(!iMimeHeaderLine->MatchF(KImcvMime) || !iMimeHeaderLine->MatchF(KImcvContent))
+		{ 
+		if(MatchAndRemoveToken(KImcvMimePrompt))
+			DoMimeVersion();
+		else if(MatchAndRemoveToken(KImcvContentType))
+			DoContentTypeL();
+		else if(MatchAndRemoveToken(KImcvContentLocation))
+			DoContentLocationL();
+		else if(MatchAndRemoveToken(KImcvContentTransferEncoding))
+			DoEncodingL();
+		else if(MatchAndRemoveToken(KImcvContentId))
+			{
+			RemoveSurroundingCharacters(KImcvLeftChevron, KImcvRightChevron, *iMimeHeaderLine);
+			DoContentIdL();
+			}
+		else if(MatchAndRemoveToken(KImcvContentDescription))
+			DoDescriptionL();
+		else if(MatchAndRemoveToken(KImcvContentDisposition))
+			DoDispositionL();
+		else if(MatchAndRemoveToken(KImcvContentBase))
+			DoContentBaseL();
+		}
+		
+	delete iMimeHeaderLine;	// clean up and null pointer iff CompleteMimeHeader and no foldover append req'd
+	iMimeHeaderLine=NULL;
+	}
+
+
+/**
+DoMimeVersion()
+*/
+void CLocalMimeParser::DoMimeVersion()
+	{
+	// extract the MIME version from a header line which we already know
+	// has 'MIME-Version' start of it.
+	if(MatchAndRemoveToken(KImcvMimeVersion))
+		iCorrectMimeVersion = ETrue;
+	}
+
+
+/**
+DoContentIdL()
+*/
+void CLocalMimeParser::DoContentIdL()
+	{
+	iMimeHeader->SetContentIDL(iMimeHeaderLine->Des());
+	if(iStartId && iStartId->CompareF(iMimeHeaderLine->Des())==KErrNone)
+		iStartPart=ETrue;
+	}
+
+
+/**
+DoContentLocationL()
+*/
+void CLocalMimeParser::DoContentLocationL()
+	{
+	TInt len = (*iMimeHeaderLine).Length();
+	if (len == 0)
+		return;
+			
+	RemoveSurroundingCharacters(KImcvQuote, KImcvQuote, *iMimeHeaderLine);
+
+	HBufC16* locationBuf = HBufC16::NewL( len );
+	CleanupStack::PushL(locationBuf);
+	TPtr locationPtr(locationBuf->Des());
+	iImRecvConvert.iHeaderConverter->DecodeHeaderFieldL( iMimeHeaderLine->Des(), locationPtr);
+	iMimeHeader->SetContentLocationL(locationPtr);
+	CleanupStack::PopAndDestroy(); // locationBuf
+	}
+
+
+/**
+DoContentBaseL()
+*/
+void CLocalMimeParser::DoContentBaseL()
+	{
+	RemoveSurroundingCharacters(KImcvQuote, KImcvQuote, *iMimeHeaderLine);
+	iMimeHeader->SetContentBaseL(iMimeHeaderLine->Des());
+	}
+
+
+/**
+DoAttachmentTypeL()
+*/
+void CLocalMimeParser::DoAttachmentTypeL()
+	{
+	iImRecvConvert.iEntryType = CLocalImRecvConvert::EAttachmentEntry;
+	iImRecvConvert.iCurrentPartIsRichText = EFalse;	
+
+	if(MatchAndRemoveToken(KImcvForwardSlash))
+		{
+		if(MatchAndRemoveToken(KImcvBmp))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvBmp);
+			}
+		else
+		if(MatchAndRemoveToken(KImcvGif))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvGif);
+			}
+		else
+		if(MatchAndRemoveToken(KImcvJpeg))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvJpeg);
+			}
+		else
+		if(MatchAndRemoveToken(KImcvTiff))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvTiff);
+			}
+		else
+		if(MatchAndRemoveToken(KImcvWav))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvWav);
+			}
+		else
+		if(MatchAndRemoveToken(KImcvZip))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvZip);
+			}
+		else
+		if(MatchAndRemoveToken(KImcvOctetStream))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvOctetStream);
+			}
+		else
+		if(MatchAndRemoveToken(KImcvExe))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvExe);
+			}
+		else
+		if(MatchAndRemoveToken(KImcvCmd))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvCmd);
+			}
+		else
+		if(MatchAndRemoveToken(KTImcvDrm))
+			{ // added this to handle DRM files
+			iMimeHeader->SetContentSubTypeL(KTImcvDrm);
+			}
+		}
+	}
+
+
+/**
+DoMessageTypeL()
+*/
+void CLocalMimeParser::DoMessageTypeL()
+	{
+	iImRecvConvert.iEntryType = CLocalImRecvConvert::EMessageEntry;
+	iImRecvConvert.iEmailPart = CLocalImRecvConvert::KParentPart;
+	
+	iContentType=EMimeMessage; 
+	iMimeHeader->SetContentTypeL(KImcvMessage);
+
+	if(MatchAndRemoveToken(KImcvForwardSlash))
+		{
+		if(MatchAndRemoveToken(KImcvRfc822))
+			{
+			//iMessageFolderType=EFolderTypeRFC822;
+			iMimeHeader->SetContentSubTypeL(KImcvRfc822);
+			}
+		else if(MatchAndRemoveToken(KImcvExternal))
+			{
+			iMessageFolderType=EFolderTypeExternal;
+			iMimeHeader->SetContentSubTypeL(KImcvExternal);
+			}
+		else if(MatchAndRemoveToken(KImcvPartial))
+			{
+			iMessageFolderType=EFolderTypePartial;
+			iMimeHeader->SetContentSubTypeL(KImcvPartial);
+			}
+		else if(MatchAndRemoveToken(KImcvDeliveryStatus))
+			{
+			// We do not process this part. So store as text.
+			iMimeHeader->SetContentSubTypeL(KImcvDeliveryStatus);
+			iImRecvConvert.iEntryType = CLocalImRecvConvert::EAttachmentEntry;
+			iImRecvConvert.iEmailPart = CLocalImRecvConvert::KNoPart;
+			iContentType=EMimeUnknownContent; 
+			iImRecvConvert.iCurrentPartIsRichText=EFalse;
+			iImRecvConvert.iAttachmentName.Copy(KImcvDeliveryStatus);
+			iImRecvConvert.iAttachmentName.Append(KTextExtension);
+			}
+		else
+			{
+			iMessageFolderType=EFolderTypeUnknown;
+			iMimeHeader->SetContentSubTypeL(KImcvUnknown);
+			}
+		}	
+	}
+
+
+/**
+DoMultipartTypeForNonMIMEL()
+*/
+void CLocalMimeParser::DoMultipartTypeForNonMIMEL()
+	{
+	ResetForNewEntry();
+	iMessageFolderType=EFolderTypeMixed;
+	iMimeHeader->SetContentTypeL(KImcvMultipart);
+	iMimeHeader->SetContentSubTypeL(KImcvMixed);
+	}
+
+
+/**
+DoMultipartTypeL()
+*/
+void CLocalMimeParser::DoMultipartTypeL()
+	{
+	iImRecvConvert.iEntryType = CLocalImRecvConvert::EFolderEntry;
+	iImRecvConvert.iEmailPart = CLocalImRecvConvert::KMultiPart;
+	
+	iContentType=EMimeMultipart;
+	iMimeHeader->SetContentTypeL(KImcvMultipart);
+
+	if(MatchAndRemoveToken(KImcvForwardSlash))
+		{
+		if(MatchAndRemoveToken(KImcvMixed))
+			{
+			iMessageFolderType=EFolderTypeMixed;
+			iMimeHeader->SetContentSubTypeL(KImcvMixed);
+			}
+		else if(MatchAndRemoveToken(KImcvRelated))
+			{
+			iMessageFolderType=EFolderTypeRelated;
+			iMimeHeader->SetContentSubTypeL(KImcvRelated);
+			}
+		else if(MatchAndRemoveToken(KImcvAlternative))
+			{
+			iMessageFolderType=EFolderTypeAlternative;
+			iMimeHeader->SetContentSubTypeL(KImcvAlternative);
+			}
+		else if(MatchAndRemoveToken(KImcvEncrypted))
+			{
+//	Add this when Encryption is handled iMessageFolderType=EFolderTypeEncrypted;
+			iMimeHeader->SetContentSubTypeL(KImcvEncrypted);
+			}
+		else if(MatchAndRemoveToken(KImcvParallel))
+			{
+			iMessageFolderType=EFolderTypeParallel;
+			iMimeHeader->SetContentSubTypeL(KImcvParallel);
+			}
+		else if(MatchAndRemoveToken(KImcvDigest))
+			{
+			iMessageFolderType=EFolderTypeDigest;
+			iMimeHeader->SetContentSubTypeL(KImcvDigest);
+			isMessageDigest=ETrue;
+			}
+		else if(MatchAndRemoveToken(KImcvSigned))
+			{
+//	Add this when Signed is handled	iMessageFolderType=EFolderTypeSigned;
+			iMimeHeader->SetContentSubTypeL(KImcvSigned);
+			}
+		else if(MatchAndRemoveToken(KImcvReport))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvReport);
+			}
+		else
+			{
+			iMessageFolderType=EFolderTypeUnknown;
+			iMimeHeader->SetContentSubTypeL(KImcvUnknown);
+			}
+		}
+
+	if (iMessageFolderType==EFolderTypeRelated)
+		iImRecvConvert.iParent->At(0).iFolder=iMessageFolderType; 
+
+	// Find any parameters specific to a Multipart content type	
+
+	HBufC8* paramValue = NULL;
+
+	// Extracts the boundary string
+
+	ExtractParameterInfoL(KImcvBoundary, paramValue);
+	if( paramValue!=NULL ) 
+		{
+		CleanupStack::PushL(paramValue);
+		iBoundaryFound = ETrue;
+		iImRecvConvert.iEmailPart = CLocalImRecvConvert::KMultiPart;
+		SetBoundaryL(*paramValue);
+		CleanupStack::PopAndDestroy(paramValue);
+		}
+
+	// Extracts start ID if it has been defined;
+
+	ExtractParameterInfoL(KImcvStartPart, paramValue);
+	if( paramValue!=NULL )
+		{
+		delete iStartId;
+		iStartId=NULL;
+		iStartId = paramValue;
+		}
+	}
+
+
+/**
+DoTextTypeL()
+*/
+void CLocalMimeParser::DoTextTypeL()
+	{
+	HBufC8* paramValue = NULL;
+	
+	iImRecvConvert.iEntryType = CLocalImRecvConvert::ETextEntry;
+	iContentType=EMimeText;		
+	iMimeHeader->SetContentTypeL(KImcvText);
+
+	if(MatchAndRemoveToken(KImcvForwardSlash))
+		{
+		if(MatchAndRemoveToken(KImcvPlain))
+			iMimeHeader->SetContentSubTypeL(KImcvPlain);
+		else
+		if(MatchAndRemoveToken(KImcvHtml))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvHtml);
+			iImRecvConvert.iEntryType = CLocalImRecvConvert::EHtmlEntry;
+			iImRecvConvert.iCurrentPartIsRichText = EFalse;	
+			}
+		else
+		if(MatchAndRemoveToken(KImcvDirectory))
+			{
+			iMimeHeader->SetContentSubTypeL(KImcvDirectory);
+			iMimeHeader->ContentTypeParams().AppendL(KImcvProfile);
+			ExtractParameterInfoL(KImcvProfile, paramValue);
+			// Assume at right context, the email message, not attachment.
+			
+			iMessageFolderType=EFolderTypeDirectory;
+			if( paramValue!=NULL )
+				{
+				CleanupStack::PushL(paramValue);
+				iMimeHeader->ContentTypeParams().AppendL(*paramValue);
+				if(paramValue->MatchF(KImcvVCard) == 0)
+					{
+					iVCard=ETrue;
+					}
+				CleanupStack::PopAndDestroy(paramValue);
+				}
+			}
+		if(MatchAndRemoveToken(KImcvVCalender))
+			iVCalendar=ETrue;
+
+		// Extract the charset value, 
+
+		ExtractParameterInfoL(KImcvCharset, paramValue);
+
+		if(paramValue!=NULL)
+			{
+			CleanupStack::PushL(paramValue);
+			// check if at top level header or Mime part header
+
+			TUint charsetUid = iImRecvConvert.CharacterConverter().GetMimeCharsetUidL(*paramValue); 
+			if(iImRecvConvert.NotFinishedRfc822Header() == EFalse)
+				iCharset=charsetUid;
+
+			// Store in CMimeHeader::iContentTypeParams
+			iMimeHeader->ContentTypeParams().AppendL(KImcvCharset);
+			iMimeHeader->ContentTypeParams().AppendL(*paramValue);
+			CleanupStack::PopAndDestroy(paramValue);
+
+			if (!iImRecvConvert.CharacterConverter().PrepareToConvertToFromOurCharsetL(charsetUid))
+				charsetUid=KUidMsvCharsetNone;
+			iMimeHeader->SetMimeCharset(charsetUid);
+			}
+		else
+			iMimeHeader->SetMimeCharset(iDefaultCharset);
+		}
+	}
+
+
+/**
+DoContentTypeL()
+*/
+void CLocalMimeParser::DoContentTypeL()
+	{
+	RemoveSurroundingCharacters(KImcvLeftChevron, KImcvRightChevron, *iMimeHeaderLine);
+
+	if(MatchAndRemoveToken(KImcvText))
+		DoTextTypeL();
+	else
+	if(MatchAndRemoveToken(KImcvMultipart))
+		DoMultipartTypeL();
+	else
+	if(MatchAndRemoveToken(KImcvMessage))
+		DoMessageTypeL();
+	else
+	if(MatchAndRemoveToken(KImcvImage))
+		{	
+		iContentType=EMimeImage; 
+		iMimeHeader->SetContentTypeL(KImcvImage);
+		DoAttachmentTypeL();
+		}
+	else
+	if(MatchAndRemoveToken(KImcvApplication))
+		{
+		iContentType=EMimeApplication; 
+		iMimeHeader->SetContentTypeL(KImcvApplication);
+		DoAttachmentTypeL();
+		}
+	else
+	if(MatchAndRemoveToken(KImcvAudio))
+		{
+		iContentType=EMimeAudio; 
+		iMimeHeader->SetContentTypeL(KImcvAudio);
+		DoAttachmentTypeL();
+		}
+	else
+	if(MatchAndRemoveToken(KImcvVideo))
+		{
+		iContentType=EMimeVideo; 
+		iMimeHeader->SetContentTypeL(KImcvVideo);
+		DoAttachmentTypeL();
+		}
+	else
+		{
+		iContentType=EMimeUnknownContent; 
+		iMimeHeader->SetContentTypeL(KImcvUnknown);
+		}
+
+	// Extract the filename if it exists
+	HBufC* paramStore = HBufC::NewLC(MaxMimeParameterValueLength);
+	HBufC8* paramStore8 = HBufC8::NewLC(KMimeEncodedParameterSize);
+	TPtr paramValue(paramStore->Des());
+	TPtr8 paramValue8(paramStore8->Des());
+
+	ExtractParameterInfoL(KImcvMimeTypeName, paramValue,paramValue8);
+	if(paramValue.Length())
+		{
+		iMimeHeader->ContentTypeParams().AppendL(KImcvMimeTypeName);
+		iMimeHeader->ContentTypeParams().AppendL(paramValue8);
+		iImRecvConvert.SetAttachmentName(paramValue);
+		}
+	
+	CleanupStack::PopAndDestroy(2,paramStore); 
+	}
+
+
+/**
+DoEncodingL()
+*/
+void CLocalMimeParser::DoEncodingL()
+	{
+	iMimeHeader->SetContentTransferEncodingL(*iMimeHeaderLine);
+
+	switch ((*iMimeHeaderLine)[0])
+		{
+		case '7': // 7bit
+			iContentEncoding = EEncodingType7Bit;
+			break;
+		case '8': // 8bit
+			iContentEncoding = EEncodingType8Bit;
+			break;
+		case 'q': // quoted-printable
+		case 'Q': 
+			iContentEncoding = EEncodingTypeQP;
+			break;
+		case 'b': // binary or base64
+		case 'B':
+			iContentEncoding = ((*iMimeHeaderLine)[1] == 'i' || (*iMimeHeaderLine)[1] == 'I' ? EEncodingTypeBinary : EEncodingTypeBASE64);
+			break;
+		case 'x': //in order to support UU encoded within a MIME message
+		case 'X':
+			iContentEncoding = ((*iMimeHeaderLine).FindF(KImcvXUUString)==KErrNotFound ? EEncodingTypeUnknown : EEncodingTypeUU);
+			break;
+		default:
+			iContentEncoding = EEncodingTypeUnknown;
+			break;
+		}
+	}
+
+
+/**
+DoDescriptionL()
+*/
+void CLocalMimeParser::DoDescriptionL()
+	{
+	TPtrC8 marked(iMimeHeaderLine->Des());
+	if (marked.Length()>KMaxFileName)
+		marked.Set(marked.Left(KMaxFileName));
+
+	iContentDescription.Copy(marked);
+
+	// remove the CRLF
+
+	TInt length = iContentDescription.Length();
+	if (length>2)
+		{
+		if (iContentDescription[length-2]==KImcvCR && iContentDescription[length-1]==KImcvLF)
+			iContentDescription.SetLength(length-2);
+		}
+	iMimeHeader->SetContentDescriptionL(marked);
+	}
+
+
+/**
+DoDispositionL()
+*/
+void CLocalMimeParser::DoDispositionL()
+	{
+	TBool inLine = EFalse;
+	if(MatchAndRemoveToken(KImcvAttachment))
+		{
+		iMimeHeader->SetContentDispositionL(KImcvAttachment);
+		if (iMimeHeader->ContentSubType()!=KImcvRfc822)
+			{
+			iImRecvConvert.iCurrentPartIsRichText = EFalse;	
+			}
+		if (iImRecvConvert.iEntryType!=CLocalImRecvConvert::EMessageEntry)
+			{
+			iImRecvConvert.iEntryType = CLocalImRecvConvert::EAttachmentEntry;
+			}
+		}
+	else if(MatchAndRemoveToken(KImcvInline))
+		inLine = ETrue;
+
+	// Extract the filename if it exists, unless we already have a name for it	
+	if(!iImRecvConvert.iAttachmentName.Length())
+		{
+		HBufC* paramStore = HBufC::NewLC(KHeaderBufferLength);
+		TPtr paramValue(paramStore->Des());
+		HBufC8* paramStore8 = HBufC8::NewLC(KMimeEncodedParameterSize);
+		TPtr8 paramValue8(paramStore8->Des());
+
+		ExtractParameterInfoL(KImcvMimeDispositionFilename, paramValue,paramValue8);
+		if(paramValue.Length())
+			{
+			iMimeHeader->ContentTypeParams().AppendL(KImcvMimeDispositionFilename);
+			iMimeHeader->ContentTypeParams().AppendL(paramValue8);
+			iImRecvConvert.SetAttachmentName(paramValue);
+			}
+
+		CleanupStack::PopAndDestroy(2,paramStore); // paramStore, paramStore8
+		}
+
+		if(inLine)
+ 		{
+ 		// Content Disposition set to inline
+ 		if (iImRecvConvert.iAttachmentName.Length())
+ 			// filename exists
+ 			{
+ 			iMimeHeader->SetContentDispositionL(KImcvAttachment);
+ 			iImRecvConvert.iCurrentPartIsRichText = EFalse;	
+			if (iImRecvConvert.iEntryType!=CLocalImRecvConvert::EMessageEntry)
+ 				{
+ 				iImRecvConvert.iEntryType = CLocalImRecvConvert::EAttachmentEntry;
+ 				}
+ 			}
+ 		else
+ 			iMimeHeader->SetContentDispositionL(KImcvInline);
+ 		}
+	}
+
+
+/**
+ContentSubType()
+
+@return
+*/  
+TPtrC8 CLocalMimeParser::ContentSubType() const  
+	{
+	return iMimeHeader->ContentSubType();;
+	}
+
+
+/**
+VCard()
+
+@return
+*/  
+TBool CLocalMimeParser::VCard() const  
+	{
+	return iVCard;
+	}
+
+
+/**
+VCalendar()
+
+@return
+*/  
+TBool CLocalMimeParser::VCalendar() const  	
+	{
+	return iVCalendar;
+	}
+
+
+/**
+StartPart()
+
+@return
+*/  
+TBool CLocalMimeParser::StartPart() const  
+	{
+	return iStartPart;
+	}
+
+
+/**
+MessageFolderType()
+
+@return
+*/  
+TImEmailFolderType CLocalMimeParser::MessageFolderType() const  
+	{
+	return iMessageFolderType;
+	}
+
+
+/**
+SetMessageFolderType()
+
+@param aFolderType
+*/  
+void CLocalMimeParser::SetMessageFolderType(TImEmailFolderType aFolderType)  
+	{
+	iMessageFolderType=aFolderType;
+	}
+
+
+/**
+SetBoundaryL()
+
+@param aBoundaryText
+*/  
+void CLocalMimeParser::SetBoundaryL(const TDesC8& aBoundaryText)  
+	{
+	TBuf8<KMaxBoundaryTextLength+2> tempBoundary(KImcvMimeBoundaryStartEnd);
+	// From RFC 1521, (Boundaries) must be no longer than 70 characters.
+	// Including beginning and end "--" 
+	if (aBoundaryText.Length()>70)
+		tempBoundary.Append(aBoundaryText.Left(70));
+	else
+		tempBoundary.Append(aBoundaryText);
+	iBoundaryText->AppendL(tempBoundary);
+
+	iBoundaryIndex = iBoundaryText->MdcaCount(); //iBoundaryIndex stores a count value not the index here
+	iBoundaryIndex = (iBoundaryIndex)? --iBoundaryIndex: 0;
+	iBoundaryLength = iBoundaryText->MdcaPoint(iBoundaryIndex).Length();
+	}
+
+
+/**
+IsBoundary()
+
+@param aSourceLine
+ @return
+*/
+TBool CLocalMimeParser::IsBoundary(const TDesC8& aSourceLine)
+	{
+	if(iBoundaryText->MdcaCount())
+		{
+		TInt found = 0;
+		TInt aLineLength = aSourceLine.Length();
+		TInt compareLength = aLineLength > iBoundaryLength ? iBoundaryLength : aLineLength;
+		TPtrC8 tempSourceLine(aSourceLine.Ptr(), compareLength);
+	
+		TInt error = iBoundaryText->Find(tempSourceLine, found, ECmpNormal);
+
+		if(error||(!iBoundaryLength))
+			return KBoundaryNotFound;
+	
+		// The following code is executed only if aSourceLine is a boundary
+		if(found != iBoundaryIndex)
+			{
+			iReceiveError = (iReceiveError)? iReceiveError: KBoundaryError;
+			iBoundaryIndex = found;
+			iBoundaryText->Delete(found++);
+			}
+	
+		if(aLineLength >= iBoundaryLength+4) // allow for CRLF & then check for the double hyphen
+			{
+			if((aSourceLine[iBoundaryLength] == KImcvHyphen) && (aSourceLine[iBoundaryLength+1] == KImcvHyphen))
+				iTerminatingBoundary = ETrue; // this is a terminating boundary
+			}
+		else
+			iTerminatingBoundary = EFalse;
+	
+		return KBoundaryFound;
+		}
+	
+	return KBoundaryNotFound;
+	}
+
+
+/**
+RemoveBoundary()
+*/
+void CLocalMimeParser::RemoveBoundary()
+	{
+	iBoundaryText->Delete(iBoundaryIndex);
+	if(iBoundaryText->MdcaCount())
+		{
+		iBoundaryIndex = iBoundaryText->MdcaCount(); //iBoundaryIndex stores a count value not the index here
+	
+		iBoundaryIndex = (iBoundaryIndex)? --iBoundaryIndex: 0;
+		iBoundaryLength = iBoundaryText->MdcaPoint(iBoundaryIndex).Length();
+		}
+	}
+
+
+/**
+MatchAndRemoveToken()
+
+@param aToken
+@return
+*/
+TBool CLocalMimeParser::MatchAndRemoveToken( const TDesC8& aToken )
+	{
+	TInt comparison;
+	TInt tokenLength = aToken.Length();
+	TInt desLength = (*iMimeHeaderLine).Length();
+	TInt compareLength = tokenLength > desLength ? desLength : tokenLength;
+	TPtrC8 left((*iMimeHeaderLine).Left(compareLength));
+	
+	// now see whether the current line contains the search string
+	comparison = left.CompareF(aToken);
+	if (!comparison)
+		{
+		// found the match string at the start of the output line, so remove it
+		iMimeFieldsExist=ETrue;
+		isMime=ETrue;
+		// get rid of any whitespace betweebn the tag and the data while we have a chance
+		TInt whitespaceLength=0;
+		TInt maxLength=desLength-tokenLength;
+		const TUint8* ptr = (*iMimeHeaderLine).Ptr();
+		while ( whitespaceLength <= maxLength && (ptr[tokenLength+whitespaceLength] == KImcvSP || ptr[tokenLength+whitespaceLength] == KImcvTab) )
+			whitespaceLength++;
+		iMimeHeaderLine->Des().Delete(0, tokenLength+whitespaceLength);
+
+		// Reset iLex, so its length is updated.
+		iLex = *iMimeHeaderLine;
+		}
+	return (comparison==0);
+	}
+
+
+/**
+IsSpecialChar()
+
+@param aChar
+@return
+*/
+TBool CLocalMimeParser::IsSpecialChar( const TUint8 aChar )
+	{
+	return (aChar == '(' || aChar == ')' || aChar == '<' || aChar == '>' || aChar == '@' 
+		 || aChar == ',' || aChar == ';' || aChar == ':' || aChar == '\\'|| aChar == '"' 
+		 || aChar == '/' || aChar == '[' || aChar == ']' || aChar == '?' || aChar == '=');
+	}
+
+
+/**
+ExtractParameterInfoL()
+Implicitly the parameter ASSUMED TO BE is not encoded as return parameter, rBuffer,
+is 8 bit. iLex should currently be pointing at the space after content-type description.
+
+@param aTag
+@param rBuffer
+*/
+void CLocalMimeParser::ExtractParameterInfoL(const TDesC8& aTag, HBufC8*& rBuffer)
+	{	
+	rBuffer = NULL;
+
+	TLexMark8 mark;
+	TInt offset;
+
+	if( (offset=iLex.Remainder().FindF(aTag)) != KErrNotFound )
+		{
+		// move past the tag	
+		iLex.Inc(offset+aTag.Length());
+
+		// Default : no charset info or folding
+		// move forward to the start of the boundary string itself.
+
+		while (iLex.Peek() != KImcvEquals  && !iLex.Eos())
+			iLex.Inc(); 
+
+		TPtrC8 paramBuffer(ExtractParameterString(mark));
+		if( paramBuffer.Length() > 0 )
+			{
+			rBuffer = paramBuffer.AllocL();
+			}
+		}
+	}
+
+
+/**
+ExtractParameterInfoL()
+iLex should currently be pointing at the space after content-type description.
+
+@param aTag
+@param rBuffer
+@param rBuffer8
+*/
+void CLocalMimeParser::ExtractParameterInfoL(const TDesC8& aTag, TDes16& rBuffer, TDes8& rBuffer8)
+	{
+	TInt offset;
+
+	rBuffer.Copy(KNullDesC);
+
+	// we need to extract the <aTag> text from the same line
+	// iLex should currently be pointing at the space after content-type description
+
+	if( (offset=iLex.Remainder().FindF(aTag))!=KErrNotFound )
+		{
+		// Check which type of encoding present.
+
+		TLexMark8 initMark;
+		iLex.Mark(initMark);
+		TLexMark8 mark;
+		iLex.Inc(offset+aTag.Length()); 	// move past the tag
+
+		const TPtrC8 param = ExtractParameterString(mark);
+
+		rBuffer8.Copy(param);
+
+		if ( ParseRfc2047ParameterInfoL(param, rBuffer) == EFalse )
+			{
+			iLex.UnGetToMark(initMark);
+			ParseRfc2231ParameterInfoL(aTag, rBuffer, offset );
+			}
+		}
+	}
+
+
+/**
+ParseRfc2047ParameterInfoL()
+Detect encoding of form =?charset?Q?" Text "?=
+
+@param aParam
+@param rBuffer
+@return
+*/
+TBool CLocalMimeParser::ParseRfc2047ParameterInfoL(const TDesC8& aParam, TDes& rBuffer)
+	{
+	TBool parameterPresent = EFalse;
+
+	// Check for =? somewhere in text.
+
+	if ( aParam.Find(KImcvEncodedWordStart) != KErrNotFound )
+		{
+		// Make assumption that '=?' appearing in parameter means 
+		//it is part of encoding
+	
+		parameterPresent = ETrue;
+		iImRecvConvert.iHeaderConverter->DecodeHeaderFieldL(aParam, rBuffer);
+		}
+	return parameterPresent;
+	}
+
+
+/**
+ParseRfc2231ParameterInfoL()
+For extracting parameter data following Mime header fields, in the format
+*(;tag=data). As specified in rfc2231
+Assumes parameter data seperated by ';'
+Takes tag(name) of parameter as input, returning a descriptor with the data
+
+@param aTag
+@param rBuffer
+@param aOffset
+@return
+*/
+TBool CLocalMimeParser::ParseRfc2231ParameterInfoL(const TDesC8& aTag, TDes& rBuffer, TInt aOffset)
+	{
+	TBool parameterPresent = ETrue;
+
+	// For storing extracted parameter information
+
+	HBufC8* info = HBufC8::NewLC(KHeaderBufferLength);
+
+	// For storing information relating to parameter extraction/conversion
+
+	TInt count = 0;
+
+	TPtrC8 charset8;
+	TPtrC8 language8;
+	
+	// Following rfc 2231, parameter may be encoded & folded in the following way
+	//
+	// <name>*0*=us-ascii'en'<encoded data>
+	// <name>*1*=< more encoded data>
+	// <name>*2=<unencoded info>
+
+	do 
+		{
+		// move past the tag	
+		iLex.Inc(aOffset+aTag.Length());
+
+		if (iLex.Peek() != KImcvAny) 
+			{
+			// Default : no charset info or folding
+			// move forward to the start of the boundary string itself
+
+			while (iLex.Peek() != KImcvEquals  && !iLex.Eos())
+				iLex.Inc();
+			}
+		else	// *, Parameter is encoded
+			{
+			iLex.Inc(); // Past '*'
+
+			// If parameter folded :- need to get several bits of data and join together.
+		
+			if ( iLex.Peek()!=KImcvEquals) // Get Number
+				{
+				iLex.Mark(); // Beginnig of number
+				iLex.Inc();
+				while (iLex.Peek() != KImcvEquals && iLex.Peek() != KImcvAny && !iLex.Eos())
+					iLex.Inc(); 
+				TPtrC8 numPtr = iLex.MarkedToken();
+				TLex8 lex(numPtr);
+				lex.Val(count);  // Store number in count.
+
+				if (iLex.Peek() == KImcvAny)
+					iLex.Inc(); // Past *
+				}
+
+
+			// Must get charset & language information etc..
+
+			if (!count)
+				{
+
+				iLex.Inc(); // Past '='
+
+				if (iLex.Peek()==KImcvQuote)
+					iLex.Inc(); 
+
+				// Extract CHARSET token
+				iLex.Mark();
+				while (iLex.Peek() != KImcvSingleQuote && !iLex.Eos())
+					iLex.Inc(); 
+				TPtrC8 marked = iLex.MarkedToken();
+
+				charset8.Set(marked );
+				iLex.Inc(); // Past ' 
+
+				// Extract LANGUAGE token
+				iLex.Mark();
+				while (iLex.Peek() != KImcvSingleQuote && !iLex.Eos())
+					iLex.Inc(); 
+				TPtrC8 marked1 = iLex.MarkedToken();
+				language8.Set(marked1);
+				}
+
+			} // else, param encoded
+				
+		TLexMark8 mark;
+		TPtrC8 param = ExtractParameterString(mark);
+
+		// Save parameter data
+		TInt maxlen=info->Des().MaxLength();
+		if ((*info).Length() + param.Length() > maxlen )
+			{
+			info = info->ReAllocL(maxlen + param.Length() + MaxMimeParameterValueLength);
+		 CleanupStack::Pop();
+			CleanupStack::PushL(info); 
+			}
+		info->Des().Append( param );
+
+
+		} while( ( aOffset=iLex.Remainder().FindF(aTag))!=KErrNotFound );
+
+	TPtr8 infoPtr(info->Des());	
+	
+	DecodeRfc2231ParameterInfoL( infoPtr, rBuffer, charset8/*, language8*/ );
+
+	CleanupStack::PopAndDestroy(info); 
+	return parameterPresent;
+	}
+
+
+/**
+DecodeRfc2231ParameterInfoL()
+
+@param aInput
+@param rBufOut
+@param aCharset
+@return
+*/
+TBool CLocalMimeParser::DecodeRfc2231ParameterInfoL(TDes8& aInput, TDes& rBufOut, TPtrC8 aCharset/*, TPtrC8 aLanguage*/)
+	{
+	HBufC8* QPdecodedbuf = HBufC8::NewLC( aInput.Length() );
+	TPtr8 ptr(QPdecodedbuf->Des());
+
+	iImRecvConvert.iQPCodec.SetQPChar(KImcvPercentSign);
+	iImRecvConvert.iQPCodec.Decode( aInput, ptr);
+	iImRecvConvert.iQPCodec.SetQPChar(KImcvEquals);
+
+	// Convert parameter, based on charset supplied.
+	CImConvertCharconv& charconv = iImRecvConvert.CharacterConverter();
+	TUint id = charconv.GetMimeCharsetUidL( aCharset);
+
+	if(id==KUidMsvCharsetNone)
+		{
+		id=charconv.SystemDefaultCharset();
+		}
+
+	if (!charconv.PrepareToConvertToFromOurCharsetL(id))
+		{
+		rBufOut.Copy(ptr);
+		}
+	else
+		{
+		// Charset found, so do conversion
+		TInt unconverted;
+		TInt indexOfFirst;
+		TInt rem = charconv.ConvertToOurCharsetL(ptr, rBufOut, unconverted, indexOfFirst);
+		if (rem < 0) // error
+			Append(rBufOut, ptr);
+		else if (rem && rem < KConversionRemainderLength)
+			rBufOut.Copy(ptr);	
+
+		}
+	
+	CleanupStack::PopAndDestroy(QPdecodedbuf);
+	return ETrue;
+	}
+
+
+/**
+ExtractParameterString()
+Check for delimiter & mark parameter text string
+
+@param rMark
+@return
+*/
+TPtrC8 CLocalMimeParser::ExtractParameterString(TLexMark8& rMark)
+	{
+	// move on to the first char of the boundary ; this MIGHT be a double-quote
+
+	TBool delimited = EFalse;
+	iLex.Inc();
+				
+	if ( iLex.Peek() == KImcvDoubleQuote )
+		{
+		delimited = ETrue;
+		iLex.Inc();
+		}
+
+	while ( iLex.Peek().IsSpace() )
+		iLex.Inc();
+
+	iLex.Mark( rMark );
+
+	TBool finished = EFalse;
+	while ( !finished  && !iLex.Eos() )
+		{
+		iLex.Inc();
+
+		if ( delimited )
+			finished = (iLex.Peek() == KImcvDoubleQuote);
+		else
+			finished = ( iLex.Peek().IsSpace() || IsSpecialChar((TUint8)iLex.Peek()) );
+		} 
+
+	return iLex.MarkedToken( rMark );
+	}
+
+
+/**
+CurrentCharsetL()
+Which charset to use .. ? If the body part charset set, use that.
+else if the main header charset set, use that... else default to us-ascii.
+
+@return
+*/
+TUint CLocalMimeParser::CurrentCharsetL() const
+	{
+	TPtrC8 paramCharset = GetContentTypeValue(KImcvCharset);
+
+	TUint charsetId;
+	if (paramCharset.Length())
+		// charset parameter present.
+		charsetId = iImRecvConvert.CharacterConverter().GetMimeCharsetUidL(paramCharset);
+	else if (iCharset) 
+		// Main Mime header has default charset value.
+		charsetId = iCharset;
+	else
+		charsetId = iDefaultCharset;
+
+	return charsetId;		
+	}
+
+
+/**
+GetContentTypeValue()
+
+@param aContentTypeParameter
+@return
+*/
+const TPtrC8 CLocalMimeParser::GetContentTypeValue(const TDesC8& aContentTypeParameter) const
+	{
+	CDesC8Array& contentTypeParams = iMimeHeader->ContentTypeParams();
+	__ASSERT_DEBUG(!(contentTypeParams.Count()&1), User::Invariant());
+
+	TInt result;
+	if (KErrNone == contentTypeParams.Find(aContentTypeParameter,result,ECmpFolded8))
+		{
+		result++;
+		if ((result&1) && result <= contentTypeParams.Count())    
+			{       
+			// check result+1 is odd & entry exists
+			return iMimeHeader->ContentTypeParams()[result];
+			}
+		}
+	return TPtrC8();        // couldn't find match so return an empty descriptor
+	}
+
+
+/**s
+EntryId()
+
+@return
+*/
+TMsvId CLocalImRecvConvert::EntryId()
+	{
+	// If we are temporarily on the null entry then return the saved entry
+	if (iServerEntry->Entry().Id() == KMsvNullIndexEntryId)
+		{
+		return iSavedEntryId;
+		}
+	else
+		{
+		return iServerEntry->Entry().Id();
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/Local_imutdll.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,79 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+*/
+
+#include <e32std.h>
+#include <f32file.h>	// RFs
+#include <barsc.h>		// RResourceFile
+#include <bautils.h>	// Bafl::
+#include <msvutils.h>
+#include <imcvtext.h>
+#include "local_imutdll.h"
+
+#include <miuthdr.h>	// resource file name
+
+_LIT(KMTFName,"Messaging Test Framework");
+
+
+/**
+OpenResourceFileL()
+Opens a file using the file server session
+
+@param rFile
+@param anFs
+*/
+GLDEF_C void OpenResourceFileL(RResourceFile& rFile, RFs& anFs)
+	{
+	// open resource file
+	TFileName fileName(KImEngineResourceFile);
+	MsvUtils::AddPathAndExtensionToResFileL(fileName);
+	BaflUtils::NearestLanguageFile( anFs, fileName );
+	if (BaflUtils::FileExists(anFs,fileName))
+ 		{
+		rFile.OpenL( anFs, fileName );
+ 		return;
+ 		}
+ 
+	User::Leave(KErrNotFound);
+	}
+
+
+/**
+gPanic()
+
+@param aReason
+@panic 
+*/
+GLDEF_C void gPanic( TImutErrorReason aReason)
+	{
+	User::Panic( KMTFName,aReason);
+	}
+
+
+/**
+CloseResourceFile()
+Closes a opened file
+
+@param file
+*/
+GLDEF_C void CloseResourceFile( TAny* file )
+	{
+	((RResourceFile*)file)->Close();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_CheckSmtpBMSetting.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,111 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CheckSmtpBMSetting
+// [Paramaters]
+// SmtpAccountName			:Name of the Smtp account.
+// ExpectedBMSupport		:ETrue => Bearer mobility is expected to be supported by the SMTP service.
+// EFalse => Bearer mobility is not expected to be supported by the SMTP service.
+// Checks if bearer mobility is supported by the SMTP service.
+// 
+//
+
+//User includes
+#include "T_CheckSmtpBMSetting.h"
+#include <t_utils.h>
+#include <t_utilsenumconverter.h>
+#include <t_utilscentralrepository.h>
+
+//Epoc include
+#include <iapprefs.h>
+
+//Literals used
+_LIT(KSmtpAccountName,"SmtpAccountName");
+_LIT(KExpectedBMSupport,"ExpectedBMSupport");
+
+/**
+  Function : CT_MsgCheckSmtpBMSetting
+  Description : Constructor 
+  @param : aSharedDataSMTP Reference to CT_MsgSharedDataSmtp
+  @return : N/A
+*/
+CT_MsgCheckSmtpBMSetting::CT_MsgCheckSmtpBMSetting(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:CT_MsgSyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KCheckSmtpBMSetting);
+	}
+	
+/**
+  Function : ReadIni
+  Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
+  @return : TBool
+*/
+TBool CT_MsgCheckSmtpBMSetting::ReadIni()
+	{
+	TBool result = ETrue;
+	
+	if(!GetStringFromConfig(ConfigSection(), KSmtpAccountName, iSmtpAccountName))
+		{
+		ERR_PRINTF1(_L("Smtp account name is not specified"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+		
+	if(!GetBoolFromConfig(ConfigSection(), KExpectedBMSupport, iExpectedBMSupport))
+		{
+		ERR_PRINTF1(_L("An expected \"ETrue\" or \"EFalse\" boolean value is not specified for BM support"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+	
+	return result;
+	}
+
+/**
+  Function : doTestStepL
+  Description : Checks the provisioned BM support for the SMTP account settings of a test case.
+  @return : TVerdict - Test step result
+*/		
+TVerdict CT_MsgCheckSmtpBMSetting::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : CheckSmtpBMSetting"));
+	if(ReadIni())
+		{
+		CEmailAccounts* accounts = CEmailAccounts::NewL();
+		CleanupStack::PushL(accounts);
+		
+		CImSmtpSettings* smtpSettings = new(ELeave) CImSmtpSettings();
+		CleanupStack::PushL(smtpSettings);
+					
+		TSmtpAccount smtpAccountId;
+		CT_MsgUtilsCentralRepository::GetSmtpAccountL((TDes&)iSmtpAccountName, smtpAccountId);
+				
+		accounts->LoadSmtpSettingsL(smtpAccountId, *smtpSettings);
+		
+		TBool actualBMSupport = smtpSettings->BearerMobility();
+		
+		if (actualBMSupport == iExpectedBMSupport)
+			{
+			INFO_PRINTF3(_L("Actual Bearer Mobility Support [%d] does equals Expected Bearer Mobility Support [%d]"),actualBMSupport,iExpectedBMSupport);
+			}
+		else
+			{
+			ERR_PRINTF3(_L("Actual Bearer Mobility Support [%d] does not equal Expected Bearer Mobility Support [%d]"),actualBMSupport,iExpectedBMSupport);
+			SetTestStepResult(EFail);
+			}
+	
+		CleanupStack::PopAndDestroy(2,accounts); // smtpSettings, accounts
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_CheckSmtpSNAPSetting.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,134 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CheckSmtpSNAPSetting
+// [Paramaters]
+// SmtpAccountName			:Name of the Smtp account.
+// ExpectedSNAPDefinition	:ETrue => A SNAP has expected to been provisioned for the SMTP account.
+// EFalse => A SNAP has not expected to been provisioned for the SMTP account.
+// ExpectedSNAPPreference	:Expected SNAP ID (Assuming the SNAP has been defined for the SMTP a/c)
+// This parameter can be ignored if the "ExpectedSNAPDefinition" is EFalse.
+// Checks the provisioned SNAP information for the SMTP account.
+// 
+//
+
+//User includes
+#include "T_CheckSmtpSNAPSetting.h"
+#include <t_utils.h>
+#include <t_utilsenumconverter.h>
+#include <t_utilscentralrepository.h>
+
+//Epoc include
+#include <iapprefs.h>
+
+//Literals used
+_LIT(KSmtpAccountName,"SmtpAccountName");
+_LIT(KSNAPDefined,"ExpectedSNAPDefinition");
+_LIT(KSNAPPreference,"ExpectedSNAPPreference");
+
+/**
+  Function : CT_MsgCheckSmtpSNAPSetting
+  Description : Constructor 
+  @param : aSharedDataSMTP Reference to CT_MsgSharedDataSmtp
+  @return : N/A
+*/
+CT_MsgCheckSmtpSNAPSetting::CT_MsgCheckSmtpSNAPSetting(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:CT_MsgSyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KCheckSmtpSNAPSetting);
+	}
+	
+/**
+  Function : ReadIni
+  Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
+  @return : TBool
+*/
+TBool CT_MsgCheckSmtpSNAPSetting::ReadIni()
+	{
+	TBool result = ETrue;
+	
+	if(!GetStringFromConfig(ConfigSection(), KSmtpAccountName, iSmtpAccountName))
+		{
+		ERR_PRINTF1(_L("Smtp account name is not specified"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+		
+	if(!GetBoolFromConfig(ConfigSection(), KSNAPDefined, iExpectedSNAPDefinition))
+		{
+		ERR_PRINTF1(_L("An expected \"ETrue\" or \"EFalse\" boolean value is not specified for the SNAP definition"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+	
+	return result;
+	}
+
+/**
+  Function : doTestStepL
+  Description : Checks the provisioned SNAP information for the SMTP account settings of a test case.
+  @return : TVerdict - Test step result
+*/		
+TVerdict CT_MsgCheckSmtpSNAPSetting::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : CheckSmtpSNAPSetting"));
+	if(ReadIni())
+		{
+		CEmailAccounts* accounts = CEmailAccounts::NewL();
+		CleanupStack::PushL(accounts);
+		
+		CImIAPPreferences* smtpIapPrefs = CImIAPPreferences::NewLC();
+					
+		TSmtpAccount smtpAccountId;
+		CT_MsgUtilsCentralRepository::GetSmtpAccountL((TDes&)iSmtpAccountName,smtpAccountId);
+				
+		accounts->LoadSmtpIapSettingsL(smtpAccountId, *smtpIapPrefs);	
+		
+		TBool actualSNAPDefintion = smtpIapPrefs->SNAPDefined();
+		
+		if (actualSNAPDefintion == iExpectedSNAPDefinition)
+			{
+			if (actualSNAPDefintion)
+				{
+				TInt expectedSNAPPreference = 0;
+				if(!GetIntFromConfig(ConfigSection(), KSNAPPreference, expectedSNAPPreference))
+					{
+					ERR_PRINTF1(_L("An expected SNAP ID value is not specified"));
+					SetTestStepResult(EFail);
+					CleanupStack::PopAndDestroy(2,accounts); // smtpIapPrefs, accounts
+					return TestStepResult();
+					}
+				TInt actualSNAPPreference = smtpIapPrefs->SNAPPreference();
+				
+				if (actualSNAPPreference != expectedSNAPPreference)
+					{
+					ERR_PRINTF3(_L("Actual SNAP ID [%d] does not equal Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference);
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					INFO_PRINTF3(_L("Actual SNAP ID [%d] equals Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference);
+					}
+				}
+			}
+		else
+			{
+			ERR_PRINTF3(_L("Actual SNAP Defintion [%d] does not equal Expected SNAP Defintion [%d]"),actualSNAPDefintion,iExpectedSNAPDefinition);
+			SetTestStepResult(EFail);
+			}
+	
+		CleanupStack::PopAndDestroy(2,accounts); // smtpIapPrefs, accounts
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_CreateSmtpAccount.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,119 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CreateSmtpAccount
+// [Paramaters]
+// SmtpAccountName			:Name of the Smtp account.
+// SmtpConfigFileName		:Config file from which the Smtp account settings are read.
+// Creates a SMTP account in the Central Repository with the specified name using the 
+// settings read from the config file.
+// 
+//
+
+//User includes
+#include "T_CreateSmtpAccount.h"
+#include <t_utilsreademailsettingsfromconfigfile.h>
+
+//Epoc inlcudes
+#include <cemailaccounts.h>
+#include <iapprefs.h>
+#include <smtpset.h>
+
+//Literals used
+_LIT(KSmtpAccountName,"SmtpAccountName");
+_LIT(KSmtpConfigFileName,"SmtpConfigFileName");
+
+/**
+  Function : CT_MsgCreateSmtpAccount
+  Description : Constructor
+  @param : aSharedDataSMTP Reference to CT_MsgSharedDataSmtp
+  @return : N/A
+*/
+CT_MsgCreateSmtpAccount::CT_MsgCreateSmtpAccount(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:CT_MsgSyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KCreateSmtpAccount);
+	}
+
+/**
+  Function : ReadIni
+  Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
+  @return : TBool
+*/
+TBool CT_MsgCreateSmtpAccount::ReadIni()
+	{
+	TBool result = ETrue;
+	
+	if(!GetStringFromConfig(ConfigSection(), KSmtpAccountName, iSmtpAccountName))
+		{
+		ERR_PRINTF1(_L("Smtp account name is not specified"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+		
+	if(!GetStringFromConfig(ConfigSection(), KSmtpConfigFileName, iConfigFileName))
+		{
+		ERR_PRINTF1(_L("Configuration file path is not specified"));
+		SetTestStepResult(EFail);
+		}
+		
+	return result;
+	}
+
+/**
+  Function : doTestStepL
+  Description : Reads the Smtp account name and the settings file name from the .ini file
+				and then creates an Smtp account.
+  @return : TVerdict - Test step result
+*/
+TVerdict CT_MsgCreateSmtpAccount::doTestStepL()
+	{
+	
+	INFO_PRINTF1(_L("Test Step : CreateSmtpAccount"));
+	if(ReadIni())
+		{
+		CEmailAccounts*	emailAccounts = CEmailAccounts::NewLC();
+		
+		// Creates objects requried for SMTP account
+		CImIAPPreferences *smtpIapPreferences = CImIAPPreferences::NewLC();
+		CImSmtpSettings *smtpSettings = new (ELeave) CImSmtpSettings;
+		CleanupStack::PushL(smtpSettings);
+
+		// Populates the default SMTP settings
+		emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings, *smtpIapPreferences);
+
+		//If the config file name is provided as input, then reads the SMTP settings from it
+		if(iConfigFileName.CompareF( _L("none") ) != 0)
+			{
+			TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(iConfigFileName, *smtpSettings, *smtpIapPreferences));
+			if(err)
+				{
+				ERR_PRINTF2(_L("Failure while setting the SMTP settings, failed with error %d"), err);
+				SetTestStepError(err);
+				CleanupStack::PopAndDestroy(3,emailAccounts); // smtpSettings, smtpIapPreferences, emailAccounts
+				return TestStepResult();														  
+				}
+			if(TestStepResult() == EPass)
+				{
+				// Creates the SMTP account for the name specified and for the settings objects
+				TSmtpAccount smtpAccount = emailAccounts->CreateSmtpAccountL(iSmtpAccountName, *smtpSettings,*smtpIapPreferences,EFalse);
+				
+				// Sets the SMTP account created as the default SMTP account
+				emailAccounts->SetDefaultSmtpAccountL(smtpAccount);
+				}
+			}
+		CleanupStack::PopAndDestroy(3,emailAccounts); // smtpSettings, smtpIapPreferences, emailAccounts
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_CreateSmtpMessageFromEmailFile.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,284 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CreateSmtpMessageFromEmailFile
+// [Paramaters]
+// ParentFolderName	: Name of the local folder under which the message 
+// needs to be created
+// EmailFileName		: Email file from which the message is to be created
+// KilobytesExtra		: Number of lines of 1024 characters to add to body text
+// Default value is 0.
+// [Test Step Description]
+// Creates an Email message reading the contents from the email file specified
+// from the config file.
+// [APIs Used]
+// CMsvEntry::SetEntryL
+// 
+//
+
+
+
+/**
+ @file
+*/
+	
+// User include
+#include "ImCltCvRecv.h"
+#include <t_utilscentralrepository.h>
+#include "T_CreateSmtpMessageFromEmailFile.h"
+#include <t_utilsenumconverter.h>
+
+
+// Literals Used
+_LIT(KEmailFileName, "EmailFileName");
+_LIT(KParentFolderName,"ParentFolderName");
+_LIT(KKilobytesExtra, "KilobytesExtra");
+_LIT(KOverRideAddress, "OverRideAddress");
+
+// Maximum length of a line read from Email file
+const TInt KMaxLenghtOfLine = 1024;
+const TInt KMaxLenghtOfChar = 1;
+
+/**
+CT_MsgCreateSmtpMessageFromEmailFile()
+Sets the test step name to KCreateSmtpMessageFromEmailFile
+
+@param aSharedDataSMTP
+
+*/
+CT_MsgCreateSmtpMessageFromEmailFile::CT_MsgCreateSmtpMessageFromEmailFile(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgSyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KCreateSmtpMessageFromEmailFile);
+	}
+
+
+/**
+NewL()
+Static factory constructor. Uses two phase 
+construction.
+
+@param aSharedDataSMTP
+@leave KErrNoMemory
+@return
+A pointer to the newly created CT_MsgCreateSmtpMessageFromEmailFile object.
+*/
+CT_MsgCreateSmtpMessageFromEmailFile* CT_MsgCreateSmtpMessageFromEmailFile::NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+	{
+	CT_MsgCreateSmtpMessageFromEmailFile* self = new(ELeave) CT_MsgCreateSmtpMessageFromEmailFile(aSharedDataSMTP);
+	CleanupStack::PushL(self);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+
+/**
+~CT_MsgCreateSmtpMessageFromEmailFile()
+Destructor
+*/
+CT_MsgCreateSmtpMessageFromEmailFile::~CT_MsgCreateSmtpMessageFromEmailFile()
+	{
+	}
+
+	
+/**
+doTestStepL()
+Reads the name of the email file,parent foldername from the ini file
+Parses the email file to generate a message under the parent folder 
+mentioned.If the number of lines is mentioned in the ini file then adds it to the 
+message.If not mentioned takes a default of 0.
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgCreateSmtpMessageFromEmailFile::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: CreateSmtpMessageFrom email file"));
+	TPtrC emailFileName;	
+	// Read the name of the email file from the ini
+	if(!GetStringFromConfig(ConfigSection(),KEmailFileName,emailFileName))
+		{
+		ERR_PRINTF1(_L("Email file name not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TInt numKilobytesExtra = 0;
+		GetIntFromConfig( ConfigSection(), KKilobytesExtra, numKilobytesExtra);
+
+		TPtrC parentFolderName;
+		if(!GetStringFromConfig( ConfigSection(), KParentFolderName, parentFolderName))
+			{
+			ERR_PRINTF1(_L("Parent Folder is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			// Retrieves the folder Id based on the local folder name read from the ini file
+			TMsvId parentFolderId = CT_MsgUtilsEnumConverter::FindFolderIdByName(parentFolderName);
+			if( parentFolderId == KErrNotFound)
+				{
+				ERR_PRINTF1(_L("Invalid local folder name specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				INFO_PRINTF2(_L("The parent folder Id is %d"),parentFolderId );
+
+				// Retrieve the default Smtp service Id
+				TMsvId	smtpServiceId(0);
+				TRAPD(err,smtpServiceId = CT_MsgUtilsCentralRepository::GetDefaultSmtpServiceIdL());
+				if(smtpServiceId == KMsvNullIndexEntryId)
+					{
+					ERR_PRINTF1(_L("Invalid account name specified"));
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					if(err != KErrNone)
+						{
+						ERR_PRINTF2(_L("Failure while getting the default SMTP Service Id.  error = %d"),err);
+						SetTestStepResult(EFail);
+						}
+					else
+						{	
+						INFO_PRINTF2(_L("The default Smtp serviceId is %d"),smtpServiceId );
+
+						// Set the context to the folder in which message has to be created
+						CMsvEntry*	entry = CMsvEntry::NewL(*iSharedDataSMTP.iSession,parentFolderId,TMsvSelectionOrdering());
+						CleanupStack::PushL(entry);
+						entry->SetEntryL(parentFolderId);
+
+						RFs	fs;
+						User::LeaveIfError(fs.Connect());
+						CleanupClosePushL(fs);
+
+						CImCltRecvConvert* recvConvert = CImCltRecvConvert::NewLC(fs,entry,KUidMsgTypeSMTP,
+																			   smtpServiceId);
+						recvConvert->SetMsvId(parentFolderId);
+					
+						// Read one line of text from the file, parse the line and set the fields of the email 
+						// message based on the contents of the parsed line.								   
+						
+						// Open the Email file in read mode
+						RFile	file;
+						User::LeaveIfError(file.Open(fs,emailFileName,EFileRead));
+						CleanupClosePushL(file);
+
+						TBuf8<KMaxLenghtOfLine> line;
+						TBuf8<KMaxLenghtOfChar> aChar;				// To read one character from the file
+						TBool finished = FALSE;
+
+						recvConvert->ResetL();
+
+						// Parse each line from the 
+
+						do
+							{
+						 	line.FillZ();
+						 	line.SetLength(0);
+						 	// Read one line from email file
+						 	do 
+						  		{
+						  		file.Read(aChar, 1);
+						  		if(aChar.Length())
+						  			{
+									line.Append(aChar);
+									}
+						  		else
+									{
+									finished = TRUE;
+									}
+						  		}while(aChar.Length() && aChar[0] != 0x0A);
+							if(!line.Length())
+								{
+								break;
+								}
+								// Parse the line for the fields of the email and store them
+							recvConvert->ParseNextFieldL(line);
+							}while(!finished);
+					
+							// For a large email, pad the email with extra characters
+							if(numKilobytesExtra > 0)
+								{
+								const TChar KPadChar = 'L';
+								line.Fill(KPadChar, 1024);
+								for(TInt i = 0; i < numKilobytesExtra; i++)
+									{
+									recvConvert->ParseNextFieldL(line);
+									}
+								}
+	
+						// Complete the message creation by setting all the required fields and 
+						// storing the email on to the message store.
+						// The created email's ID is returned by MessageCompelteL function
+						//
+
+						TMsvId messageId;
+						messageId = recvConvert->MessageCompleteL();
+						
+						if(messageId == 0)
+							{
+							User::Leave(KErrUnknown);
+							}
+						TBool overrideAddr = ETrue; // Default is to override.
+						GetBoolFromConfig(ConfigSection(), KOverRideAddress, overrideAddr);
+						// If the recipients email address in the message need to be changed to SMTP service's
+						// email address field, "overrideAddr" should be set to ETrue.
+						if(overrideAddr)
+							{
+							CImSmtpSettings* settings = new(ELeave) CImSmtpSettings();
+							CleanupStack::PushL(settings);
+					 		
+					 		CEmailAccounts* accounts = CEmailAccounts::NewLC();
+					 		TSmtpAccount smtpAccount;
+					 		accounts->GetSmtpAccountL(smtpServiceId, smtpAccount);
+							accounts->LoadSmtpSettingsL(smtpAccount, *settings);
+							CleanupStack::PopAndDestroy(accounts);
+							
+							HBufC* emailAddress=settings->EmailAddress().AllocL();
+							CleanupStack::PushL(emailAddress);
+							
+							entry->SetEntryL(messageId);
+							CMsvStore* store = entry->EditStoreL();
+							CleanupStack::PushL(store);
+							
+							CImHeader* header = CImHeader::NewLC(); 
+
+							header->RestoreL(*store); // Retrieves the email message header
+							
+							header->ToRecipients().Reset();
+							header->ToRecipients().AppendL(*emailAddress); // Modification of the e-mail ID
+							
+							header->StoreL(*store);
+							store->CommitL();
+							
+							CleanupStack::PopAndDestroy(3, emailAddress);
+							CleanupStack::PopAndDestroy(settings);
+							}
+						INFO_PRINTF2(_L("Created a email from file %S"),&emailFileName);
+						INFO_PRINTF2(_L("The id of the message created is %d"),messageId);
+							
+						CleanupStack::PopAndDestroy(4, entry); // file, recvConvert, fs, entry
+						}
+					}
+				}
+			}
+		}
+	return TestStepResult();
+	}
+		
+		
+		
+		
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_CreateSmtpMobilityAccount.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,207 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// CreateSmtpMobilityAccount
+// [Parameters]
+// EmailAddress: Email address for mobility account / linked SMTP account
+// ConfigFileName: Configuration file name to read for account settings
+// Linked: Create a linked mobility account
+// AP ID: Access point identifier (eg. IAP number)
+// [TestStep Description]
+// Creates a mobility account under the default SMTP account
+// If linked account option is chosen, also creates a new SMTP account
+// and links the mobility account to it.
+// 
+//
+
+#include "T_CreateSmtpMobilityAccount.h"
+#include <t_utilsreademailsettingsfromconfigfile.h>
+#include <cemailaccounts.h>
+#include <iapprefs.h>
+#include <smtpset.h>
+#include <imapset.h>
+#include <cimsmtpmobilitysettings.h>
+
+_LIT(KMobilityAccountName, "Mobility Account");
+_LIT(KLinkedAccountName, "Linked Account");
+
+_LIT(KEmailAddress, "EmailAddress");
+_LIT(KLinked, "Linked");
+_LIT(KConfigFileName, "ConfigFileName");
+_LIT(KAccessPoint, "AccessPoint");
+
+/**
+	Function : NewL()
+	Description : Static factory constructor.
+
+	@param aSharedDataSMTP
+
+	@return A pointer to the newly created CT_MsgCreateSmtpMobilityAccount object.
+*/
+CT_MsgCreateSmtpMobilityAccount* CT_MsgCreateSmtpMobilityAccount::NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+	{
+	CT_MsgCreateSmtpMobilityAccount* self = new(ELeave) CT_MsgCreateSmtpMobilityAccount(aSharedDataSMTP);
+	return self;
+	}
+
+/**
+  Function : CT_MsgCreateSmtpMobilityAccount
+  Description : Constructor
+  @return : N/A
+*/
+CT_MsgCreateSmtpMobilityAccount::CT_MsgCreateSmtpMobilityAccount(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgSyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KCreateSmtpMobilityAccount);
+	}
+
+/**
+  Function : doTestStepL
+  Description : Creates SMTP mobility account
+  @return : TVerdict - Test step result
+*/
+TVerdict CT_MsgCreateSmtpMobilityAccount::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: Create Smtp Mobility Account"));
+
+	TPtrC emailAddress;
+	if(!GetStringFromConfig(ConfigSection(), KEmailAddress, emailAddress))
+		{
+		ERR_PRINTF1(_L("Email address is not specified"));
+		SetTestStepResult(EFail);
+		return TestStepResult();
+		}
+
+	TPtrC	configFileName;
+	if(!GetStringFromConfig(ConfigSection(), KConfigFileName, configFileName))
+		{
+		ERR_PRINTF1(_L("Configuration file path is not specified"));
+		SetTestStepResult(EFail);
+		return TestStepResult();
+		}
+
+	TBool linked = EFalse;
+	GetBoolFromConfig(ConfigSection(), KLinked, linked);
+
+	TInt accessPoint = 0;
+	GetIntFromConfig(ConfigSection(), KAccessPoint, accessPoint);
+
+	CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
+
+	CImIAPPreferences* smtpIapPrefs = CImIAPPreferences::NewLC();
+	CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
+	CleanupStack::PushL(smtpSettings);
+
+	if (linked || accessPoint == 0)
+		{
+		emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings, *smtpIapPrefs);
+
+		if( configFileName.CompareF( _L("none") ) != 0 )
+			{
+			TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(configFileName, *smtpSettings, *smtpIapPrefs));
+
+			if (err == KErrNone)
+				{
+				if (accessPoint == 0)
+					{
+					if (smtpIapPrefs->NumberOfIAPs() > 0)
+						{
+						TImIAPChoice iapChoice = smtpIapPrefs->IAPPreference(0);
+						accessPoint = iapChoice.iIAP;
+						}
+					}
+				}
+			else
+				{
+				ERR_PRINTF2(_L("Failure while setting the SMTP setting parameters, failed with error %d"), err);
+				SetTestStepResult(EFail);					  
+				}
+			}
+		}
+
+	RArrayIAP iapList;
+	CleanupClosePushL(iapList);
+	if (TestStepResult() == EPass)
+		{
+		if (accessPoint != 0)
+			{
+			iapList.AppendL(accessPoint);
+			}
+		else
+			{
+			ERR_PRINTF1(_L("Access point not specified"));
+			SetTestStepResult(EFail);					  
+			}
+		}
+
+	TSmtpAccount parentSmtpAccount;
+
+	if (TestStepResult() == EPass)
+		{
+		if (emailAccounts->DefaultSmtpAccountL(parentSmtpAccount) != KErrNone)
+			{
+			ERR_PRINTF1(_L("Default SMTP account not found"));
+			SetTestStepResult(EFail);															  
+			}
+		}
+
+	if (TestStepResult() == EPass)
+		{
+		if (linked)
+			{
+			/* Creates objects requried for IMAP account */
+			CImIAPPreferences* imapIapPrefs = CImIAPPreferences::NewLC();
+			CImImap4Settings* imapSettings = new (ELeave) CImImap4Settings;
+			CleanupStack::PushL(imapSettings);
+			emailAccounts->PopulateDefaultImapSettingsL(*imapSettings, *imapIapPrefs);
+
+			if( configFileName.CompareF( _L("none") ) != 0 )
+				{
+				TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadImapSettingsFromConfigurationFileL(configFileName, *imapSettings, *imapIapPrefs));
+
+				if (err != KErrNone)
+					{
+					ERR_PRINTF2(_L("Failure while setting the IMAP setting parameters, failed with error %d"), err);
+					SetTestStepResult(EFail);															  
+					}
+				}
+
+			if( TestStepResult() == EPass )
+				{
+				smtpSettings->SetEmailAddressL(emailAddress);
+
+				/* Creates the IMAP account for the name specified and for the settings objects */
+				TImapAccount linkedImapAccount = emailAccounts->CreateImapAccountL(KLinkedAccountName, *imapSettings, *imapIapPrefs, EFalse);
+
+				/* Creates the SMTP account for the name specified and for the settings objects */
+				TSmtpAccount linkedSmtpAccount = emailAccounts->CreateSmtpAccountL(linkedImapAccount, *smtpSettings, *smtpIapPrefs, EFalse);
+
+				emailAccounts->CreateSmtpMobilityAccountL(KMobilityAccountName, iapList, parentSmtpAccount, linkedSmtpAccount, EFalse);
+				}
+			CleanupStack::PopAndDestroy(2, imapIapPrefs);
+			}
+		else
+			{
+			CImSmtpMobilitySettings* mobilitySettings = CImSmtpMobilitySettings::NewLC();
+			emailAccounts->PopulateDefaultSmtpMobilitySettingsL(*mobilitySettings);
+			mobilitySettings->SetEmailAddressL(emailAddress);
+			emailAccounts->CreateSmtpMobilityAccountL(KMobilityAccountName, iapList, parentSmtpAccount, *mobilitySettings, EFalse);
+			CleanupStack::PopAndDestroy(mobilitySettings);
+			}
+		}
+
+	CleanupStack::PopAndDestroy(4, emailAccounts);
+
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_ModifySmtpSettings.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,130 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// ModifySmtpSettings
+// [Paramaters]
+// SmtpAccountName			:Name of the Smtp account
+// SmtpConfigFileName		:Config file from which the Smtp account settings are read 
+// ModifySmtpSettings Test Step is intended to modify existing settings and save to CenRep 
+// for the specified SMTP account Id
+// 
+//
+
+/* user includes */
+#include "T_ModifySmtpSettings.h"
+#include <t_utilsreademailsettingsfromconfigfile.h>
+#include <t_utilscentralrepository.h>
+
+/* epoc inlcudes */
+#include <cemailaccounts.h>
+#include <smtpset.h>
+#include <iapprefs.h>
+
+/* Literals used */
+_LIT(KSmtpAccountName,"SmtpAccountName");
+_LIT(KSmtpConfigFileName,"SmtpConfigFileName");
+
+/**
+  Function : CT_MsgModifySmtpSettings
+  Description : Constructor
+  @param : aSharedDataSMTP Reference to CT_MsgSharedDataSmtp
+  @return : N/A
+*/
+CT_MsgModifySmtpSettings::CT_MsgModifySmtpSettings(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgSyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KModifySmtpSettings);
+	}
+	
+/**
+  Function : ~CT_MsgModifySmtpSettings
+  Description : Destructor
+  @return : N/A
+*/
+CT_MsgModifySmtpSettings::~CT_MsgModifySmtpSettings()
+	{
+	}
+
+/**
+  Function : doTestStepL
+  Description : Reads the Smtp account name and config file name from the .ini file
+				and it then modifies the account with the settings read from the config file.
+  @return : TVerdict - Test step result
+  @leave  : KMsvNullIndexEntryId	Invalid SMTP account name specified	
+*/
+TVerdict CT_MsgModifySmtpSettings::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step: ModifySmtpSettings"));
+	// Read the SMTP account name from the ini file
+	TPtrC smtpAccountName;
+	if(!GetStringFromConfig(ConfigSection(), KSmtpAccountName, smtpAccountName))
+		{
+		ERR_PRINTF1(_L("SMTP account name is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		// Read the SMTP Config file name from the ini file
+		TPtrC configFileName;
+		if(!GetStringFromConfig(ConfigSection(), KSmtpConfigFileName, configFileName))
+			{
+			ERR_PRINTF1(_L("Configuration file path is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			// Retrieving the SMTP service Id for the given SMTP account
+			TMsvId smtpServiceId = CT_MsgUtilsCentralRepository::GetSmtpServiceIdL((TDes&)smtpAccountName);
+			INFO_PRINTF2(_L("SMTP service Id is %d"),smtpServiceId);
+			
+			if(smtpServiceId == KMsvNullIndexEntryId)
+				{
+				ERR_PRINTF1(_L("Invalid SMTP account name specified"));
+				SetTestStepResult(EFail);
+				}
+			// Creates the settings object
+			else
+				{
+				CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
+
+				CImSmtpSettings* smtpSettings = new(ELeave) CImSmtpSettings();
+				CleanupStack::PushL(smtpSettings);
+				
+				CImIAPPreferences* smtpIapPrefs = CImIAPPreferences::NewLC();
+
+				// Loads the settings for the account with the current settings
+				TSmtpAccount smtpAccount;
+				emailAccounts->GetSmtpAccountL(smtpServiceId, smtpAccount);
+				emailAccounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings);
+				emailAccounts->LoadSmtpIapSettingsL(smtpAccount, *smtpIapPrefs);
+
+				// Reads the settings from the config file
+				TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(configFileName, *smtpSettings, *smtpIapPrefs));
+				if(err)
+					{	
+					ERR_PRINTF2(_L("Failure while setting the SMTP setting parameters, failed with error %d"), err);
+					SetTestStepError(err);															  
+					}
+				else
+					{
+					// Saves the new settings
+					emailAccounts->SaveSmtpSettingsL(smtpAccount, *smtpSettings);
+					emailAccounts->SaveSmtpIapSettingsL(smtpAccount, *smtpIapPrefs);
+					}
+				CleanupStack::PopAndDestroy(3, emailAccounts);// smtpIapPrefs,smtpSettings,emailAccounts
+				}
+			}
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_MsgAsyncStepSMTP.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,40 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [Test Step] :
+// AsyncStepSMTP
+// References SMTP shared data for use by derived test steps.
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+// User includes
+#include "T_MsgAsyncStepSMTP.h"
+
+
+/**
+CT_AsyncStepSMTP()
+Constructor
+
+@param aSharedDataSMTP
+*/
+CT_MsgAsyncStepSMTP::CT_MsgAsyncStepSMTP(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgAsyncStep()
+,	iSharedDataSMTP(aSharedDataSMTP)
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_MsgSharedDataSmtp.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,89 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+*/
+
+
+// user include
+#include "T_MsgSharedDataSmtp.h"
+
+
+// epoc includes
+#include <miutset.h>
+
+/**
+NewL()
+Static factory constructor. Uses two phase 
+construction.
+
+@leave KErrNoMemory
+@return
+A pointer to the newly created CT_MsgSharedDataSmtp object.
+*/
+CT_MsgSharedDataSmtp* CT_MsgSharedDataSmtp::NewL()
+	{
+	CT_MsgSharedDataSmtp* self = new(ELeave) CT_MsgSharedDataSmtp();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+
+/**
+  ConstructL()
+  Second phage constructor
+*/
+void CT_MsgSharedDataSmtp::ConstructL()
+{
+	CT_MsgSharedDataBase::ConstructL();
+	iPeriodic 		= CPeriodic::New(1);
+	iMaxRamValue 	= 0;
+	iMinRamValue 	= 0;
+	iStartRamValue 	= 0;
+	iEndRamValue 	= 0;
+	iMark			= ETrue;
+}
+
+/**
+  ~CT_MsgSharedDataSmtp
+  Destructor
+*/
+CT_MsgSharedDataSmtp::~CT_MsgSharedDataSmtp()
+	{
+	delete iPeriodic;
+	}
+
+/**
+NewMtmL()
+
+*/
+CBaseMtm* CT_MsgSharedDataSmtp::NewMtmL()
+	{
+	return iRegistry->NewMtmL(KUidMsgTypeSMTP);	
+	}
+
+
+/**
+CT_MsgSharedDataBase()
+Constructor
+*/
+CT_MsgSharedDataSmtp::CT_MsgSharedDataSmtp()
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_MsgSyncStepSMTP.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,39 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// References SMTP shared data for use by derived test steps.
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User includes
+#include "T_MsgSyncStepSMTP.h"
+
+
+/**
+CT_MsgAsyncStepSMTP()
+Constructor
+
+@param aSharedDataSMTP
+*/
+CT_MsgSyncStepSMTP::CT_MsgSyncStepSMTP(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgStep()
+,	iSharedDataSMTP(aSharedDataSMTP)
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_RemoveSmtpSNAPSetting.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,92 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// RemoveSmtpSNAPSetting
+// [Paramaters]
+// SmtpAccountName			:Name of the Smtp account.
+// Removes the provisioned SNAP information for the SMTP account.
+// 
+//
+
+//User includes
+#include "T_RemoveSmtpSNAPSetting.h"
+#include <t_utils.h>
+#include <t_utilsenumconverter.h>
+#include <t_utilscentralrepository.h>
+
+//Epoc include
+#include <iapprefs.h>
+
+//Literal used
+_LIT(KSmtpAccountName,"SmtpAccountName");
+
+/**
+  Function : CT_MsgRemoveSmtpSNAPSetting
+  Description : Constructor 
+  @param : aSharedDataSMTP Reference to CT_MsgSharedDataSmtp
+  @return : N/A
+*/
+CT_MsgRemoveSmtpSNAPSetting::CT_MsgRemoveSmtpSNAPSetting(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:CT_MsgSyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KRemoveSmtpSNAPSetting);
+	}
+	
+/**
+  Function : ReadIni
+  Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
+  @return : TBool
+*/
+TBool CT_MsgRemoveSmtpSNAPSetting::ReadIni()
+	{
+	TBool result = ETrue;
+	
+	if(!GetStringFromConfig(ConfigSection(), KSmtpAccountName, iSmtpAccountName))
+		{
+		ERR_PRINTF1(_L("Smtp account name is not specified"));
+		SetTestStepResult(EFail);
+		result = EFalse;
+		}
+		
+	return result;
+	}
+
+/**
+  Function : doTestStepL
+  Description : Removes the provisioned SNAP information from the SMTP account settings of a test case.
+  @return : TVerdict - Test step result
+*/		
+TVerdict CT_MsgRemoveSmtpSNAPSetting::doTestStepL()
+	{
+	INFO_PRINTF1(_L("Test Step : RemoveSmtpSNAPSetting"));
+	if(ReadIni())
+		{
+		CEmailAccounts* accounts = CEmailAccounts::NewL();
+		CleanupStack::PushL(accounts);
+		
+		CImIAPPreferences* smtpIapPrefs = CImIAPPreferences::NewLC();
+					
+		TSmtpAccount smtpAccountId;
+		CT_MsgUtilsCentralRepository::GetSmtpAccountL((TDes&)iSmtpAccountName, smtpAccountId);
+				
+		accounts->LoadSmtpIapSettingsL(smtpAccountId, *smtpIapPrefs);	
+		
+		smtpIapPrefs->RemoveSNAP();
+		
+		accounts->SaveSmtpIapSettingsL(smtpAccountId, *smtpIapPrefs);
+	
+		CleanupStack::PopAndDestroy(2,accounts); // smtpIapPrefs, accounts
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_RetrievePlainBodyTextAndCompare.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,308 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// RetrievePlainBodyTextAndCompare
+// [Parameters]
+// ServiceType			:	Specifies the service type(IMAP or POP) under which message exists.
+// ImapAccountName		:	If service type is IMAP4, specify the IMAP account name that holds the
+// message.
+// ParentFolderName	:	IMAP4 folder name that holds the message.
+// PopAccountName		:	If the the sevice type is POP3, specify POP account name.
+// SubjectOfExistingMsg:	Sbject line of the existing message to which forward message
+// would be creted.
+// EmailFileName		:	File name from which existing message has been created.
+// ChunkSize			:	Chunk size to be used for retriving body text of a message.
+// Searches for the message with the specified subject and retrives the body part of
+// the message and write it to the RetrivedBody.txt file.
+// [APIs Used]
+// CImEmailMessage::OpenPlainBodyTextForReadL
+// CImPlainBodyText::NextChunkL
+// NOTE : Comparison part has been removed as it would success only when 
+// message creation and fetching both uses same set of character set(8 bit or 16 bit).
+// However comaprison can be done manually using the text comparison tools(e.g, Beyond Compare)
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+
+// User Includes
+#include "T_RetrievePlainBodyTextAndCompare.h"
+#include <t_utilscentralrepository.h>
+#include <t_utilsenumconverter.h>
+#include <t_utils.h>
+
+
+// Epoc Include
+#include <miutmsg.h>
+#include <cimplainbodytext.h>
+
+
+// Literals Used
+_LIT(KServiceType, "ServiceType");
+
+_LIT(KImapAccountName, "ImapAccountName");
+_LIT(KParentFolderName, "ParentFolderName");
+
+_LIT(KPopAccountName,"PopAccountName");
+
+_LIT(KSubjectOfExistingMsg,"SubjectOfExistingMsg");
+_LIT(KEmailFileName, "EmailFileName");
+_LIT(KChunkSize, "ChunkSize");
+
+_LIT(KRetrivedBody, "c:\\msgtest\\RetrivedBody.txt"); //File used to hold the retrive body part
+
+
+const TInt KArrayGranularity = 8;
+const TInt KZero={0};
+/**
+CT_RetrievePlainBodyTextAndCompare
+Constructor
+
+@param :
+@return : N/A
+
+
+*/
+CT_RetrievePlainBodyTextAndCompare::CT_RetrievePlainBodyTextAndCompare(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+: CT_MsgAsyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KRetrievePlainBodyTextAndCompare);
+	}
+
+
+/**
+NewL()
+Static factory constructor. Uses two phase 
+construction.
+
+@param aSharedDataSMTP
+@leave KErrNoMemory
+@return
+A pointer to the newly created CT_RetrievePlainBodyTextAndCompare object.
+*/
+CT_RetrievePlainBodyTextAndCompare* CT_RetrievePlainBodyTextAndCompare::NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+	{
+	CT_RetrievePlainBodyTextAndCompare* self = new(ELeave) CT_RetrievePlainBodyTextAndCompare(aSharedDataSMTP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 // Call CT_AsyncStep::ConstructL()
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+
+/**
+~CT_RetrievePlainBodyTextAndCompare()
+Destructor
+*/
+CT_RetrievePlainBodyTextAndCompare::~CT_RetrievePlainBodyTextAndCompare()
+	{}
+
+
+/**
+ProgressL()
+
+@param aFinal
+*/
+void CT_RetrievePlainBodyTextAndCompare::ProgressL(TBool aFinal)
+	{
+	if ( aFinal )
+		{
+		//	Display final progress iOperation
+		}
+	else
+		{
+		//	Display current progress iOperation
+		}
+	}
+
+
+/**
+CancelStep()
+*/
+void CT_RetrievePlainBodyTextAndCompare::CancelStep()
+	{}
+
+	
+/**
+doTestStepL()
+Opens the body text part with read only mode. Reads the contents of body part chunkwise and write it
+to the file  RetrivedBody.txt. Then it comapares the contents of RetrivedBody.txt with the input file.
+@return
+Returns the test step result
+*/
+TVerdict CT_RetrievePlainBodyTextAndCompare::doTestStepL()
+	{
+	INFO_PRINTF1( _L("Test Step : Edit Message Body Text") );	
+	TMsvId	entryToBesearched;
+	TPtrC serviceType;
+	if(!GetStringFromConfig( ConfigSection(), KServiceType, serviceType))
+		{
+		ERR_PRINTF1(_L("\"ServiceType\" for the message is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TBuf<4> temp(serviceType);
+		temp.UpperCase();						// Makes case insensitive
+		// Perform the following if message has been downloaded using IMAP4 service
+		if(temp.CompareC(_L("IMAP")) == KZero)
+			{
+			// Read the IMAP account name from the ini file
+			TPtrC imapAccountName;
+			if(!GetStringFromConfig( ConfigSection(), KImapAccountName, imapAccountName))
+				{
+				ERR_PRINTF1(_L("ImapAccount Name is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				TPtrC	parentFolderName;
+				if(!GetStringFromConfig( ConfigSection(), KParentFolderName, parentFolderName))
+					{
+					ERR_PRINTF1(_L("Parent Folder is not specified"));
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					
+					// retrieves the folder Id based on the remote service folder name read from the ini file
+					entryToBesearched = CT_MsgUtils::GetRemoteFolderIdByNameL(iSharedDataSMTP.iSession, imapAccountName, parentFolderName);
+					if( entryToBesearched == KErrNotFound)
+						{
+						ERR_PRINTF1(_L("Invalid Remote folder name specified"));
+						SetTestStepResult(EFail);
+						}
+					else
+						{
+						INFO_PRINTF2(_L("The parent folder Id is %d"),entryToBesearched );
+						}
+					}
+				}
+			}
+		// Perform the following if message has been downloaded using POP3 service 	
+		else if(temp.CompareC(_L("POP")) == KZero)
+			{
+			TPtrC popAccountName;
+			if(!GetStringFromConfig( ConfigSection(), KPopAccountName, popAccountName))
+				{
+				ERR_PRINTF1(_L("PopAccount Name is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				// Retrieves the Pop service Id for the given Pop account
+				entryToBesearched = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+				INFO_PRINTF2(_L("Pop service id is %d"), entryToBesearched);
+
+				// Fails the test step if an invalid POP account is specified 
+				if(entryToBesearched == KMsvNullIndexEntryId)
+					{
+					ERR_PRINTF1(_L("Invalid POP account name specified"));
+					SetTestStepResult(EFail);
+					}
+				}
+			}
+		else
+			{
+			ERR_PRINTF1(_L("\"ServiceType\" is not specified: It should be IMAP or POP"));
+			SetTestStepResult(EFail);
+			}
+		}
+
+	if(TestStepResult() == EPass)
+		{
+		TPtrC subjectOfExistingMsg;	
+		if( !GetStringFromConfig(ConfigSection(), KSubjectOfExistingMsg, subjectOfExistingMsg))
+			{
+			ERR_PRINTF1(_L("\"SubjectOfExistingMsg\" is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			// Retrieves the message Id based on the message subject from the given remote service folder
+			TMsvId messageId;
+			messageId = CT_MsgUtils::SearchMessageBySubjectL(iSharedDataSMTP.iSession, entryToBesearched, subjectOfExistingMsg, ETrue);
+			if( messageId == KMsvNullIndexEntryId)
+				{
+				ERR_PRINTF1(_L("The given message is not found"));
+				SetTestStepResult(EFail);
+				}
+			// Message found
+			else
+				{
+				TPtrC emailFileName;
+				if(!GetStringFromConfig( ConfigSection(), KEmailFileName, emailFileName))
+					{
+					ERR_PRINTF1(_L("Parent Folder is not specified"));
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					INFO_PRINTF2(_L("The Message Id is %d"),messageId );
+
+					// Setting the current context to the parent of the mesage
+					CMsvEntry*	messageEntry = CMsvEntry::NewL(*iSharedDataSMTP.iSession, messageId , TMsvSelectionOrdering());
+					CleanupStack::PushL(messageEntry);
+					messageEntry->SetEntryL(messageId);
+					CImEmailMessage *emailMessage = CImEmailMessage::NewLC(*messageEntry);
+					TInt chunkSize(1);
+					GetIntFromConfig(ConfigSection(), KChunkSize, chunkSize);
+					// Open the body text part for read only purpose
+					CImPlainBodyText* bodytext = emailMessage->OpenPlainBodyTextForReadL(CImEmailMessage::EThisMessageOnly, chunkSize);
+					CleanupStack::PushL(bodytext);
+			
+
+					HBufC*  fileData =  HBufC::NewLC(chunkSize);
+					TPtr readData = fileData->Des();
+					RFs	fs;
+					User::LeaveIfError(fs.Connect());
+					CleanupClosePushL(fs);
+
+					RFile	file;
+					User::LeaveIfError(file.Replace(fs,KRetrivedBody,EFileWrite));
+					CleanupClosePushL(file);
+					TInt count = 0;
+					// Retrieve and store the body text to a file
+					do
+						{
+						bodytext->NextChunkL(readData);
+						_LIT(KServerMessage, "*This message was transferred with a trial version of CommuniGate(tm) Pro*\r\n");
+						TInt position = readData.Find(KServerMessage);// readData.Find(KServerMessage);
+						if(position != KErrNotFound && count < 1)
+							{
+							count++;
+							readData.Delete(position, KServerMessage().Length());
+							TPtrC8 inFileBuf8((TUint8*)(readData.Ptr()), readData.Length()*2);
+							file.Write(inFileBuf8);
+							}
+						else
+							{
+							TPtrC8 inFileBuf8((TUint8*)(readData.Ptr()), readData.Length()*2);
+							file.Write(inFileBuf8);
+							}
+						}while(readData.Length()>0);
+					file.Close();
+					CleanupStack::PopAndDestroy(6, messageEntry); // file, fs, fileData, bodytext, emailMessage, messageEntry
+					}
+				}
+			}
+		}
+	return TestStepResult();	
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_SendSmtpMessage.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,218 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// SendSmtpMessage
+// [Parameters]
+// ParentFolderName  :   Local folder name in which the message to be sent is 
+// present
+// Subject			  :	  Subject of the message to be sent 	
+// Searches for the message with the specified subject and sends the message if the
+// message is found.  If the local folder name is invalid or if the message is 
+// not found in the given folder,the test step fails.
+// [APIs Used]
+// CMsvEntry::SetEntryL
+// CMsvEntry::CopyL
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+
+//User Includes
+#include "T_SendSmtpMessage.h"
+#include <t_utilsenumconverter.h>
+#include <t_utils.h>
+#include <t_utilscentralrepository.h>
+
+
+// Literals Used
+_LIT(KSubject,"Subject");
+_LIT(KParentFolderName,"ParentFolderName");
+
+
+/**
+CT_MsgSendSmtpMessage
+Constructor
+
+@param :
+@return : N/A
+
+
+*/
+CT_MsgSendSmtpMessage::CT_MsgSendSmtpMessage(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgAsyncStepSMTP(aSharedDataSMTP)
+,	iOperation(NULL)
+	{
+	SetTestStepName(KSendSmtpMessage);
+	}
+
+
+/**
+NewL()
+Static factory constructor. Uses two phase 
+construction.
+
+@param aSharedDataSMTP
+@leave KErrNoMemory
+@return
+A pointer to the newly created CT_MsgSendSmtpMessage object.
+*/
+CT_MsgSendSmtpMessage* CT_MsgSendSmtpMessage::NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+	{
+	CT_MsgSendSmtpMessage* self = new(ELeave) CT_MsgSendSmtpMessage(aSharedDataSMTP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 // Call CT_AsyncStep::ConstructL()
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+
+/**
+~CT_MsgSendSmtpMessage()
+Destructor
+*/
+CT_MsgSendSmtpMessage::~CT_MsgSendSmtpMessage()
+	{
+	delete iOperation;
+	iOperation=NULL;
+	}
+
+
+/**
+ProgressL()
+
+@param bFinal
+*/
+void CT_MsgSendSmtpMessage::ProgressL(TBool bFinal)
+	{
+	//	TODO
+	if ( bFinal )
+		{
+		//	Display final progress iOperation
+		}
+	else
+		{
+		//	Display current progress iOperation
+		}
+	}
+
+
+/**
+CancelStep()
+*/
+void CT_MsgSendSmtpMessage::CancelStep()
+	{
+	iOperation->Cancel();
+	}
+
+	
+/**
+doTestStepL()
+Reads the parent folder name, the message subject from the ini file
+Searches for the message under the specified folder, and sends the message
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgSendSmtpMessage::doTestStepL()
+	{
+	INFO_PRINTF1( _L("Test Step : Send Smtp Message") );	
+	TPtrC	parentFolderName;
+	if(!GetStringFromConfig( ConfigSection(), KParentFolderName, parentFolderName))
+		{
+		ERR_PRINTF1(_L("Parent Folder is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TPtrC	subject;	
+		if( !GetStringFromConfig(ConfigSection(), KSubject, subject ))
+			{
+			ERR_PRINTF1(_L("The subject of the message is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			// retrieves the folder Id based on the local folder name read from the ini file
+			TMsvId	parentFolderId = CT_MsgUtilsEnumConverter::FindFolderIdByName(parentFolderName);
+			if( parentFolderId == KErrNotFound)
+				{
+				ERR_PRINTF1(_L("Invalid local folder name specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				INFO_PRINTF2(_L("The parent folder Id is %d"),parentFolderId );
+
+				// Retrieves the message Id based ont he message subject from the given local folder
+				TMsvId	messageId = CT_MsgUtils::SearchMessageBySubjectL(iSharedDataSMTP.iSession, parentFolderId , subject);
+				if( messageId == KMsvNullIndexEntryId)
+					{
+					ERR_PRINTF1(_L("The given message is not found"));
+					SetTestStepResult(EFail);
+					}
+				// Message found	
+				else
+					{
+					INFO_PRINTF2(_L("The Message Id is %d"),messageId );
+
+					// Retrieve the default Smtp service Id
+					TMsvId	smtpServiceId(0);
+					TRAPD(err, smtpServiceId = CT_MsgUtilsCentralRepository::GetDefaultSmtpServiceIdL());
+					if(err != KErrNone)
+						{
+						ERR_PRINTF2(_L("Failure while getting the default SMTP Service Id.  error = %d"),err);
+						SetTestStepResult(EFail);
+						}
+					else
+						{
+						INFO_PRINTF2(_L("The Default Smtp Service Id is %d"),smtpServiceId );
+
+						// Setting the current context to the parent of the mesage
+						CMsvEntry*	folderEntry = CMsvEntry::NewL(*iSharedDataSMTP.iSession, messageId , TMsvSelectionOrdering());
+						CleanupStack::PushL(folderEntry);
+						folderEntry->SetEntryL(messageId);
+						folderEntry->SetEntryL(folderEntry->Entry().Parent());
+
+						// Sends the message
+						CT_MsgActive&	active=Active();
+						iOperation = folderEntry->CopyL(messageId, smtpServiceId, active.iStatus);
+						active.Activate();
+						CActiveScheduler::Start();
+
+						TImSmtpProgress temp;
+						TPckgC<TImSmtpProgress> paramPack(temp);
+						paramPack.Set(iOperation->ProgressL());
+						TImSmtpProgress progress=paramPack();
+						SetTestStepError(progress.Error());
+
+						if (NULL!=iOperation)
+							{
+							delete iOperation;
+							iOperation=NULL;
+							}
+						CleanupStack::PopAndDestroy(folderEntry); //operation,folderEntry
+						}
+					}
+				}
+			}
+		}
+
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_SmtpCreateForwardMessage.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,361 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// [TestStep Name]
+// SmtpCreateForwadMessage
+// [Parameters]
+// ServiceType			:	Specifies the service type(IMAP or POP) under which message exists.
+// FolderName			:	Destination local folder where message is to be created.
+// ImapAccountName		:	If service type is IMAP4, specify the IMAP account name that holds the
+// message.
+// ParentFolderName	:	IMAP4 folder name that holds the message.
+// PopAccountName		:	If the the sevice type is POP3, specify POP account name.
+// CommandName			:	SMTP client MTM command used to create the forward message.
+// FolderName			:	Destination local folder in which message would be storted.
+// SubjectOfExistingMsg:	Sbject line of the existing message to which forward message
+// would be creted.
+// SubjectOfForwardMsg	:	Specifies the subject line to be set for the froward message.
+// This is an optional parameter and if not specified the subject line
+// would take the default format(Fwd: <SubjectOfExistingMsg>).
+// Creates a forward message to an existing message using the SMTP client MTM command
+// and modifies the message header information.
+// [APIs Used]
+// CImEmailMessage::OpenPlainBodyTextForReadL
+// CImPlainBodyText::NextChunkL
+// 
+//
+
+
+
+
+// User includes 
+#include "T_SmtpCreateForwardMessage.h"
+#include <t_utilscentralrepository.h>
+#include <t_utilsenumconverter.h>
+#include <t_utils.h>
+
+
+// Epoc includes 
+#include <miutmsg.h>
+
+
+// Literals Used 
+_LIT(KServiceType, "ServiceType");
+
+_LIT(KImapAccountName,"ImapAccountName");
+_LIT(KParentFolderName,"ParentFolderName");
+
+_LIT(KPopAccountName,"PopAccountName");
+
+_LIT(KCommandName,"CommandName");
+_LIT(KFolderName, "FolderName");
+_LIT(KSubjectOfExistingMsg,"SubjectOfExistingMsg");
+
+_LIT(KSubjectOfForwardMsg, "SubjectOfForwardMsg");
+_LIT(KRecipientsAddress, "RecipientsAddress");
+
+const TInt KZero={0};
+/**
+  Function 		: CT_SmtpCreateForwadMessage
+  Description 	: Constructor
+  @param 		: aSharedDataSMTP		Reference to CT_MsgSharedDataSmtp
+  @return 		: N/A
+*/
+CT_SmtpCreateForwadMessage::CT_SmtpCreateForwadMessage(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgAsyncStepSMTP(aSharedDataSMTP)
+,	iOperation(NULL)
+	{
+	SetTestStepName(KSmtpCreateForwadMessage);
+	}
+
+
+/**
+  Function 		: NewL
+  Description 	: Creates an object of CT_SmtpCreateForwadMessage 				 
+  @return 		: N/A
+*/
+CT_SmtpCreateForwadMessage* CT_SmtpCreateForwadMessage::NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+	{
+	CT_SmtpCreateForwadMessage* self = new(ELeave) CT_SmtpCreateForwadMessage(aSharedDataSMTP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 
+	CleanupStack::Pop(self);
+	return self;
+	}	
+
+	
+/**
+  Function 		: ~CT_SmtpCreateForwadMessage
+  Description 	: Destructor
+  @return 		: N/A
+*/
+CT_SmtpCreateForwadMessage::~CT_SmtpCreateForwadMessage()
+	{
+	delete iRecipientAddress;
+	delete iOperation;
+	iOperation = NULL;
+	}
+
+/**
+  Function 		: ProgressL
+  Description 	: Displays the status of the asynchronous operation
+  @return 		: N/A
+*/
+void CT_SmtpCreateForwadMessage::ProgressL(TBool /*bFinal*/)
+	{}
+
+
+/**
+  Function 		: CancelStep
+  Description 	: Cancels the asynchronous operation
+  @return 		: N/A
+*/
+void CT_SmtpCreateForwadMessage::CancelStep()
+	{
+	iOperation->Cancel();
+	}
+
+
+/**
+  Function 		: doTestStepL
+  Description 	: Creates a forward message for an existing message. Existing message
+  				  may be under some remot folder under IMAP service or under POP service.
+  @return 		: TVerdict - Test step result
+*/
+TVerdict CT_SmtpCreateForwadMessage::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep: SmtpCreateFwdMsgForPlainBodyTextMsg"));
+	TMsvId	entryToBesearched = KMsvNullIndexEntryId;
+	TPtrC serviceType;
+	if(!GetStringFromConfig( ConfigSection(), KServiceType, serviceType))
+		{
+		ERR_PRINTF1(_L("\"ServiceType\" for the message is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TBuf<4> temp(serviceType);
+		temp.UpperCase();						// Makes case insensitive
+		// Perform the following if message has been downloaded using IMAP4 service
+		if(temp.CompareC(_L("IMAP")) == KZero)
+			{
+			// Read the IMAP account name from the ini file
+			TPtrC imapAccountName;
+			if(!GetStringFromConfig( ConfigSection(), KImapAccountName, imapAccountName))
+				{
+				ERR_PRINTF1(_L("ImapAccount Name is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				TPtrC	parentFolderName;
+				if(!GetStringFromConfig( ConfigSection(), KParentFolderName, parentFolderName))
+					{
+					ERR_PRINTF1(_L("Parent Folder is not specified"));
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					
+					// retrieves the folder Id based on the remote service folder name read from the ini file
+					entryToBesearched = CT_MsgUtils::GetRemoteFolderIdByNameL(iSharedDataSMTP.iSession, imapAccountName, parentFolderName);
+					if( entryToBesearched == KErrNotFound)
+						{
+						ERR_PRINTF1(_L("Invalid Remote folder name specified"));
+						SetTestStepResult(EFail);
+						}
+					else
+						{
+						INFO_PRINTF2(_L("The parent folder Id is %d"),entryToBesearched );
+						}
+					}
+				}
+			}
+		// Perform the following if message has been downloaded using POP3 service 	
+		else if(temp.CompareC(_L("POP")) == KZero)
+			{
+			TPtrC popAccountName;
+			if(!GetStringFromConfig( ConfigSection(), KPopAccountName, popAccountName))
+				{
+				ERR_PRINTF1(_L("PopAccount Name is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				// Retrieves the Pop service Id for the given Pop account
+				entryToBesearched = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+				INFO_PRINTF2(_L("Pop service id is %d"), entryToBesearched);
+
+				// Fails the test step if an invalid POP account is specified 
+				if(entryToBesearched == KMsvNullIndexEntryId)
+					{
+					ERR_PRINTF1(_L("Invalid POP account name specified"));
+					SetTestStepResult(EFail);
+					}
+				}
+			}
+		else
+			{
+			ERR_PRINTF1(_L("Sevice Type is not specified: It should be IMAP or POP"));
+			SetTestStepResult(EFail);
+			}
+		}
+		
+	if(TestStepResult() == EPass)
+		{
+		TPtrC commandName;
+		if(!GetStringFromConfig( ConfigSection(), KCommandName, commandName))
+			{
+			ERR_PRINTF1(_L("Command name is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			// Read the name of the target folder from the ini file
+			TPtrC folderName;
+			if(!GetStringFromConfig( ConfigSection(), KFolderName, folderName))
+				{
+				ERR_PRINTF1(_L("Folder name is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				TPtrC subjectOfExistingMsg;	
+				if( !GetStringFromConfig(ConfigSection(), KSubjectOfExistingMsg, subjectOfExistingMsg))
+					{
+					ERR_PRINTF1(_L("\"SubjectOfExistingMsg\" is not specified"));
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					// Retrieves the message Id based on the message subject from the given remote service folder
+					TMsvId messageId;
+					messageId = CT_MsgUtils::SearchMessageBySubjectL(iSharedDataSMTP.iSession, entryToBesearched, subjectOfExistingMsg, ETrue);
+					if( messageId == KMsvNullIndexEntryId)
+						{
+						ERR_PRINTF1(_L("The given message is not found"));
+						SetTestStepResult(EFail);
+						}
+					else
+						{
+						TMsvId folderId;
+						folderId = CT_MsgUtilsEnumConverter::FindFolderIdByName(folderName);
+						
+						// Interpret the SMTP client MTM command to be executed 
+						TSmtpCmds commandId = CT_MsgUtilsEnumConverter::ConvertDesToTSmtpCmdsL((TDesC&) commandName);									
+
+						CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+						CleanupStack::PushL(selection);
+									
+						selection->AppendL(folderId);
+						selection->AppendL(messageId);
+
+						TImCreateMessageOptions createMessageOptions;
+						createMessageOptions.iMsvPartList = KMsvMessagePartBody;
+						createMessageOptions.iMessageType = KUidMsgTypeSMTP;
+						createMessageOptions.iMsvEmailTypeList = 0;
+						TPckgBuf<TImCreateMessageOptions> paramPack(createMessageOptions);
+						
+						CT_MsgActive&	active=Active();
+						delete iOperation;
+						iOperation = NULL;
+						TRAPD(err2,iOperation = iSharedDataSMTP.iMtm->InvokeAsyncFunctionL(commandId,*selection,paramPack,active.iStatus));
+						active.Activate();
+						CActiveScheduler::Start();
+						SetHeaderPartL();
+
+						User::LeaveIfError(active.Result());
+						INFO_PRINTF2(_L("err2 : %d"), err2);
+						CleanupStack::PopAndDestroy(selection); // selection
+						}
+					}
+				}
+			}
+		}
+	return TestStepResult();
+	}
+
+
+/**
+  Function 		: SetHeaderPartL
+  Description 	: Sets the message header fields. If the field values are not provided
+  				  as input, it takes the default values.
+  @return 		: N/A  				  
+*/
+void CT_SmtpCreateForwadMessage::SetHeaderPartL()
+	{
+	//Get the message ID from the CMsvOperation object
+	TMsvId temp;	
+	TPckgC<TMsvId> paramPack(temp);
+	const TDesC8& progBuf = iOperation->ProgressL();	
+	paramPack.Set(progBuf);
+	TMsvId newMessageId = paramPack();	
+	if (newMessageId!=NULL)
+		{
+		CMsvEntry *entry = CMsvEntry::NewL(*(iSharedDataSMTP.iSession), newMessageId, TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
+		CleanupStack::PushL(entry);
+		entry->SetEntryL(newMessageId);			// 
+		CMsvStore* store = entry->EditStoreL();
+		CleanupStack::PushL(store);
+		
+		CImHeader* header = CImHeader::NewLC(); 
+		header->RestoreL(*store); // Retrieves the email message header part from the message store
+		TPtrC subjectOfForwardMsg;
+		if(GetStringFromConfig(ConfigSection(), KSubjectOfForwardMsg, subjectOfForwardMsg))
+			{
+			header->SetSubjectL(subjectOfForwardMsg);
+			}
+		TPtrC recipientsAddress;	
+		if(GetStringFromConfig(ConfigSection(), KRecipientsAddress, recipientsAddress))
+			{
+			header->ToRecipients().AppendL(recipientsAddress);
+			}
+		else
+			{
+			GetDefaultAddressL();
+			header->ToRecipients().AppendL(*iRecipientAddress);
+			}
+		header->StoreL(*store);
+		store->CommitL();				// Saves the modifications to message store
+		TMsvEntry indexEntry = entry->Entry();
+		indexEntry.iDescription.Set(header->Subject());
+		INFO_PRINTF2(_L("Subject field of Forward message : %S"), &(indexEntry.iDescription));
+		indexEntry.SetVisible(ETrue);
+		entry->ChangeL(indexEntry);			// Modify the corresponding index entry permanently
+
+		CleanupStack::PopAndDestroy(3,entry);	//	header, store, 	entry
+		}
+	}
+
+
+/**
+  Function 		: GetDefaultAddressL
+  Description 	: Retrieve the default email address from the default SMTP service.
+  @return 		: N/A
+*/
+void CT_SmtpCreateForwadMessage::GetDefaultAddressL()
+	{
+	CImSmtpSettings* settings = new(ELeave) CImSmtpSettings();
+	CleanupStack::PushL(settings);
+
+	CEmailAccounts* accounts = CEmailAccounts::NewLC();
+	TSmtpAccount smtpAccount;
+	smtpAccount.iSmtpService = KMsvNullIndexEntryId;
+	accounts->DefaultSmtpAccountL(smtpAccount);
+	accounts->LoadSmtpSettingsL(smtpAccount, *settings);
+	CleanupStack::PopAndDestroy(accounts);					// accounts
+	iRecipientAddress = settings->EmailAddress().AllocL();
+	INFO_PRINTF2(_L("Default Email Address is %s"),iRecipientAddress->Ptr());
+	CleanupStack::PopAndDestroy(settings);					// settings
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_SmtpCreateNewMessageWithPlainBodyText.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,313 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// [TestStep Name]
+// SmtpCreateNewMessageWithPlainBodyText
+// [Paramaters]
+// Subject			:	Subject line of the message.
+// FolderName		:	Destination local folder where message is to be created.
+// RecipientsAddress:	Recepient's address.
+// EmailFileName	:	Plain text file name from which body text part would be populated. 
+// Creates a new message entry with plain body text. For creating the message entry it uses
+// CImEmailOperation::CreateNewL() static metod. After creating the message  entry
+// it populates the body part with the contents of a plain text file.
+// [APIs Used]
+// CImPlainBodyText::CommitL
+// CImPlainBodyText::StoreChunkL
+// CImEmailOperation::CreateNewL
+// CImEmailMessage::OpenPlainBodyTextForWriteL
+// 
+//
+
+
+
+// User includes 
+#include "t_smtpcreatenewmessagewithplainbodytext.h"
+#include <t_utilscentralrepository.h>
+#include <t_utilsenumconverter.h>
+#include <t_utils.h>
+
+// Epoc includes 
+#include <miutmsg.h>
+#include <cimplainbodytext.h>
+
+// Literals Used 
+_LIT(KSubject, "Subject");
+_LIT(KFolderName, "FolderName");
+_LIT(KEmailFileName, "EmailFileName");
+_LIT(KRecipientsAddress, "RecipientsAddress");
+
+const TInt KChunkSize = 1024;
+
+/**
+  Function 		: CT_SmtpCreateNewMessageWithPlainBodyText
+  Description 	: Constructor
+  @param 		: aSharedDataSMTP		Reference to CT_MsgSharedDataSmtp
+  @return 		: N/A
+*/
+CT_SmtpCreateNewMessageWithPlainBodyText::CT_SmtpCreateNewMessageWithPlainBodyText(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgAsyncStepSMTP(aSharedDataSMTP)
+,	iOperation(NULL)
+	{
+	SetTestStepName(KSmtpCreateNewMessageWithPlainBodyText);
+	}
+
+
+/**
+  Function 		: NewL
+  Description 	: Creates an object of CT_SmtpCreateNewMessageWithPlainBodyText 				 
+  @return 		: N/A
+*/
+CT_SmtpCreateNewMessageWithPlainBodyText* CT_SmtpCreateNewMessageWithPlainBodyText::NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+	{
+	CT_SmtpCreateNewMessageWithPlainBodyText* self = new(ELeave) CT_SmtpCreateNewMessageWithPlainBodyText(aSharedDataSMTP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 
+	CleanupStack::Pop(self);
+	return self;
+	}	
+
+	
+/**
+  Function 		: ~CT_SmtpCreateNewMessageWithPlainBodyText
+  Description 	: Destructor
+  @return 		: N/A
+*/
+CT_SmtpCreateNewMessageWithPlainBodyText::~CT_SmtpCreateNewMessageWithPlainBodyText()
+	{
+	delete iRecipientAddress;
+	delete iOperation;
+	}
+
+/**
+  Function 		: ProgressL
+  Description 	: Displays the status of the asynchronous operation
+  @return 		: N/A
+*/
+void CT_SmtpCreateNewMessageWithPlainBodyText::ProgressL(TBool /*bFinal*/)
+	{}
+
+
+/**
+  Function 		: CancelStep
+  Description 	: Cancels the asynchronous operation
+  @return 		: N/A
+*/
+void CT_SmtpCreateNewMessageWithPlainBodyText::CancelStep()
+	{
+	iOperation->Cancel();
+	}
+
+
+/**
+  Function 		: doTestStepL
+  Description 	: Reads the SMTP account name, folder names, download limts and the command name from 
+				  the ini file. A selection of the entries uner the remote folder is obtained and passed to 
+				  InvokeAsyncFunctionL based on the command.
+  @return 		: TVerdict - Test step result
+*/
+TVerdict CT_SmtpCreateNewMessageWithPlainBodyText::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep: SmtpCreateNewMessageWithPlainBodyText"));
+
+	// Read the name of the target folder from the ini file
+	TPtrC folderName;
+	if(!GetStringFromConfig( ConfigSection(), KFolderName, folderName))
+		{
+		ERR_PRINTF1(_L("Folder name is not specified"));
+		SetTestStepResult(EFail);
+		}
+
+	TMsvId folderId;
+	// Get the Id of the local folder
+	folderId= CT_MsgUtilsEnumConverter::FindFolderIdByName(folderName);
+	iSharedDataSMTP.iMtm->SwitchCurrentEntryL(folderId);
+	TImCreateMessageOptions createMessageOptions;
+	createMessageOptions.iMsvPartList = KMsvMessagePartBody;
+	createMessageOptions.iMessageType = KUidMsgTypeSMTP;
+	
+	TPckgBuf<TImCreateMessageOptions> paramPack(createMessageOptions);
+	
+	CT_MsgActive&	active=Active();
+	delete iOperation;
+	iOperation = NULL;
+	TRAPD(err2, iOperation = CImEmailOperation::CreateNewL(active.iStatus, *iSharedDataSMTP.iSession, folderId,KMsvNullIndexEntryId, paramPack().iMsvPartList, paramPack().iMsvEmailTypeList, paramPack().iMessageType, CActive::EPriorityStandard, ETrue));
+	active.Activate();
+	CActiveScheduler::Start();
+
+	SetHeaderPartL();
+	PopulateBodyPartL();
+	User::LeaveIfError(active.Result());
+	INFO_PRINTF2(_L("err2 : %d"), err2);
+	return TestStepResult();
+	}
+		
+
+/**
+  Function 		: PopulateBodyPartL
+  Description 	: Populates body part with the contents of a plain text file.
+  @return 		: N/A
+*/
+void CT_SmtpCreateNewMessageWithPlainBodyText::PopulateBodyPartL()
+	{
+	//Get the message ID from the CMsvOperation object
+	TMsvId temp;	
+	TPckgC<TMsvId> paramPack(temp);
+	const TDesC8& progBuf = iOperation->ProgressL();	
+	paramPack.Set(progBuf);
+	TMsvId newMessageId = paramPack();	
+	if (newMessageId!=NULL)
+		{
+		CMsvEntry *entry = CMsvEntry::NewL(*(iSharedDataSMTP.iSession), newMessageId, TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
+		CleanupStack::PushL(entry);
+		entry->SetEntryL(newMessageId);
+		CImEmailMessage *emailMessage = CImEmailMessage::NewLC(*entry);
+		CImPlainBodyText* bodytext = emailMessage->OpenPlainBodyTextForWriteL();
+		CleanupStack::PushL(bodytext);
+		
+
+		TPtrC emailFileName;	
+		// Read the name of the email file from the ini
+		if(!GetStringFromConfig(ConfigSection(),KEmailFileName,emailFileName))
+			{
+			ERR_PRINTF1(_L("Email file name not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			RFs	fs;
+			User::LeaveIfError(fs.Connect());
+			CleanupClosePushL(fs);
+
+			RFile	file;
+			User::LeaveIfError(file.Open(fs,emailFileName,EFileRead));
+			CleanupClosePushL(file);
+
+
+			TBuf8<KChunkSize> line;
+			TBuf8<1> aChar;				// To read one character from the file
+			TBool finished = FALSE;
+
+			// Read text from the file
+			do
+				{
+				line.FillZ();
+				line.SetLength(0);
+				// Read one line from email file
+				do 
+					{
+					file.Read(aChar, 1);
+					if(aChar.Length())
+						{
+						line.Append(aChar);
+						}
+					else
+						{
+						finished = TRUE;
+						}
+					}while(aChar.Length() && aChar[0] != 0x0A);
+				if(!line.Length())
+					{
+					break;
+					}
+				CT_MsgActive& active=Active();				
+				bodytext->StoreChunkL(line,active.iStatus);
+				active.Activate();
+				CActiveScheduler::Start();			
+				}while(!finished);
+				
+			CT_MsgActive& active=Active();	
+			bodytext->CommitL(active.iStatus);
+			active.Activate();
+			CActiveScheduler::Start();			
+			
+			CleanupStack::PopAndDestroy(2); // delete file,fs
+			}
+		CleanupStack::PopAndDestroy(3, entry); // delete bodytext,emailMessage,entry
+		}
+	}
+
+
+/**
+  Function 		: GetDefaultAddressL
+  Description 	: Retrieve the default email address from the default SMTP service.
+  @return 		: N/A
+*/
+void CT_SmtpCreateNewMessageWithPlainBodyText::GetDefaultAddressL()
+	{
+	CImSmtpSettings* settings = new(ELeave) CImSmtpSettings();
+	CleanupStack::PushL(settings);
+
+	CEmailAccounts* accounts = CEmailAccounts::NewLC();
+	TSmtpAccount smtpAccount;
+	smtpAccount.iSmtpService = KMsvNullIndexEntryId;
+	accounts->DefaultSmtpAccountL(smtpAccount);
+	accounts->LoadSmtpSettingsL(smtpAccount, *settings);
+	CleanupStack::PopAndDestroy(accounts);								// accounts
+	iRecipientAddress = settings->EmailAddress().AllocL();
+	INFO_PRINTF2(_L("Default Email Address is %s"),iRecipientAddress->Ptr());
+	CleanupStack::PopAndDestroy(settings);								// settings
+	}
+	
+	
+/**
+  Function 		: SetHeaderPartL
+  Description 	: Sets the message header fields. If the field values are not provided
+  				  as input, it takes the default values.
+  @return 		: N/A  				  
+*/
+void CT_SmtpCreateNewMessageWithPlainBodyText::SetHeaderPartL()
+	{
+	//check progress
+	TMsvId temp;	
+	TPckgC<TMsvId> paramPack(temp);
+	const TDesC8& progBuf = iOperation->ProgressL();	
+	paramPack.Set(progBuf);
+	TMsvId newMessageId = paramPack();	
+	if (newMessageId!=NULL)
+		{
+		CMsvEntry *entry = CMsvEntry::NewL(*(iSharedDataSMTP.iSession), newMessageId, TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
+		CleanupStack::PushL(entry);
+		entry->SetEntryL(newMessageId);			// 
+		CMsvStore* store = entry->EditStoreL();
+		CleanupStack::PushL(store);
+		
+		CImHeader* header = CImHeader::NewLC(); 
+		header->RestoreL(*store); // Retrieves the email message header part from the message store
+		TPtrC subject;
+		if(GetStringFromConfig(ConfigSection(), KSubject, subject))
+			{
+			header->SetSubjectL(subject);
+			}
+		TPtrC recipientsAddress;	
+		if(GetStringFromConfig(ConfigSection(), KRecipientsAddress, recipientsAddress))
+			{
+			header->ToRecipients().AppendL(recipientsAddress);
+			}
+		else
+			{
+			GetDefaultAddressL();
+			header->ToRecipients().AppendL(*iRecipientAddress);
+			}
+		header->StoreL(*store);
+		store->CommitL();				// Saves the modifications to message store
+		TMsvEntry indexEntry = entry->Entry();
+		indexEntry.iDescription.Set(header->Subject());
+		INFO_PRINTF2(_L("Subject field created message : %S"), &(indexEntry.iDescription));
+		indexEntry.SetVisible(ETrue);
+		entry->ChangeL(indexEntry);			// Modify the corresponding index entry permanently
+
+		CleanupStack::PopAndDestroy(3,entry);				// 	header, store, 	entry
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_SmtpCreateReplyMessage.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,325 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// [TestStep Name]
+// SmtpCreateReplyMessage
+// [Paramaters]
+// ServiceType		:	Specifies the service type(IMAP or POP) under which message exists.
+// FolderName		:	Destination local folder where message is to be created.
+// ImapAccountName	:	If service type is IMAP4, specify the IMAP account name that holds the
+// message.
+// ParentFolderName:	IMAP4 folder name that holds the message.
+// PopAccountName	:	If the the sevice type is POP3, specify POP account name.
+// CommandName		:	SMTP client MTM command used to create the Reply message.
+// FolderName		:	Destination local folder in which message would be storted.
+// SubjectOfExistingMsg: Sbject line of the existing message to which reply message
+// would be creted.
+// SubjectOfReplyMsg:	Specifies the subject line to be set for the reply message.
+// This is an optional parameter and if not specified the subject line
+// would take the default format(Re: <SubjectOfExistingMsg>).
+// Creates a reply message using the message that exists under remote service. Remote service
+// can be of type IMAP4 or POP3.
+// [APIs Used]
+// 
+//
+
+
+
+// User includes 
+#include "T_SmtpCreateReplyMessage.h"
+#include <t_utilscentralrepository.h>
+#include <t_utilsenumconverter.h>
+#include <t_utils.h>
+
+
+// Epoc includes 
+#include <miutmsg.h>
+
+
+// Literals Used 
+_LIT(KServiceType, "ServiceType");
+
+_LIT(KImapAccountName,"ImapAccountName");
+_LIT(KParentFolderName,"ParentFolderName");
+
+_LIT(KPopAccountName,"PopAccountName");
+
+_LIT(KCommandName,"CommandName");
+_LIT(KFolderName, "FolderName");
+_LIT(KSubjectOfExistingMsg,"SubjectOfExistingMsg");
+
+_LIT(KSubjectOfReplyMsg, "SubjectOfReplyMsg");
+
+const TInt KZero={0};
+/**
+  Function 		: CT_SmtpCreateReplyMessage
+  Description 	: Constructor
+  @param 		: aSharedDataSMTP		Reference to CT_MsgSharedDataSmtp
+  @return 		: N/A
+*/
+CT_SmtpCreateReplyMessage::CT_SmtpCreateReplyMessage(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgAsyncStepSMTP(aSharedDataSMTP)
+,	iOperation(NULL)
+	{
+	SetTestStepName(KSmtpCreateReplyMessage);
+	}
+
+
+/**
+  Function 		: NewL
+  Description 	: Creates an object of CT_SmtpCreateReplyMessage 				 
+  @return 		: N/A
+*/
+CT_SmtpCreateReplyMessage* CT_SmtpCreateReplyMessage::NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+	{
+	CT_SmtpCreateReplyMessage* self = new(ELeave) CT_SmtpCreateReplyMessage(aSharedDataSMTP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 
+	CleanupStack::Pop(self);
+	return self;
+	}	
+
+	
+/**
+  Function 		: ~CT_SmtpCreateReplyMessage
+  Description 	: Destructor
+  @return 		: N/A
+*/
+CT_SmtpCreateReplyMessage::~CT_SmtpCreateReplyMessage()
+	{
+	delete iOperation;
+	iOperation = NULL;
+	}
+
+/**
+  Function 		: ProgressL
+  Description 	: Displays the status of the asynchronous operation
+  @return 		: N/A
+*/
+void CT_SmtpCreateReplyMessage::ProgressL(TBool /*bFinal*/)
+	{}
+
+
+/**
+  Function 		: CancelStep
+  Description 	: Cancels the asynchronous operation
+  @return 		: N/A
+*/
+void CT_SmtpCreateReplyMessage::CancelStep()
+	{
+	iOperation->Cancel();
+	}
+
+
+/**
+  Function 		: doTestStepL
+  Description 	: Creates a Reply message for an existing message. Existing message
+  				  may be under some remot folder under IMAP service or under POP service.
+  @return 		: TVerdict - Test step result
+*/
+TVerdict CT_SmtpCreateReplyMessage::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep: SmtpCreateReplyMessage"));
+	TMsvId	entryToBesearched = KMsvNullIndexEntryId;
+	TPtrC serviceType;
+	if(!GetStringFromConfig( ConfigSection(), KServiceType, serviceType))
+		{
+		ERR_PRINTF1(_L("Service type for the message is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TBuf<4> temp(serviceType);
+		temp.UpperCase();						// Makes case insensitive
+		// Perform the following if message has been downloaded using IMAP4 service
+		if(temp.CompareC(_L("IMAP")) == KZero)
+			{
+			// Read the IMAP account name from the ini file
+			TPtrC imapAccountName;
+			if(!GetStringFromConfig( ConfigSection(), KImapAccountName, imapAccountName))
+				{
+				ERR_PRINTF1(_L("ImapAccount Name is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				TPtrC	parentFolderName;
+				if(!GetStringFromConfig( ConfigSection(), KParentFolderName, parentFolderName))
+					{
+					ERR_PRINTF1(_L("Parent Folder is not specified"));
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					
+					// retrieves the folder Id based on the remote service folder name read from the ini file
+					entryToBesearched = CT_MsgUtils::GetRemoteFolderIdByNameL(iSharedDataSMTP.iSession, imapAccountName, parentFolderName);
+					if( entryToBesearched == KErrNotFound)
+						{
+						ERR_PRINTF1(_L("Invalid Remote folder name specified"));
+						SetTestStepResult(EFail);
+						}
+					else
+						{
+						INFO_PRINTF2(_L("The parent folder Id is %d"),entryToBesearched );
+						}
+					}
+				}
+			}
+		// Perform the following if message has been downloaded using POP3 service 	
+		else if(temp.CompareC(_L("POP")) == KZero)
+			{
+			TPtrC popAccountName;
+			if(!GetStringFromConfig( ConfigSection(), KPopAccountName, popAccountName))
+				{
+				ERR_PRINTF1(_L("PopAccount Name is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				// Retrieves the Pop service Id for the given Pop account
+				entryToBesearched = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
+				INFO_PRINTF2(_L("Pop service id is %d"), entryToBesearched);
+
+				// Fails the test step if an invalid POP account is specified 
+				if(entryToBesearched == KMsvNullIndexEntryId)
+					{
+					ERR_PRINTF1(_L("Invalid POP account name specified"));
+					SetTestStepResult(EFail);
+					}
+				}
+			}
+		else
+			{
+			ERR_PRINTF1(_L("Sevice Type is not specified: It should be IMAP or POP"));
+			SetTestStepResult(EFail);
+			}
+		}
+		
+	if(TestStepResult() == EPass)
+		{
+		TPtrC commandName;
+		if(!GetStringFromConfig( ConfigSection(), KCommandName, commandName))
+			{
+			ERR_PRINTF1(_L("Command name is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			// Read the name of the target folder from the ini file
+			TPtrC folderName;
+			if(!GetStringFromConfig( ConfigSection(), KFolderName, folderName))
+				{
+				ERR_PRINTF1(_L("Folder name is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				TPtrC subjectOfExistingMsg;	
+				if( !GetStringFromConfig(ConfigSection(), KSubjectOfExistingMsg, subjectOfExistingMsg))
+					{
+					ERR_PRINTF1(_L("The subject of the message is not specified"));
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					// Retrieves the message Id based on the message subject from the given remote service folder
+					TMsvId messageId;
+					messageId = CT_MsgUtils::SearchMessageBySubjectL(iSharedDataSMTP.iSession, entryToBesearched, subjectOfExistingMsg, ETrue);
+					if( messageId == KMsvNullIndexEntryId)
+						{
+						ERR_PRINTF1(_L("The given message is not found"));
+						SetTestStepResult(EFail);
+						}
+					else
+						{
+						TMsvId folderId;
+						folderId = CT_MsgUtilsEnumConverter::FindFolderIdByName(folderName);
+						
+						// Interpret the SMTP client MTM command to be executed 
+						TSmtpCmds commandId = CT_MsgUtilsEnumConverter::ConvertDesToTSmtpCmdsL((TDesC&) commandName);									
+
+						CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+						CleanupStack::PushL(selection);
+									
+						selection->AppendL(folderId);
+						selection->AppendL(messageId);
+
+						TImCreateMessageOptions createMessageOptions;
+						createMessageOptions.iMsvPartList = KMsvMessagePartBody;
+						createMessageOptions.iMessageType = KUidMsgTypeSMTP;
+						createMessageOptions.iMsvEmailTypeList = 0;
+
+						TPckgBuf<TImCreateMessageOptions> paramPack(createMessageOptions);
+						
+						CT_MsgActive&	active=Active();
+						delete iOperation;
+						iOperation = NULL;
+						TRAPD(err2,iOperation = iSharedDataSMTP.iMtm->InvokeAsyncFunctionL(commandId,*selection,paramPack,active.iStatus));
+						active.Activate();
+						CActiveScheduler::Start();
+						SetHeaderPartL();
+
+						User::LeaveIfError(active.Result());
+						INFO_PRINTF2(_L("err2 : %d"), err2);
+						CleanupStack::PopAndDestroy(selection); // selection
+						}
+					}
+				}
+			}
+		}
+	return TestStepResult();
+	}
+
+
+/**
+  Function 		: SetHeaderPartL
+  Description 	: Sets the message header fields. If the field values are not provided
+  				  as input, it takes the default values.
+  @return 		: N/A  				  
+*/
+void CT_SmtpCreateReplyMessage::SetHeaderPartL()
+	{
+	//Get the message ID from the CMsvOperation object
+	TMsvId temp;	
+	TPckgC<TMsvId> paramPack(temp);
+	const TDesC8& progBuf = iOperation->ProgressL();	
+	paramPack.Set(progBuf);
+	TMsvId newMessageId = paramPack();	
+	if (newMessageId!=NULL)
+		{
+		CMsvEntry *entry = CMsvEntry::NewL(*(iSharedDataSMTP.iSession), newMessageId, TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
+		CleanupStack::PushL(entry);
+		entry->SetEntryL(newMessageId);			// 
+		CMsvStore* store = entry->EditStoreL();
+		CleanupStack::PushL(store);
+		
+		CImHeader* header = CImHeader::NewLC(); 
+		header->RestoreL(*store); // Retrieves the email message header part from the message store
+		TPtrC subjectOfReplyMsg;
+		if(GetStringFromConfig(ConfigSection(), KSubjectOfReplyMsg, subjectOfReplyMsg))
+			{
+			header->SetSubjectL(subjectOfReplyMsg);
+			}
+		header->StoreL(*store);
+		store->CommitL();				// Saves the modifications to message store
+		TMsvEntry indexEntry = entry->Entry();
+		indexEntry.iDescription.Set(header->Subject());
+		INFO_PRINTF2(_L("Subject field of Reply message : %S"), &(indexEntry.iDescription));
+		indexEntry.SetVisible(ETrue);
+		entry->ChangeL(indexEntry);			// Modify the corresponding index entry permanently
+
+		CleanupStack::PopAndDestroy(3,entry); // header, store, entry			
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_SmtpSendEmail.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,207 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// [TestStep Name]
+// SmtpSendEmail
+// [Parameters]
+// sender			:	User name of email sender
+// recipient		:	User name of email recipient
+// mailFile		:	Path of the meta data file to check
+// serverIP 		:	IP address of SMTP server
+// This test step will send an email from <sender> to <recipient> with the contents
+// of <mailfile> as message body using the SMTP server specified by <serverIP>.
+// [APIs Used]
+// RFile::Open
+// RFile::Read
+// CImTextServerSession::QueueConnectL
+// CImTextServerSession::Send
+// CImTextServerSession::QueueReceiveNextTextLine
+// CImTextServerSession::GetCurrentTextLine
+// CImTextServerSession::Disconnect
+// CImIAPPreferences::NewLC
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+//User includes
+#include <t_utilsconfigfilemachinename.h>
+#include "T_UtilsSendEmail.h"
+#include "T_SmtpSendEmail.h"
+
+
+// Literals Used
+_LIT(KSender,"Sender");
+_LIT(KRecipient,"Recipient");
+_LIT(KMailFile,"MailFile");
+_LIT(KServerIP,"ServerIP");
+
+
+/**
+CT_MsgSmtpSendEmail()
+Constructor
+
+@param aSharedDataSMTP
+*/
+CT_MsgSmtpSendEmail::CT_MsgSmtpSendEmail(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:	CT_MsgAsyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KSmtpSendEmail);
+	}
+
+/**
+NewL()
+Static factory constructor. Uses two phase 
+construction.
+
+@param aSharedDataSMTP
+@leave KErrNoMemory
+@return
+A pointer to the newly created CT_MsgSendSmtpMessage object.
+*/
+CT_MsgSmtpSendEmail* CT_MsgSmtpSendEmail::NewL(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+	{
+	CT_MsgSmtpSendEmail* self = new(ELeave) CT_MsgSmtpSendEmail(aSharedDataSMTP);
+	CleanupStack::PushL(self);
+	self->ConstructL(); 					 // Call CT_AsyncStep::ConstructL()
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+
+/**
+~CT_MsgSmtpSendEmail()
+Destructor
+*/
+CT_MsgSmtpSendEmail::~CT_MsgSmtpSendEmail()
+	{
+	if(iSendEmail!=NULL)
+		{
+		delete iSendEmail;
+		iSendEmail = NULL;	
+		}
+
+	if(iMachineNameFile!=NULL)
+		{
+		delete iMachineNameFile;
+		iMachineNameFile = NULL;
+		}
+	}
+
+
+/**
+ProgressL()
+
+*/
+void CT_MsgSmtpSendEmail::ProgressL(TBool bFinal)
+	{
+	//	TODO
+	if ( bFinal )
+		{
+		//	Display final progress iSendEmail
+		}
+	else
+		{
+		//	Display current progress iSendEmail
+		}
+	}
+
+/**
+CancelStep()
+
+*/
+void CT_MsgSmtpSendEmail::CancelStep()
+	{
+	//	TODO cancel iSendEmail
+	}
+
+	
+/**
+doTestStepL()
+Reads the parent folder name, the message subject from the ini file
+Searches for the message under the specified folder, and sends the message
+
+@return
+Returns the test step result
+*/
+TVerdict CT_MsgSmtpSendEmail::doTestStepL()
+	{
+	INFO_PRINTF1( _L("Test Step :  Smtp Send Email") );
+	TPtrC8	string8Ptr; 
+	TPtrC	stringPtr = KNone();
+	// Gets the machine name of the system
+	if(iMachineNameFile==NULL)
+	{
+	iMachineNameFile = CT_MsgUtilsConfigFileMachineName::NewL(stringPtr);
+	}
+
+	TPtrC8	machineName(iMachineNameFile->MachineName());
+
+	// Read the username of the email sender from the ini file
+	TPtrC	sender;
+	if(!GetStringFromConfig( ConfigSection(), KSender, sender))
+		{
+		ERR_PRINTF1(_L("Sender is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		// Read the username of the email recipient from the ini file
+		TPtrC	recipient;
+		if( !GetStringFromConfig(ConfigSection(),KRecipient,recipient ))
+			{
+			ERR_PRINTF1(_L("Recipient is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			// Read the path of the mailfile from the ini file
+			TPtrC	mailFile;
+			if( !GetStringFromConfig(ConfigSection(),KMailFile,mailFile ))
+				{
+				ERR_PRINTF1(_L("MailFile is not specified"));
+				SetTestStepResult(EFail);
+				}
+			else
+				{
+				// Read the server IP address from the ini file
+				TPtrC	serverIP;
+				if( !GetStringFromConfig(ConfigSection(),KServerIP,serverIP ))
+					{
+					ERR_PRINTF1(_L("ServerIP is not specified"));
+					SetTestStepResult(EFail);
+					}
+				else
+					{
+					if(iSendEmail==NULL)
+						{
+						iSendEmail = CT_MsgUtilsSendEmail::NewL(*this);
+						}
+
+					CT_MsgActive&	active=Active();
+					iSendEmail->StartL(sender,recipient,mailFile,serverIP, active.iStatus);
+					active.Activate();
+					CActiveScheduler::Start();
+					User::LeaveIfError(active.Result());
+					}
+				}
+			}
+		}
+
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_SmtpServer.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,222 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+// User includes
+#include "T_MsgServer.h"
+#include "T_SmtpServer.h"
+#include "T_MsgSharedDataSmtp.h"
+
+// Header files of Test Steps SMTP
+#include "T_CreateSmtpMessageFromEmailFile.h"
+#include "T_SendSmtpMessage.h"
+#include "T_SmtpSendEmail.h"
+#include "T_StartRamUsageTimer.h"
+#include "T_StopRamUsageTimer.h"
+#include "t_smtpcreatenewmessagewithplainbodytext.h"
+#include "T_SmtpCreateForwardMessage.h"
+#include "T_SmtpCreateReplyMessage.h"
+#include "T_RetrievePlainBodyTextAndCompare.h"
+#include "T_CreateSmtpMobilityAccount.h"
+#include "T_CreateSmtpAccount.h"
+#include "T_CheckSmtpSNAPSetting.h"
+#include "T_ModifySmtpSettings.h"
+#include "T_RemoveSmtpSNAPSetting.h"
+#include "T_CheckSmtpBMSetting.h"
+
+/**
+MainL()
+This is the main function which installs the 
+active scheduler and creates an object of the Email server
+*/
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+	{
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().SecureApi(RProcess::ESecureApiOn);
+
+	CActiveScheduler*	sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CT_MsgSmtpServer* server = NULL;
+
+	// Create the CTestServer derived Email server
+	TRAPD(err, server = CT_MsgSmtpServer::NewL());
+	if ( err == KErrNone )
+		{
+		// Sync with the client and enter the active scheduler
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+	delete server;
+	server=NULL;
+	delete sched;
+	sched=NULL;
+	}
+
+
+/**
+E32Main()
+This function is the entry point for T_MsgSmtpServer test server
+
+@return - Standard Epoc error code on process exit
+Secure variant only
+Process entry point. Called by client using RProcess API
+*/
+GLDEF_C TInt E32Main()
+	{
+	__UHEAP_MARK;
+	
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());	
+	delete cleanup;
+	cleanup=NULL;
+	__UHEAP_MARKEND;
+	
+	return KErrNone;
+    }
+    
+
+
+/**
+NewL()
+Static factory constructor. Uses two phase 
+construction.
+
+@leave KErrNoMemory
+@return
+A pointer to the newly created CT_MsgSmtpServer object.
+*/
+CT_MsgSmtpServer* CT_MsgSmtpServer::NewL()
+	{
+	CT_MsgSmtpServer* server=new(ELeave) CT_MsgSmtpServer();
+	CleanupStack::PushL(server);
+//	server->StartL(KSmtpServer);
+	server->ConstructL(KSmtpServer);
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+
+/**
+CT_MsgSmtpServer()
+Constructor
+*/
+CT_MsgSmtpServer::CT_MsgSmtpServer()
+:	iSharedDataSMTP(NULL)
+	{
+	}
+
+
+/**
+CreateSharedDataL()
+Creates an object of Shared Data
+
+@return
+Returns a CT_MsgSharedDataBase object that would be shared across
+the test steps creted by the T_MsgSmtpServer test server.
+*/
+CT_MsgSharedDataBase* CT_MsgSmtpServer::NewSharedDataL()
+	{
+	return iSharedDataSMTP = CT_MsgSharedDataSmtp::NewL();
+	}
+		
+			
+/**
+CreateTestStep()
+Creates the test steps based on the name read from the script file
+
+@param	aStepName
+The name of the test step to be created
+
+@return
+The CTestStep object created
+*/ 
+CTestStep* CT_MsgSmtpServer::CreateTestStepL(const TDesC& aStepName)
+	{
+	CTestStep* testStep = NULL;
+
+	 if(aStepName == KCreateSmtpMessageFromEmailFile)
+		{
+		 testStep = CT_MsgCreateSmtpMessageFromEmailFile::NewL(*iSharedDataSMTP);
+		}
+	else if(aStepName == KSendSmtpMessage)
+		{
+		testStep = CT_MsgSendSmtpMessage::NewL(*iSharedDataSMTP);
+		}
+	else if(aStepName == KSmtpSendEmail)
+		{
+		testStep = CT_MsgSmtpSendEmail::NewL(*iSharedDataSMTP);
+		}
+	else if(aStepName == KStartRamUsageTimer)
+		{
+		testStep = new(ELeave) CT_StartRamUsageTimer(*iSharedDataSMTP);
+		}
+	else if(aStepName == KStopRamUsageTimer)
+		{
+		testStep = new(ELeave) CT_StopRamUsageTimer(*iSharedDataSMTP);
+		}
+	else if(aStepName == KSmtpCreateNewMessageWithPlainBodyText)
+		{
+		testStep = CT_SmtpCreateNewMessageWithPlainBodyText::NewL(*iSharedDataSMTP);
+		}
+	else if(aStepName == KSmtpCreateForwadMessage)
+		{
+		testStep = CT_SmtpCreateForwadMessage::NewL(*iSharedDataSMTP);
+		}
+	else if(aStepName == KSmtpCreateReplyMessage)
+		{
+		testStep = CT_SmtpCreateReplyMessage::NewL(*iSharedDataSMTP);
+		}
+	else if(aStepName == KRetrievePlainBodyTextAndCompare)
+		{
+		testStep = CT_RetrievePlainBodyTextAndCompare::NewL(*iSharedDataSMTP);
+		}
+	else if(aStepName == KCreateSmtpMobilityAccount)
+		{
+		testStep = CT_MsgCreateSmtpMobilityAccount::NewL(*iSharedDataSMTP);
+		}
+	else if(aStepName == KCreateSmtpAccount)
+		{
+		testStep = new(ELeave) CT_MsgCreateSmtpAccount(*iSharedDataSMTP);
+		}
+	else if(aStepName == KCheckSmtpSNAPSetting)
+		{
+		testStep = new(ELeave) CT_MsgCheckSmtpSNAPSetting(*iSharedDataSMTP);
+		}
+	else if(aStepName == KModifySmtpSettings)
+		{
+		testStep = new(ELeave) CT_MsgModifySmtpSettings(*iSharedDataSMTP);
+		}
+	else if(aStepName == KRemoveSmtpSNAPSetting)
+		{
+		testStep = new(ELeave) CT_MsgRemoveSmtpSNAPSetting(*iSharedDataSMTP);
+		}
+	else if(aStepName == KCheckSmtpBMSetting)
+		{
+		testStep = new(ELeave) CT_MsgCheckSmtpBMSetting(*iSharedDataSMTP);
+		}
+	else
+		{
+		testStep = CT_MsgServer::CreateTestStepL(aStepName);
+		}
+	return testStep;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_StartRamUsageTimer.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,148 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// [TestStep Name]
+// StartRamUsageTimer
+// [Paramaters]
+// IntervalTimeInMicroSecs			<input>	: The interval between events generated
+// after the initial delay, in microseconds
+// Starts periodical measurement of RAM memory used and updates the information kept
+// in SMTP testserver.
+// [APIs Used]
+// 
+//
+
+
+
+// User includes 
+#include "T_StartRamUsageTimer.h"
+#include "T_MsgSharedDataSmtp.h"
+
+// Epoc includes
+#include <hal.h>
+#include <hal_data.h>
+
+// Literals used
+_LIT(KIntervalTimeInMicroSecs, "IntervalTimeInMicroSecs");
+
+/**
+  Function 		: CT_StartRamUsageTimer
+  Description 	: Constructor
+  @return 		: none
+*/
+CT_StartRamUsageTimer::CT_StartRamUsageTimer(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:CT_MsgAsyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KStartRamUsageTimer);
+	}
+
+/**
+  Function 		: ~CT_StartRamUsageTimer
+  Description 	: Destructor
+  @return 		: N/A
+*/
+CT_StartRamUsageTimer::~CT_StartRamUsageTimer()
+	{}
+	
+
+/**
+  Function 		: doTestStepL
+  Description 	: Generate a periodic Timer event and handle the RAM usage callback function
+  @return 		: TVerdict Test result
+*/
+TVerdict CT_StartRamUsageTimer::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep :StartRamUsageTimer"));
+	TInt intervalTime = 0;	
+	if(!GetIntFromConfig(ConfigSection(),KIntervalTimeInMicroSecs,intervalTime))
+		{
+		ERR_PRINTF1(_L("Interval time is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		iSharedDataSMTP.iPeriodic->Start(intervalTime, intervalTime, TCallBack(RamUsage,this));
+		}
+	return TestStepResult();	
+	}
+
+/**
+  Function 		: RamUsage
+  Description 	: Call non-static method DoRamUsage
+  @return 		: TInt
+*/
+TInt CT_StartRamUsageTimer::RamUsage(TAny* aObject)
+	{
+	// Cast, and call non-static function
+	((CT_StartRamUsageTimer *)aObject)->DoRamUsage();	
+	return 1;	
+	}
+
+/**
+  Function 		: DoRamUsage
+  Description 	: Calculate the RAM usage value and percentage at a particular instance 
+  @return 		: void
+*/	
+void CT_StartRamUsageTimer::DoRamUsage()
+	{
+	
+	TInt fullRamValue;
+	TInt ramFreeValue;
+	
+	HAL 	data;
+	HALData haldata;
+	
+	data.Get(haldata.EMemoryRAM, fullRamValue);
+	data.Get(haldata.EMemoryRAMFree, ramFreeValue);	
+	
+	TInt ramUsage = ((fullRamValue - ramFreeValue)/(1024));
+	
+	if ( iSharedDataSMTP.iMark != EFalse )
+		{
+		iSharedDataSMTP.iStartRamValue = ramUsage;
+		iSharedDataSMTP.iMinRamValue = ramUsage;
+		iSharedDataSMTP.iMaxRamValue = ramUsage;
+		iSharedDataSMTP.iMark = EFalse;
+		}
+	
+	if ( iSharedDataSMTP.iMinRamValue > ramUsage )
+		{
+		iSharedDataSMTP.iMinRamValue = ramUsage;
+		}
+		
+	if ( iSharedDataSMTP.iMaxRamValue < ramUsage )
+		{
+		iSharedDataSMTP.iMaxRamValue = ramUsage;
+		}
+	
+	iSharedDataSMTP.iEndRamValue = ramUsage;
+	}
+	
+
+	
+/**
+  Function 		: ProgressL
+  Description 	: Displays the progress information of the asynchronous operation
+  @return 		: void
+*/
+void CT_StartRamUsageTimer::ProgressL(TBool /*aFinal*/)
+	{}
+
+/**
+  Function 		: CancelStep
+  Description 	: Cancels the asynchronous operation
+  @return 		: void
+*/
+void CT_StartRamUsageTimer::CancelStep()
+	{}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_StopRamUsageTimer.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,129 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// [TestStep Name]
+// StopRamUsageTimer
+// [Paramaters]
+// EventStartCode			<input>	: Start event code which maps to the RAM usage value
+// when tacking of RAM usage got started.
+// EventStopCode			<input> : Stop event code which maps to the RAM usage value
+// when tacking of RAM usage got stopped.
+// Stops periodical measurement of RAM memory used and logs the RAM usage information
+// [APIs Used]
+// 
+//
+
+
+
+// User includes
+#include "T_StopRamUsageTimer.h"
+#include <t_utilsenumconverter.h>
+#include <t_testinstrumentation.h>
+
+
+// Literals used
+_LIT(KEventStartCode, "EventStartCode");
+_LIT(KEventStopCode, "EventStopCode");
+
+
+/**
+  Function 		: CT_StopRamUsageTimer
+  Description 	: Constructor
+  @return 		: none
+*/
+CT_StopRamUsageTimer::CT_StopRamUsageTimer(CT_MsgSharedDataSmtp& aSharedDataSMTP)
+:CT_MsgAsyncStepSMTP(aSharedDataSMTP)
+	{
+	SetTestStepName(KStopRamUsageTimer);
+	}
+	
+/**
+  Function 		: ~CT_StopRamUsageTimer
+  Description 	: Destructor
+  @return 		: N/A
+*/
+CT_StopRamUsageTimer::~CT_StopRamUsageTimer()
+	{}
+	
+
+/**
+  Function 		: doTestStepL
+  Description 	: Stop the periodic Timer
+  @return 		: TVerdict Test result
+*/
+TVerdict CT_StopRamUsageTimer::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep :StopRamUsageTimer"));
+	TPtrC startCodeFromIni;
+	if(!GetStringFromConfig(ConfigSection(), KEventStartCode, startCodeFromIni))
+		{
+		ERR_PRINTF1(_L("Event Start code is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+		TInstrumentationPoint starteventcode = CT_MsgUtilsEnumConverter::ConvertDesToEventCode(startCodeFromIni);
+		
+		TPtrC stopCodeFromIni;
+		if(!GetStringFromConfig(ConfigSection(), KEventStopCode, stopCodeFromIni))
+			{
+			ERR_PRINTF1(_L("Event Stop code is not specified"));
+			SetTestStepResult(EFail);
+			}
+		else
+			{
+			TInstrumentationPoint stopeventcode = CT_MsgUtilsEnumConverter::ConvertDesToEventCode(stopCodeFromIni);
+			iSharedDataSMTP.iPeriodic->Cancel();
+			
+			INFO_PRINTF2(_L("Minimum Ram usage value is %d KB "), iSharedDataSMTP.iMinRamValue);
+			INFO_PRINTF2(_L("Maximum Ram usage value is %d KB "), iSharedDataSMTP.iMaxRamValue);
+			INFO_PRINTF2(_L("Start Ram usage value is %d KB "), iSharedDataSMTP.iStartRamValue);
+			INFO_PRINTF2(_L("End Ram usage value is %d KB "), iSharedDataSMTP.iEndRamValue);
+
+			TInt maxRamUsage = ( iSharedDataSMTP.iMaxRamValue - iSharedDataSMTP.iStartRamValue );
+			TInt extremeRamUsage = ( iSharedDataSMTP.iMaxRamValue - iSharedDataSMTP.iMinRamValue );
+			TInt actualRamUsage = ( iSharedDataSMTP.iEndRamValue - iSharedDataSMTP.iStartRamValue );
+			
+			INFO_PRINTF2(_L("Maximum(Mx-St) Ram usage diff value is %d KB "), maxRamUsage );
+			INFO_PRINTF2(_L("Extreme(Mx-Mn) Ram usage diff value is %d KB "), extremeRamUsage );
+			INFO_PRINTF2(_L("Actual(En-St) Ram usage diff value is %d KB "), actualRamUsage );
+			if( starteventcode || stopeventcode )
+				{
+				INFO_PRINTF5(_L("EVENT_LOG_INFORMATION,%d,%d,%d,%d"),0,0,starteventcode,iSharedDataSMTP.iStartRamValue);
+				INFO_PRINTF5(_L("EVENT_LOG_INFORMATION,%d,%d,%d,%d"),0,0,stopeventcode,iSharedDataSMTP.iMaxRamValue);
+				}
+			else
+				{
+				ERR_PRINTF1(_L("**ERROR**: Bad Event code. Check t_testinstrumentation.h for valid event code"));					
+				}	
+			}		
+		}
+	return TestStepResult();
+	}
+
+/**
+  Function 		: ProgressL
+  Description 	: Displays the progress information of the asynchronous operation
+  @return 		: void
+*/
+void CT_StopRamUsageTimer::ProgressL(TBool /*aFinal*/)
+	{}
+
+/**
+  Function 		: CancelStep
+  Description 	: Cancels the asynchronous operation
+  @return 		: void
+*/
+void CT_StopRamUsageTimer::CancelStep()
+	{}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/email/smtp/src/T_UtilsSendEmail.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,402 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgUtilsSendEmail
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User includes
+#include "T_UtilsSendEmail.h"
+
+
+// epoc includes
+#include <iapprefs.h>
+
+
+// Literals for the Smtp commands
+_LIT8(KHeloString, "HELO\r\n");
+_LIT8(KMailFrom, "MAIL FROM:");
+_LIT8(KRcptTo, "RCPT TO:");
+_LIT8(KDataString, "DATA\r\n");
+_LIT8(KEndData, "\r\n.\r\n");
+_LIT8(KQuitString, "QUIT\r\n");
+_LIT8(KCrlfString, "\r\n");
+
+
+/**
+NewL()
+Static factory constructor. Uses two phase 
+construction.
+
+@param aTestStep
+@leave KErrNoMemory
+@return
+A pointer to the newly created CT_MsgUtilsSendEmail object.
+*/
+CT_MsgUtilsSendEmail* CT_MsgUtilsSendEmail::NewL(CTestStep& aTestStep)
+   {
+	CT_MsgUtilsSendEmail* self = new (ELeave) CT_MsgUtilsSendEmail(aTestStep);
+	return self;
+	}
+
+
+/**
+CT_MsgUtilsSendEmail()
+Constructor
+
+@param aTestStep
+*/
+CT_MsgUtilsSendEmail::CT_MsgUtilsSendEmail(CTestStep& aTestStep)
+:	CActive(EPriorityStandard),iTestStep(aTestStep)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+
+/**
+~CT_MsgUtilsSendEmail()
+Destructor
+*/
+CT_MsgUtilsSendEmail::~CT_MsgUtilsSendEmail()
+	{
+	iFile.Close();
+	iFs.Close();
+	delete iImSocket;
+	iImSocket=NULL;
+	delete iIapPrefs;
+	iIapPrefs=NULL;
+	}
+
+
+/**
+StartL()
+Deletes the children entries of the specified parent
+
+@param aSender
+@param aReceipient
+@param aMailFile
+@param aServerIP
+@param aStatus
+*/
+void CT_MsgUtilsSendEmail::StartL(TPtrC aSender,TPtrC aReceipient,TPtrC aMailFile,
+											TPtrC aServerIP,TRequestStatus& aStatus)
+	{
+	iRequestStatus = &aStatus;
+	aStatus = KRequestPending;
+	
+	iSender.Set(aSender);
+	iReceipient.Set(aReceipient);
+	
+	// Connects the client to the file server.
+	iFs.Connect();
+
+	// Opens an existing file reading and a share mode 
+	// If the file does not already exist, an error is returned.
+	iFile.Open(iFs, (TDesC&)aMailFile, EFileShareAny|EFileRead);
+
+	// Uses two phase construction and leaves nothing on the CleanupStack
+	iImSocket = CImTextServerSession::NewL();
+
+	iIapPrefs = CImIAPPreferences::NewLC();
+	CleanupStack::Pop();
+
+	// Queue a connect assuming the socket is successfully opened.
+	iImSocket->QueueConnectL(iStatus, (TDesC&)aServerIP, 25, *iIapPrefs, ETrue);
+	
+	iSendState = ESmtpConnecting;
+	SetActive();
+	}
+
+	
+/**
+DoCancel()
+CActive derived function to handle Cancel requests
+*/
+void CT_MsgUtilsSendEmail::DoCancel()
+	{
+	iImSocket->Cancel();
+	}
+
+
+/**
+RunL()
+CActive derived function to handle the state machine
+
+@panic Unkown receive state!
+@panic Unkown send state!
+*/
+void CT_MsgUtilsSendEmail::RunL()
+	{
+	// handle send state
+	switch (iSendState)
+		{
+		case ESmtpNotConnected:
+			{
+			// Send completed.
+			User::RequestComplete(iRequestStatus,KErrNone);
+			break;
+			}
+		case ESmtpConnecting:
+			{	
+			// Connection attempt completed.
+			if (iStatus != KErrNone)
+				{
+				// error
+				iTestStep.ERR_PRINTF2(_L("CT_MsgUtilsSendEmail: failed to connect: [%d]."), iStatus.Int());
+				iTestStep.SetTestStepResult(EFail);
+				User::Leave(iStatus.Int());
+				}
+			
+				// ok successful connect, next send HELO
+				iSendState = ESmtpSendHELO;
+				iImSocket->Send(iStatus, KHeloString());
+				SetActive();
+				break;
+			}
+		case ESmtpSendHELO:
+			{	
+			// HELO was sent
+			if (iStatus != KErrNone)
+				{
+				// error
+				iTestStep.ERR_PRINTF2(_L("CT_MsgUtilsSendEmail: failed to send HELO: [%d]."), iStatus.Int());
+				iTestStep.SetTestStepResult(EFail);
+				User::Leave(iStatus.Int());
+				}
+			
+				// ok we sent HELO, now receive reply
+				iSendState = ESmtpReceiveReply;
+				iRecvState = ESmtpHeloReply;
+				iImSocket->QueueReceiveNextTextLine(iStatus);
+				SetActive();
+				break;
+			}
+		case ESmtpSendMailFrom:
+			{	
+			// MAIL FROM was sent.
+			if (iStatus != KErrNone)
+				{
+				// error
+				iTestStep.ERR_PRINTF2(_L("CT_MsgUtilsSendEmail: failed to send MAIL FROM: [%d]."), iStatus.Int());
+				iTestStep.SetTestStepResult(EFail);
+				User::Leave(iStatus.Int());
+				}
+			
+				// ok we sent MAIL FROM, now receive reply
+				iSendState = ESmtpReceiveReply;
+				iRecvState = ESmtpFromReply;
+				iImSocket->QueueReceiveNextTextLine(iStatus);
+				SetActive();
+				break;
+			}
+		case ESmtpSendRcptTo:
+			{	
+			// RCPT TO was sent.
+			if (iStatus != KErrNone)
+				{
+				// error
+				iTestStep.ERR_PRINTF2(_L("CT_MsgUtilsSendEmail: failed to send RCPT TO: [%d]."), iStatus.Int());
+				iTestStep.SetTestStepResult(EFail);
+				User::Leave(iStatus.Int());
+				}
+			
+				// ok we sent RCPT TO, now receive reply
+				iSendState = ESmtpReceiveReply;
+				iRecvState = ESmtpRcptReply;
+				iImSocket->QueueReceiveNextTextLine(iStatus);
+				SetActive();
+				break;
+			}
+		case ESmtpSendData:
+			{	
+			// DATA was sent.
+			if (iStatus != KErrNone)
+				{
+				// error
+				iTestStep.ERR_PRINTF2(_L("CT_MsgUtilsSendEmail: failed to send DATA: [%d]."), iStatus.Int());
+				iTestStep.SetTestStepResult(EFail);
+				User::Leave(iStatus.Int());
+				}
+			
+				// ok we sent DATA, now receive reply
+				iSendState = ESmtpReceiveReply;
+				iRecvState = ESmtpDataReply;
+				iImSocket->QueueReceiveNextTextLine(iStatus);
+				SetActive();
+				break;
+			}
+		case ESmtpSendContent:
+			{	
+			// Content was sent.
+			// Read and send file. Send file in chunks of 100 bytes.
+			TBuf8<100> buffer;
+			User::LeaveIfError(iFile.Read(buffer, 100));
+			if (buffer.Length() == 0)
+				{
+				// ok, end of file. send end of email.
+				iSendState = ESmtpSendEndData;
+				iImSocket->Send(iStatus, KEndData());
+				}
+			else
+				{
+				// we still have data in file. read and send.
+				iSendState = ESmtpSendContent;
+				iImSocket->Send(iStatus, buffer);
+				}
+				SetActive();
+				break;
+			}
+		case ESmtpSendEndData:
+			{	
+			// end of data was sent.
+			if (iStatus != KErrNone)
+				{
+				// error
+				iTestStep.ERR_PRINTF2(_L("CT_MsgUtilsSendEmail: failed to send end-of-data marker: [%d]."), iStatus.Int());
+				iTestStep.SetTestStepResult(EFail);
+				User::Leave(iStatus.Int());
+				}
+			
+			// ok we sent end-of-data, now receive reply
+			iSendState = ESmtpReceiveReply;
+			iRecvState = ESmtpContentReply;
+			iImSocket->QueueReceiveNextTextLine(iStatus);
+			SetActive();
+			break;
+			}
+		case ESmtpSendLogout:
+			{
+			iSendState = ESmtpReceiveReply;
+			iRecvState = ESmtpLogoutReply;
+			iImSocket->QueueReceiveNextTextLine(iStatus);
+			SetActive();
+			break;
+			}
+		case ESmtpReceiveReply:
+			{
+			if (iStatus != KErrNone)
+				{
+				// error
+				iTestStep.ERR_PRINTF3(_L("CT_MsgUtilsSendEmail: failed to receive reply: error [%d] recvstate [%d]."), iStatus.Int(), iRecvState);
+				iTestStep.SetTestStepResult(EFail);
+				User::Leave(iStatus.Int());
+				}
+			
+			// ok, read and print out the reply
+			TBuf8<50> buffer;
+			TBuf<50> buffer16;
+			TImLineType replyLine = iImSocket->GetCurrentTextLine(buffer);
+			buffer16.Copy(buffer);
+			iTestStep.INFO_PRINTF1(buffer16);
+			
+			if (replyLine == EBufferTooSmall)
+				{
+				while (replyLine != ECRLFTerminated)
+					{
+					replyLine = iImSocket->GetCurrentTextLine(buffer);
+					buffer16.Copy(buffer);
+					iTestStep.INFO_PRINTF1(buffer16);
+					}
+				}
+		
+			// handle reply state
+			switch (iRecvState)
+				{
+				case ESmtpHeloReply:
+					{
+					// send MAIL FROM
+					iSendState = ESmtpSendMailFrom;
+					TBuf8<100> from;
+					from.Append(KMailFrom);
+					from.Append(iSender);
+					from.Append(KCrlfString);
+					iImSocket->Send(iStatus, from);
+					break;
+					}
+				case ESmtpFromReply:
+					{
+					// send RCPT TO
+					iSendState = ESmtpSendRcptTo;
+					TBuf8<100> to;
+					to.Append(KRcptTo);
+					to.Append(iReceipient);
+					to.Append(KCrlfString);
+					iImSocket->Send(iStatus, to);
+					break;
+					}
+				case ESmtpRcptReply:
+					{
+						// send DATA
+					iSendState = ESmtpSendData;
+					iImSocket->Send(iStatus, KDataString());
+					break;
+					}
+				case ESmtpDataReply:
+					{
+					// send content
+					iSendState = ESmtpSendContent;
+					TBuf8<100> buffer;
+					User::LeaveIfError(iFile.Read(buffer, 100));
+					if (buffer.Length() == 0)
+						{
+						// ok, end of file. since this is first read it would mean the file
+						// is empty! we should maybe leave here or??
+						iSendState = ESmtpSendEndData;
+						iImSocket->Send(iStatus, KEndData());
+						}
+					else
+						{
+						// we still have data in file
+						iSendState = ESmtpSendContent;
+						iImSocket->Send(iStatus, buffer);
+						}
+						break;
+					}
+				case ESmtpContentReply:
+					{
+					// send QUIT
+					iSendState = ESmtpSendLogout;
+					iImSocket->Send(iStatus, KQuitString());
+					break;
+					}
+				case ESmtpLogoutReply:
+					{
+					//iTestStep.INFO_PRINTF1(_L("LOGOUT"));
+					iSendState = ESmtpNotConnected;
+					iImSocket->Disconnect(iStatus);
+					break;
+					}
+				default:
+					{
+					User::Panic(_L("Unkown receive state!"), iRecvState);
+					break;
+					}
+				}// End switch (iRecvState)
+			
+				SetActive();
+				break;
+			}
+		default:
+			{
+			User::Panic(_L("Unkown send state!"), iSendState);
+			break;
+			}
+		} // End switch (iSendState)
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/group/T_MsgFramework.mph	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,44 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file
+// .mph file for the Framework
+// 
+//
+
+
+
+
+
+USERINCLUDE 		../inc
+
+
+SOURCEPATH		../src
+SOURCE 			T_MsgActive.cpp
+SOURCE 			T_MsgTimer.cpp
+SOURCE			T_MsgSharedDataBase.cpp
+SOURCE 			T_MsgAsyncStep.cpp
+SOURCE 			T_MsgStep.cpp
+SOURCE 			T_MsgServer.cpp
+SOURCE	       		T_StartUp.cpp
+SOURCE	       		T_ShutDown.cpp
+SOURCE	       		T_RecordCurrentTime.cpp
+
+
+// Mobility Test Framework library:
+//USERINCLUDE ../../../../../../app/messaging/email/pop3andsmtpmtm/servermtmutils/mobilitytestframework/inc
+USERINCLUDE ../../mobilitytestframework/inc
+
+#ifdef __MOBILITY_TEST_FRAMEWORK
+LIBRARY mobilitytestframework.lib
+#endif //__MOBILITY_TEST_FRAMEWORK
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/inc/T_MsgActive.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This contains the class CT_MsgActive
+* 
+*
+*/
+
+
+
+
+
+
+#ifndef __T_MSG_ACTIVE_H__
+#define __T_MSG_ACTIVE_H__
+
+
+/* Epoc includes */
+#include <e32base.h>
+
+
+/**
+ * This implements an interface for the Test Timer Cmpletion Callback
+ */
+class MT_MsgActiveCallback
+	{
+public:
+	/*
+	* Method from which CT_MsgActive informs the user with RunL call
+    * To be implemented by the derived class
+	*/
+	virtual void Completed() = 0;
+
+	/*
+	* Method from which CT_MsgActive informs the user with DoCancel call
+    * To be implemented by the derived class
+	*/
+	virtual void CancelStep() = 0;
+	};
+
+
+
+/**
+ * This implements a Test Active Notification class
+ *
+ */
+class CT_MsgActive : public CActive
+	{
+public:
+	/**
+	* Destructor
+	*/
+	virtual ~CT_MsgActive();
+
+	/**
+	* Two phase constructor that allocates and constructs
+	* a new Active object whose actions are performed by a callback
+	*
+	* \param aCallback object to inform on RunL.
+	* \param aPriority priority of active object.
+	* \return New Callback active object.
+	*/
+	static CT_MsgActive* NewL(MT_MsgActiveCallback& aCallback, TInt aPriority=EPriorityStandard);
+
+	/**
+	* Two phase constructor that allocates and constructs
+	* a new Active object whose actions are performed by a callback
+	*
+	* \param aCallback object to inform on RunL.
+	* \param aPriority priority of active object.
+	* \return New Callback active object.
+	*/
+	static CT_MsgActive*	NewLC(MT_MsgActiveCallback& aCallback, TInt aPriority=EPriorityStandard);
+
+	/**
+	* Activate the object
+	*/
+	void Activate()	{ SetActive(); }
+
+	/**
+	* Active the object RunL implementation.
+	*
+	* Calls the MT_MsgActiveCallback::RunL to inform user that the RunL has been reached.
+	*/
+	void RunL()		{ iCallback.Completed(); }
+
+	/**
+	* Active object DoCancel implementation.
+	*
+	* Calls the MT_MsgActiveCallback::DoCancel to inform user that the DoCancel has been reached.
+	*/
+	void DoCancel()	{ iCallback.CancelStep(); }
+
+	/**
+	* Gets the status as TInt.
+	*/
+	TInt Result()	{ return iStatus.Int(); }
+
+protected:
+	/**
+	* Protected constructor with timer completion callback and priority.
+	*
+	* Called by two phase constructor.
+	*
+	* \param aCallback object to inform on timer completion.
+	* \param aPriority priority of active object.
+	*/
+	CT_MsgActive(MT_MsgActiveCallback& aCallback, TInt aPriority);
+
+private:
+	/**
+	* This is internal and not intended for use.
+	*
+	* Second phase of two phase constructor.
+	*/
+	void ConstructL();
+
+private:
+	/**
+	* This is internal and not intended for use.
+	*/
+	MT_MsgActiveCallback& iCallback;
+	};
+
+#endif /* __T_MSG_ACTIVE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/inc/T_MsgAsyncStep.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This contains the header file for CT_MsgAsyncStep.
+* 
+*
+*/
+
+
+
+
+
+
+#ifndef __T_MSG_ASYNCSTEP_H__
+#define __T_MSG_ASYNCSTEP_H__
+
+
+/* User includes */
+#include "T_MsgStep.h"
+#include "T_MsgActive.h"
+#include "T_MsgTimer.h"
+
+
+/* This implements a base class for the asynchronous test steps */
+class CT_MsgAsyncStep : public CT_MsgStep, private MT_MsgActiveCallback, private MT_MsgTimerCallback
+	{
+public:
+	/**
+	* Destructor
+	*/
+	virtual ~CT_MsgAsyncStep();
+
+	/* Derived from CTestStep
+	 * Calls the doTestStepPreambleL of the base class CTestStep
+	 * Reads in the ProgressTime and CancelTime for the asynchronous operation
+	 */
+	virtual enum TVerdict doTestStepPreambleL();
+
+protected:
+
+	CT_MsgAsyncStep();
+
+	/* 
+	 * Children must call this in their own NewL().
+ 	 */
+	void ConstructL(); 				 
+
+	/* Method to return the object of CT_MsgActive */
+	CT_MsgActive& Active() { return *iActive; }
+
+	/* Derived  from CT_MsgStep 
+	 * Displays the progress of the asynchronous operation
+	 */
+	virtual void ProgressL(TBool bFinal) = 0;
+
+private:
+	/*	Derived from MT_MsgActiveCallback */
+	virtual void Completed();
+
+	/*	MT_MsgTimerCallback implementation */
+	virtual void	TimerCompletedL(CTimer* aTimer);
+
+private:
+	/* To be used in asynchronous operations */
+	CT_MsgActive*		iActive;
+	/* Timer object */
+	CT_MsgTimer*		iTimerCancel;
+	/* Gets the timer progress */
+	CT_MsgTimer*		iTimerProgress;
+
+	TInt iTimeProgress;
+	};
+
+#endif /* __T_MSG_ASYNCSTEP_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/inc/T_MsgServer.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This contains the header file for the Msg server from which other servers 
+* would be derived
+* 
+*
+*/
+
+
+
+
+
+#ifndef __T_MSG_SERVER_H__
+#define __T_MSG_SERVER_H__
+
+
+/* User defined classes */
+#include "testexecuteserverbase.h"
+#include "T_MsgSharedDataBase.h"
+
+#include "mmsgtestpropertywatcher.h"
+#include "cmsgtestpropertywatcher.h"
+
+/* 
+ * Implements a base server from which other servers would be
+ * derived
+ */
+class CT_MsgServer : public CTestServer, public MMsgTestPropertyWatcher
+	{
+protected:
+	CT_MsgServer();
+	virtual ~CT_MsgServer();
+
+	/*
+	 * Derived from CTestStep
+	 * This wraps CTestServer::CreateTestStep() with a leave-trap 
+	 */
+	virtual CTestStep*	CreateTestStepL(const TDesC& aStepName);
+
+	/*
+	 * To be implemented by the derived classes
+	 * Creates the required shared data object
+     */
+	virtual CT_MsgSharedDataBase*	NewSharedDataL() = 0;
+	
+	//From MMsgTestPropertyWatcher
+	void HandleEventL(RProperty& aProperty, TUint /*aKey*/);
+	
+private:
+	/* Calls the function CreateTestStepL to create the required test step */
+	CTestStep*	CreateTestStep(const TDesC& aStepName);
+
+	/* Creates the active scheduler and the base shared data object */
+	void StartupServerL();
+
+	/* Destroys the shared data object and the active scheduler object */
+	void ShutdownServer();
+
+protected:
+	/* For use by generic Mtm test steps */
+	CT_MsgSharedDataBase*	iSharedDataBase; 
+
+private:
+	/* Active scheduler object */
+	CActiveScheduler*		iActiveScheduler;
+	
+	//TBD: Remove this...
+	CMsgTestPropertyWatcher* iPropertyWatcher;
+	};
+
+#endif /*__T_MSG_SERVER_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/inc/T_MsgSharedDataBase.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This contains ths class CT_MsgSharedDataBase which creates a session object
+* 
+*
+*/
+
+
+
+
+
+
+
+#ifndef __T_MSG_SHARED_DATA_BASE_H__
+#define __T_MSG_SHARED_DATA_BASE_H__
+
+
+/* Epoc includes */
+#include <mtclreg.h>
+#include <mtclbase.h>
+
+
+/* 
+ * This implements a class which creates and returns a session object which
+ * can be shared across test steps.It serves as a base class for other shared
+ * data objects which require the session object
+ */
+class CT_MsgSharedDataBase : public CBase, protected MMsvSessionObserver
+	{
+public:
+	/*
+	 * Destructor
+	 */
+	virtual ~CT_MsgSharedDataBase();
+
+protected:
+	CT_MsgSharedDataBase();
+
+	/* 
+	 * Constructs the required session, registry objects
+	 * Initialises the MTM object to NULL
+	 */
+	void ConstructL();
+
+	/* 
+	 * To be implemented by the derived classes to creates
+	 * the required MTM objects
+	 */
+	virtual CBaseMtm*	NewMtmL() = 0;
+
+public:
+	/* Derived from MMsvSessionObserver */
+	void HandleSessionEventL(TMsvSessionEvent,TAny*,TAny*,TAny*) {};
+
+public:
+	/* Session object */
+	CMsvSession*	iSession;
+	/* Registry object required to create MTMs */
+	CClientMtmRegistry*	iRegistry;
+	/* Set to NULL.To be Set for each specific Mtm by deriving class. */
+	CBaseMtm*	iMtm; 	
+	};
+
+#endif /* __T_MSG_SHARED_DATA_BASE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/inc/T_MsgStep.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This contains the header file for CT_MsgStep
+* 
+*
+*/
+
+
+
+
+
+
+#ifndef __T_MSGSTEP_H__
+#define __T_MSGSTEP_H__
+
+
+/* User includes */
+#include "testexecutestepbase.h"
+#include "T_MsgSharedDataBase.h"
+
+
+/* 
+ * Implements a test step which contains the pointer to the shared data object
+ * Other asynchronous and synchronous test steps can be derived from it.
+ */
+class CT_MsgStep : public CTestStep
+	{
+protected:
+	CT_MsgStep();
+	};
+
+#endif /* __T_MSGSTEP_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/inc/T_MsgTimer.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This contains CT_MsgTimer class
+* 
+*
+*/
+
+
+
+
+
+
+
+#ifndef __T_MSG_TIMER_H__
+#define __T_MSG_TIMER_H__
+
+/* User Includes */
+#include <testexecutestepbase.h>
+
+
+
+
+/* Interface to be implemented by the dervied classes for asynchronous operation */
+class MT_MsgTimerCallback
+	{
+public:
+	/* To be implemented by the derived class */
+	virtual void	TimerCompletedL(CTimer* aTimer) = 0;
+	};
+
+
+
+
+/* Implementes a class that dervies from the CTimer, for an active timer object */
+class CT_MsgTimer : public CTimer
+	{
+public:
+	/**
+	* Two phase constructor that allocates and constructs
+	* a new CT_MsgTimer object 
+	*
+	* \param aCallback object to inform on timer completion.
+	* \param aPriority priority of CT_MsgTimer object.
+	* \return New Callback CT_MsgTimer object.
+	*/
+	static CT_MsgTimer*	NewL(MT_MsgTimerCallback& aCallback, TInt aPriority = EPriorityStandard);
+
+protected:
+	CT_MsgTimer(MT_MsgTimerCallback& aCallback, TInt aPriority);
+
+	/* 
+	 * Constructs a new asynchronous timer 
+	 * And adds the object to the active scheduler
+	 */
+	void ConstructL();
+
+	/* Signals on the complettion of the Timer */
+	virtual void RunL();
+
+private:
+	/*
+	 * This is internal and not intended for use.
+	 */
+	MT_MsgTimerCallback&	iCallback;
+	};
+
+#endif /* __T_MSG_TIMER_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/inc/T_RecordCurrentTime.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_MsgRecordCurrentTime
+* 
+*
+*/
+
+
+
+
+
+
+
+#ifndef __T_RECORDCURRENTTIME_H__
+#define __T_RECORDCURRENTTIME_H__
+
+
+/* User includes */
+#include "testexecutestepbase.h"
+
+
+/* Literals Used */
+_LIT(KRecordCurrentTime,"RecordCurrentTime");
+
+
+/* Implements the test step to record the execution time of this test step */
+class CT_MsgRecordCurrentTime : public CTestStep
+	{
+public:
+	CT_MsgRecordCurrentTime();
+
+	/* CTestStep implementation */
+	virtual TVerdict	doTestStepL();	
+	};
+#endif /* __T_RECORDCURRENTTIME_H__ s*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/inc/T_ShutDown.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_MsgShutDown
+* 
+*
+*/
+
+
+
+
+
+
+#ifndef __T_SHUTDOWN_H__
+#define __T_SHUTDOWN_H__
+
+
+/* User includes */
+#include "testexecutestepbase.h"
+
+ /* Literals Used */
+_LIT(KShutDown,"ShutDown");
+
+
+/* Implements a dummy test step to be called at the end of the script */
+class CT_MsgShutDown : public CTestStep
+	{
+public:
+	CT_MsgShutDown();
+
+	/* CTestStep implementation */
+	virtual TVerdict doTestStepL();	
+	};
+#endif /*__T_SHUTDOWN_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/inc/T_StartUp.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file 
+* This is the header file for CT_MsgStartUp
+* 
+*
+*/
+
+
+
+
+
+
+
+#ifndef __T_STARTUP_H__
+#define __T_STARTUP_H__
+
+
+/* User includes */
+#include "testexecutestepbase.h"
+
+
+/* Literals Used */
+_LIT(KStartUp,"StartUp");
+
+
+/* Implements a dummy test step to be called in the beginning of the script */
+class CT_MsgStartUp : public CTestStep
+	{
+public:
+	CT_MsgStartUp();
+
+	/* CTestStep implementation */
+	virtual TVerdict	doTestStepL();	
+	};
+#endif /* __T_STARTUP_H__ s*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/src/T_MsgActive.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,90 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// This contains CT_MsgActive
+// 
+//
+
+
+
+
+
+/* User includes */
+#include "T_MsgActive.h"
+
+
+/**
+  Function :~CT_MsgActive
+  Description : Destructor
+  @return : N/A
+*/
+CT_MsgActive::~CT_MsgActive()
+	{
+	Cancel();
+	}
+
+
+/**
+  Function : NewL
+  Description : Creates the object of CT_MsgActive
+  @return : N/A
+  @leave :	KErrNoMemory	There is no sufficient memory
+*/
+CT_MsgActive* CT_MsgActive::NewL(MT_MsgActiveCallback& aCallback, TInt aPriority)
+	{
+	CT_MsgActive*	self=NewLC(aCallback, aPriority);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+
+/**
+  Function	:	NewLC
+  Description : Creates the object of CT_MsgActive and pushes the object on the stack
+  @return : N/A
+  @leave :	KErrNoMemory	There is no sufficient memory
+*/
+
+CT_MsgActive* CT_MsgActive::NewLC(MT_MsgActiveCallback& aCallback, TInt aPriority)
+	{
+	CT_MsgActive*	self=new(ELeave) CT_MsgActive(aCallback, aPriority);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+
+
+/**
+  Function : CT_MsgActive
+  Description : Constructor
+  @return : N/A
+*/
+CT_MsgActive::CT_MsgActive(MT_MsgActiveCallback& aCallback, TInt aPriority)
+:	CActive(aPriority)
+,	iCallback(aCallback)
+	{
+	}
+
+
+/**
+  Function :ConstructL
+  Description : Adds the active object to the active scheduler
+  @return : N/A
+*/
+void CT_MsgActive::ConstructL()
+	{
+	CActiveScheduler::Add(this);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/src/T_MsgAsyncStep.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,140 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file
+// [Test Step] :
+// AsyncStep
+// Ownes a Active Object for async operations.
+// 
+//
+
+
+
+/* User includes */
+#include "T_MsgAsyncStep.h"
+
+
+/* Literals Used */
+_LIT(KProgressTime,	"ProgressTime");
+_LIT(KCancelTime,	"CancelTime");
+
+
+/**
+  Function : CT_MsgAsyncStep
+  Description : Constructor
+  @return : N/A
+*/
+CT_MsgAsyncStep::CT_MsgAsyncStep()
+:	CT_MsgStep()
+,	iActive(NULL)
+,	iTimerCancel(NULL)
+,	iTimerProgress(NULL)
+,	iTimeProgress(0)
+	{
+	}
+
+
+
+/**
+  Function : ConstructL
+  Description : Creates an object of the active object and timer
+  @return : N/A
+*/
+void CT_MsgAsyncStep::ConstructL()
+	{
+	iActive = CT_MsgActive::NewL(*this);
+	iTimerCancel = CT_MsgTimer::NewL(*this);
+	iTimerProgress= CT_MsgTimer::NewL(*this);
+	}
+
+
+
+/**
+  Function : ~CT_MsgAsyncStep
+  Description : Destructor
+  @return : N/A
+*/
+CT_MsgAsyncStep::~CT_MsgAsyncStep()
+	{
+	delete iTimerProgress;
+	iTimerProgress=NULL;
+
+	delete iTimerCancel;
+	iTimerCancel=NULL;
+
+	delete iActive;
+	iActive=NULL;
+	}
+
+
+
+/**
+  Function : Completed
+  Description : Cancels the wait for completion of an outstanding request
+  @return : N/A
+*/
+void CT_MsgAsyncStep::Completed()
+	{
+	iTimerProgress->Cancel();
+	iTimerCancel->Cancel();
+	ProgressL(ETrue);
+	CActiveScheduler::Stop();
+	}
+
+
+/**
+  Function : TimerCompletedL
+  Description : Sets the progress information and cancel information accordingly
+  @return : none
+*/
+void CT_MsgAsyncStep::TimerCompletedL(CTimer* aTimer)
+	{
+	if ( aTimer==iTimerProgress )
+		{
+		INFO_PRINTF1(_L("Calling ProgressL(EFalse)"));
+		ProgressL(EFalse);
+		iTimerProgress->After(iTimeProgress);
+		}
+	else if ( aTimer==iTimerCancel )
+		{
+		INFO_PRINTF1(_L("Calling Cancel()"));
+		iTimerProgress->Cancel();
+		CancelStep();
+		CActiveScheduler::Stop();
+		}
+	}
+
+
+
+/**
+  Function : doTestStepPreambleL
+  Description : Call the doTestStepPreambleL of the CTestStep class
+				Reads the porgress time and cancel time from the ini
+  @return : TVerdict result
+*/
+enum TVerdict CT_MsgAsyncStep::doTestStepPreambleL()
+	{
+	TVerdict ret=CTestStep::doTestStepPreambleL();
+
+	if( GetIntFromConfig( ConfigSection(), KProgressTime, iTimeProgress) )
+		{
+		iTimerProgress->After(iTimeProgress);
+		}
+
+	TInt time = 0;
+	if( GetIntFromConfig( ConfigSection(), KCancelTime, time) )
+		{
+		iTimerCancel->After(time);
+		}
+	return ret;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/src/T_MsgServer.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,210 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file
+// This is the framework class implementation for the Test Msg Server.
+// 
+//
+
+
+
+/* User includes */
+#include "T_MsgServer.h"
+#include "T_MsgSharedDataBase.h"
+
+#include "mobilitytestpropertyvalue.h"
+#include "mobilitytestpropertymap.h"
+#include "tmobilitytestpropertymapaccess.h"
+
+/* Header files of Test Steps */
+#include "T_StartUp.h"
+#include "T_ShutDown.h"
+#include "T_RecordCurrentTime.h"
+
+/* epoc includes */
+#include <miutset.h>
+
+#include <e32const.h>
+
+/**
+  Function : CT_MsgServer
+  Description : Constructor
+  @return : N/A
+*/
+CT_MsgServer::CT_MsgServer()
+:	CTestServer()
+,	iSharedDataBase(NULL)
+,	iActiveScheduler(NULL)
+	{
+	
+	//Raise process priority to allow complete event logging.
+	RProcess me;
+    me.SetPriority(TProcessPriority(450));
+    User::SetPriorityControl(EFalse);
+    
+	}
+
+
+
+
+/**
+  Function : ~CT_MsgServer
+  Description : Destructor
+  @return : N/A
+*/
+CT_MsgServer::~CT_MsgServer()
+	{
+	}
+
+
+
+/**
+  Function : StartupServerL
+  Description : Creates and installs the active scheduler
+  				Creates an object of the Shared Data class
+  @return : N/A
+*/
+void CT_MsgServer::StartupServerL()
+	{
+	/* Creates the active scheduler, shared data */
+	if (iActiveScheduler==NULL)
+		{
+		/* Installs Active Scheduler */
+		iActiveScheduler=new(ELeave) CActiveScheduler;
+		CActiveScheduler::Install(iActiveScheduler);
+		}
+
+	if (iSharedDataBase==NULL)
+		{
+		/* Creates the shared data in the re-used thread.*/
+		iSharedDataBase = NewSharedDataL();
+		}
+
+#ifdef __MOBILITY_TEST_FRAMEWORK
+	if (iPropertyWatcher==NULL)
+		{
+		iPropertyWatcher = CMsgTestPropertyWatcher::NewL(KPropertyCatMsgTestUtilityServer2, EMyPropertyCounter, *this);
+		}
+#endif //__MOBILITY_TEST_FRAMEWORK
+	}
+
+
+
+/**
+  Function : ShutdownServer
+  Description : Deletes the active scheduler and the created shared data object
+  @return : N/A
+*/
+void CT_MsgServer::ShutdownServer()
+	{
+	if (NULL!=iSharedDataBase)
+		{
+		delete iSharedDataBase;
+		iSharedDataBase=NULL;
+		}
+	if (NULL!=iActiveScheduler)
+		{
+		delete iActiveScheduler;
+		iActiveScheduler = NULL;			
+		}
+
+	if (NULL!=iPropertyWatcher)
+		{
+		delete iPropertyWatcher;
+		iPropertyWatcher = NULL;			
+		}
+	}
+
+
+/**
+  Function : CreateTestStep
+  Description : This method is run in a seperate thread which is re-used 
+  				when the -SharedData flag is set.
+  @return : A pointer to the CTestStep class
+*/
+CTestStep* CT_MsgServer::CreateTestStep(const TDesC& aStepName)
+	{
+	CTestStep* testStep = NULL;
+
+	TRAPD(err,testStep = CreateTestStepL(aStepName));
+	if(err)
+		{
+		ERR_PRINTF1(_L("CT_MsgServer::CreateTestStep() left!"));
+		}
+	return testStep;
+	}
+
+
+
+/**
+  Function : CreateTestStepL
+  Description : This method creates the startup and shut down test steps
+  @return : A pointer to the CTestStep class
+*/
+CTestStep* CT_MsgServer::CreateTestStepL(const TDesC& aStepName)
+	{
+	CTestStep*	testStep = NULL;
+
+	/* This must be called as the first test step */
+	if(aStepName == KStartUp)					
+		{
+		StartupServerL();
+		testStep = new(ELeave) CT_MsgStartUp();
+		}
+	/* This must be called as the last test step */
+	else if(aStepName == KShutDown)				
+		{
+		ShutdownServer();
+		testStep = new(ELeave) CT_MsgShutDown();
+		}
+	else if(aStepName == KRecordCurrentTime)
+		{
+		testStep = new(ELeave) CT_MsgRecordCurrentTime();	
+		}
+
+	else
+		{
+		ERR_PRINTF1(_L("CT_MsgServer::CreateTestStep() - Step not found"));	
+		}
+	return testStep;
+	}
+
+
+#ifdef __MOBILITY_TEST_FRAMEWORK
+void CT_MsgServer::HandleEventL(RProperty& aProperty, TUint /*aKey*/)
+#else //__MOBILITY_TEST_FRAMEWORK
+void CT_MsgServer::HandleEventL(RProperty& /*aProperty*/, TUint /*aKey*/)
+#endif //__MOBILITY_TEST_FRAMEWORK
+	{
+#ifdef __MOBILITY_TEST_FRAMEWORK
+
+	TInt propertyVal = 0;
+	User::LeaveIfError(aProperty.Get(propertyVal));
+
+	const TDesC& name = Name(); //Server name.
+
+
+	const TMsgTestPropertyMapEntry* propertyMap = TMobilityTestPropertyMapAccess::Get(propertyVal);
+	if(propertyMap == NULL)
+		{
+		ERR_PRINTF1(_L("CT_MsgServer::HandleEventL() - Event not found"));
+		}
+	else
+		{
+		TBufC8<80> buf8((const unsigned char*)(propertyMap->name));
+		TBuf<80> buf;
+		buf.Copy(buf8);
+		INFO_PRINTF4(_L("%S EVENT [%d %S]"), &name, propertyVal, &buf);
+		}
+#endif //__MOBILITY_TEST_FRAMEWORK
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/src/T_MsgSharedDataBase.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,73 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// This file contains the shared data class for the base server which creates
+// a session object.
+// 
+//
+
+
+
+/*  user includes */
+#include "T_MsgSharedDataBase.h"
+
+
+/* epoc includes */
+#include <miutset.h>
+
+
+/**
+  Function : CT_MsgSharedDataBase
+  Description : Constructor	
+  @return : N/A
+*/
+CT_MsgSharedDataBase::CT_MsgSharedDataBase()
+:	CBase()
+,	iSession(NULL)
+,	iRegistry(NULL)
+,	iMtm(NULL)
+	{
+	}
+
+
+/**
+  Function : ConstructL
+  Description : Creates the object of session, registry,initialises MTM
+  @return : N/A
+  @leave  :	KErrNoMemory	There is no sufficient memory
+*/
+void CT_MsgSharedDataBase::ConstructL()
+	{
+	iSession	= CMsvSession::OpenSyncL(*this);
+	iRegistry	= CClientMtmRegistry::NewL(*iSession);
+	iMtm		= NewMtmL();
+	}
+
+
+/**
+  Function : ~CT_MsgSharedDataBase
+  Description : Destructor
+  @return : N/A
+*/
+CT_MsgSharedDataBase::~CT_MsgSharedDataBase()
+	{
+	delete iMtm;
+	iMtm=NULL;
+
+	delete iRegistry;
+	iRegistry=NULL;
+
+	delete iSession;
+	iSession = NULL;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/src/T_MsgStep.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,35 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file
+// [Test Step] :
+// MsgStep
+// Interface with TEF.
+// 
+//
+
+
+
+/* User includes */
+#include "T_MsgStep.h"
+
+
+
+/**
+  Function : CT_MsgStep
+  Description : Constructor	
+  @return : N/A
+*/
+CT_MsgStep::CT_MsgStep()
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/src/T_MsgTimer.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,77 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// 
+//
+
+
+
+
+/* User Includes */
+#include "T_MsgTimer.h"
+
+
+/**
+  Function : NewL
+  Description : Creates an object of CT_MsgTimer
+  @return : N/A
+  @leave  :	KErrNoMemory	There is no sufficient memory	
+*/
+CT_MsgTimer* CT_MsgTimer::NewL(MT_MsgTimerCallback& aCallback, TInt aPriority)
+	{
+	CT_MsgTimer*	ret=new (ELeave) CT_MsgTimer(aCallback, aPriority);
+	CleanupStack::PushL(ret);
+	ret->ConstructL();
+	CleanupStack::Pop(ret);
+	return ret;
+	}
+
+
+
+
+/**
+  Function : CT_MsgTimer
+  Description : Constructor
+  @return : N/A
+*/
+CT_MsgTimer::CT_MsgTimer(MT_MsgTimerCallback& aCallback, TInt aPriority)
+:	CTimer(aPriority)
+,	iCallback(aCallback)
+	{
+	}
+
+
+
+/**
+  Function : ConstructL
+  Description : Calls the ConstrutL of CTimer class
+				and adds the object to Active Scheduler
+  @return : N/A
+*/
+void CT_MsgTimer::ConstructL()
+	{
+	CTimer::ConstructL();
+	CActiveScheduler::Add(this);
+	}
+
+
+/**
+  Function : RunL
+  Description : Signals the completion of the operation
+  @return : N/A
+*/
+void CT_MsgTimer::RunL()
+	{
+	iCallback.TimerCompletedL(this);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/src/T_RecordCurrentTime.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,76 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// [TestStep Name]
+// RecordCurrentTime
+// [Paramaters]
+// EventCode		:	Event code defined in TInstrumentationPoint.
+// Creates a logging statement in EventLog server with the time, and
+// event code information.
+// [APIs Used]
+// 
+//
+
+
+
+
+/* User includes */
+#include "T_RecordCurrentTime.h"
+#include "t_utilsenumconverter.h"
+#include "t_testinstrumentation.h"
+
+/* Epoc Include */
+//#include <systemmonitor/instrumentationhandler.h>
+
+
+/* Literals Used*/
+_LIT(KEventCode, "EventCode");
+
+/**
+  Function : CT_MsgRecordCurrentTime
+  Description : Constructor
+  @return : none
+*/
+CT_MsgRecordCurrentTime::CT_MsgRecordCurrentTime()
+	{
+	SetTestStepName(KRecordCurrentTime);
+	}
+
+
+/**
+  Function : doTestStepL
+  Description : This function is responsible for generating a log statement in EventLog server
+  				by providing the event code to instrumentationhandler API.
+  @return : TVerdict Test result
+*/
+TVerdict CT_MsgRecordCurrentTime::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep : RecordCurrentTime"));
+	TPtrC eventCodeFromIni;
+	if(!GetStringFromConfig(ConfigSection(), KEventCode, eventCodeFromIni))
+		{
+		ERR_PRINTF1(_L("Event code is not specified"));
+		SetTestStepResult(EFail);
+		}
+	else
+		{
+//		TInstrumentationPoint eventcode = CT_MsgUtilsEnumConverter::ConvertDesToEventCode(eventCodeFromIni);
+	
+//		CInstrumentationHandler *handler = CInstrumentationHandler::NewL();
+//		CleanupStack::PushL(handler);
+//		handler->RaiseEventNotification(eventcode);
+//		CleanupStack::PopAndDestroy(handler);
+		}
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/src/T_ShutDown.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,47 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file
+// This is the header file for CT_MsgShutDown
+// 
+//
+
+
+
+/* User includes */
+#include "T_ShutDown.h"
+
+
+
+/**
+  Function : CT_MsgShutDown
+  Description : Constructor
+  @return : none
+*/
+CT_MsgShutDown::CT_MsgShutDown()
+	{
+	SetTestStepName(KShutDown);
+	}
+
+
+
+/**
+  Function : doTestStepL
+  Description : Dummy step
+  @return : TVerdict Test result
+*/
+TVerdict CT_MsgShutDown::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep :ShutDown"));
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/framework/src/T_StartUp.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,45 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file 
+// This is the header file for CT_MsgStartUp
+// 
+//
+
+
+
+/* User includes */
+#include "T_StartUp.h"
+
+
+/**
+  Function : CT_MsgStartUp
+  Description : Constructor
+  @return : none
+*/
+CT_MsgStartUp::CT_MsgStartUp()
+	{
+	SetTestStepName(KStartUp);
+	}
+
+
+/**
+  Function : doTestStepL
+  Description : Dummy step
+  @return : TVerdict Test result
+*/
+TVerdict CT_MsgStartUp::doTestStepL()
+	{
+	INFO_PRINTF1(_L("TestStep :StartUp"));
+	return TestStepResult();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/group/bld.inf	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,19 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Messaging Test Product
+// 
+//
+
+#include "../testutils/group/bld.inf"
+#include "../email/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/EABI/mobilitytestframeworku.def	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,37 @@
+EXPORTS
+	_ZN14MSGNETTESTSTUB26CActiveCommsMobilityApiExt18NewCarrierAcceptedEv @ 1 NONAME
+	_ZN14MSGNETTESTSTUB26CActiveCommsMobilityApiExt18NewCarrierRejectedEv @ 2 NONAME
+	_ZN14MSGNETTESTSTUB26CActiveCommsMobilityApiExt22IgnorePreferredCarrierEv @ 3 NONAME
+	_ZN14MSGNETTESTSTUB26CActiveCommsMobilityApiExt25MigrateToPreferredCarrierEv @ 4 NONAME
+	_ZN14MSGNETTESTSTUB26CActiveCommsMobilityApiExt4NewLER16RCommsSubSessionR21MMobilityProtocolResp @ 5 NONAME
+	_ZN14MSGNETTESTSTUB26CActiveCommsMobilityApiExtD0Ev @ 6 NONAME
+	_ZN14MSGNETTESTSTUB26CActiveCommsMobilityApiExtD1Ev @ 7 NONAME
+	_ZN14MSGNETTESTSTUB26CActiveCommsMobilityApiExtD2Ev @ 8 NONAME
+	_ZN23CMsgTestPropertyMapPairC1EP24TMsgTestPropertyMapEntryS1_ @ 9 NONAME
+	_ZN23CMsgTestPropertyMapPairC2EP24TMsgTestPropertyMapEntryS1_ @ 10 NONAME
+	_ZN23CMsgTestPropertyWatcher4NewLE4TUidjR23MMsgTestPropertyWatcher @ 11 NONAME
+	_ZN23CMsgTestPropertyWatcher8PropertyEv @ 12 NONAME
+	_ZN23CMsgTestPropertyWatcherD0Ev @ 13 NONAME
+	_ZN23CMsgTestPropertyWatcherD1Ev @ 14 NONAME
+	_ZN23CMsgTestPropertyWatcherD2Ev @ 15 NONAME
+	_ZN24CImMobilityTestFramework12GetServiceIdER21MMobilityProtocolResp @ 16 NONAME
+	_ZN24CImMobilityTestFramework6CreateElR18CImMobilityManager @ 17 NONAME
+	_ZN24CImMobilityTestFramework6DeleteER18CImMobilityManager @ 18 NONAME
+	_ZN24CImMobilityTestFramework8MtmStateEl23TImMobilityTestMtmState @ 19 NONAME
+	_ZN30TMobilityTestPropertyMapAccess3GetEP7TDesC16 @ 20 NONAME
+	_ZN30TMobilityTestPropertyMapAccess3GetEi @ 21 NONAME
+	_ZTI23CMsgTestPropertyWatcher @ 22 NONAME ; #<TI>#
+	_ZTI24CImMobilityTestFramework @ 23 NONAME ; #<TI>#
+	_ZTIN14MSGNETTESTSTUB26CActiveCommsMobilityApiExtE @ 24 NONAME ; #<TI>#
+	_ZTIN4Meta11TMetaVarLenI5RBuf8EE @ 25 NONAME ABSENT; #<TI>#
+	_ZTIN4Meta11TMetaVarLenI6RBuf16EE @ 26 NONAME ABSENT ; #<TI>#
+	_ZTIN4Meta12TMetaVarLen8I5RBuf8EE @ 27 NONAME ABSENT ; #<TI>#
+	_ZTIN4Meta13TMetaVarLen16I6RBuf16EE @ 28 NONAME ABSENT ; #<TI>#
+	_ZTV23CMsgTestPropertyWatcher @ 29 NONAME ; #<VT>#
+	_ZTV24CImMobilityTestFramework @ 30 NONAME ; #<VT>#
+	_ZTVN14MSGNETTESTSTUB26CActiveCommsMobilityApiExtE @ 31 NONAME ; #<VT>#
+	_ZTVN4Meta11TMetaVarLenI5RBuf8EE @ 32 NONAME ABSENT ; #<VT>#
+	_ZTVN4Meta11TMetaVarLenI6RBuf16EE @ 33 NONAME ABSENT ; #<VT>#
+	_ZTVN4Meta12TMetaVarLen8I5RBuf8EE @ 34 NONAME ABSENT ; #<VT>#
+	_ZTVN4Meta13TMetaVarLen16I6RBuf16EE @ 35 NONAME ABSENT ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/bwins/mobilitytestframeworku.def	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,18 @@
+EXPORTS
+	??0CMsgTestPropertyMapPair@@QAE@PAUTMsgTestPropertyMapEntry@@0@Z @ 1 NONAME ; CMsgTestPropertyMapPair::CMsgTestPropertyMapPair(struct TMsgTestPropertyMapEntry *, struct TMsgTestPropertyMapEntry *)
+	??1CActiveCommsMobilityApiExt@MSGNETTESTSTUB@@UAE@XZ @ 2 NONAME ; MSGNETTESTSTUB::CActiveCommsMobilityApiExt::~CActiveCommsMobilityApiExt(void)
+	??1CMsgTestPropertyWatcher@@UAE@XZ @ 3 NONAME ; CMsgTestPropertyWatcher::~CMsgTestPropertyWatcher(void)
+	?Create@CImMobilityTestFramework@@SAXJAAVCImMobilityManager@@@Z @ 4 NONAME ; void CImMobilityTestFramework::Create(long, class CImMobilityManager &)
+	?Delete@CImMobilityTestFramework@@SAXAAVCImMobilityManager@@@Z @ 5 NONAME ; void CImMobilityTestFramework::Delete(class CImMobilityManager &)
+	?Get@TMobilityTestPropertyMapAccess@@SAPBUTMsgTestPropertyMapEntry@@H@Z @ 6 NONAME ; struct TMsgTestPropertyMapEntry const * TMobilityTestPropertyMapAccess::Get(int)
+	?Get@TMobilityTestPropertyMapAccess@@SAPBUTMsgTestPropertyMapEntry@@PAVTDesC16@@@Z @ 7 NONAME ; struct TMsgTestPropertyMapEntry const * TMobilityTestPropertyMapAccess::Get(class TDesC16 *)
+	?GetServiceId@CImMobilityTestFramework@@SAJAAVMMobilityProtocolResp@@@Z @ 8 NONAME ; long CImMobilityTestFramework::GetServiceId(class MMobilityProtocolResp &)
+	?IgnorePreferredCarrier@CActiveCommsMobilityApiExt@MSGNETTESTSTUB@@QAEXXZ @ 9 NONAME ; void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::IgnorePreferredCarrier(void)
+	?MigrateToPreferredCarrier@CActiveCommsMobilityApiExt@MSGNETTESTSTUB@@QAEXXZ @ 10 NONAME ; void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::MigrateToPreferredCarrier(void)
+	?MtmState@CImMobilityTestFramework@@SAXJW4TImMobilityTestMtmState@@@Z @ 11 NONAME ; void CImMobilityTestFramework::MtmState(long, enum TImMobilityTestMtmState)
+	?NewCarrierAccepted@CActiveCommsMobilityApiExt@MSGNETTESTSTUB@@QAEXXZ @ 12 NONAME ; void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewCarrierAccepted(void)
+	?NewCarrierRejected@CActiveCommsMobilityApiExt@MSGNETTESTSTUB@@QAEXXZ @ 13 NONAME ; void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewCarrierRejected(void)
+	?NewL@CActiveCommsMobilityApiExt@MSGNETTESTSTUB@@SAPAV12@AAVRCommsSubSession@@AAVMMobilityProtocolResp@@@Z @ 14 NONAME ; class MSGNETTESTSTUB::CActiveCommsMobilityApiExt * MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewL(class RCommsSubSession &, class MMobilityProtocolResp &)
+	?NewL@CMsgTestPropertyWatcher@@SAPAV1@VTUid@@IAAVMMsgTestPropertyWatcher@@@Z @ 15 NONAME ; class CMsgTestPropertyWatcher * CMsgTestPropertyWatcher::NewL(class TUid, unsigned int, class MMsgTestPropertyWatcher &)
+	?Property@CMsgTestPropertyWatcher@@QAEAAVRProperty@@XZ @ 16 NONAME ; class RProperty & CMsgTestPropertyWatcher::Property(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/group/bld.inf	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,23 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRJ_PLATFORMS
+
+PRJ_MMPFILES
+#ifdef __MOBILITY_TEST_FRAMEWORK
+mobilitytestframework.mmp
+#endif //__MOBILITY_TEST_FRAMEWORK
+
+PRJ_EXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/group/mobilitytestframework.mmp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,32 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET         mobilitytestframework.dll
+TARGETTYPE     dll
+
+CAPABILITY     All -TCB
+TARGETPATH     /system/libs
+UID            0x1000008d 0x10283077
+VENDORID       0x70000001
+
+SOURCEPATH		../src
+SOURCE				cimmobilitytestframework.cpp cimmobilitytesttls.cpp
+SOURCE				cmsgtestpropertywatcher.cpp cmsgtestpropertymappair.cpp
+SOURCE				tmobilitytestpropertymapaccess.cpp msgnetteststub.cpp
+
+USERINCLUDE    ../inc ../../inc
+SYSTEMINCLUDE  /epoc32/include /epoc32/include/comms-infras
+
+LIBRARY        euser.lib efsrv.lib netmeta.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/cimmobilitytestframework.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,68 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef __CIMMOBILITYTESTFRAMEWORK_H__
+#define __CIMMOBILITYTESTFRAMEWORK_H__
+
+#include <e32base.h>
+#include <msvstd.h>
+#include <cs_mobility_apiext.h>  // MMobilityProtocolResp
+#include "mmsgtestpropertywatcher.h"
+#include "timmobilitytestmtmstate.h"
+
+// Forward class references
+class CImMobilityManager;
+class CMsgTestPropertyWatcher;
+
+/**
+The test framework class.
+
+@internalComponent
+@released
+*/
+class CImMobilityTestFramework : public CBase,
+									public MMsgTestPropertyWatcher
+	{
+public:
+	IMPORT_C static void Create(TMsvId aServiceId, CImMobilityManager& aMobilityManager);
+	IMPORT_C static void Delete(CImMobilityManager& aMobilityManager);
+	IMPORT_C static void MtmState(TMsvId aServiceId, TImMobilityTestMtmState aMtmState);
+	IMPORT_C static TMsvId GetServiceId(MMobilityProtocolResp& aProtocol);
+
+	~CImMobilityTestFramework();
+	TMsvId ServiceId();
+	CImMobilityManager& MobilityManager();
+	void TimerExpired();
+	
+	// from MMsgTestPropertyWatcher
+	void HandleEventL(RProperty& aProperty, TUint /*aKey*/);
+
+private:
+	static void NewL(TMsvId aServiceId, CImMobilityManager& aMobilityManager);
+	CImMobilityTestFramework(TMsvId aServiceId, CImMobilityManager& aMobilityManager);
+	void ConstructL();
+
+private:
+	// Mobility manager
+	CImMobilityManager& iMobilityManager;
+
+	// Service Id of related MTM
+	TMsvId iServiceId;
+	
+	// Property watcher for Publish&Subscribe
+	CMsgTestPropertyWatcher* iPropertyWatcher;
+	};
+
+#endif //__CIMMOBILITYTESTFRAMEWORK_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/cimmobilitytesttls.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,54 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef __CIMMOBILITYTESTTLS_H__
+#define __CIMMOBILITYTESTTLS_H__
+
+#include <e32base.h>
+#include <msvstd.h>
+
+#include "cimmobilitytestframework.h"
+#include <cs_mobility_apiext.h>  // MMobilityProtocolResp
+
+class CImMobilityManager;
+
+/**
+Holds a list of the test frameworks and the list of actions read from
+the test script.
+A pointer to this class is held in thread local storage.
+
+@internalComponent
+@released
+*/
+NONSHARABLE_CLASS(CImMobilityTestTls) : public CBase
+	{
+public:
+	static CImMobilityTestTls* NewL();
+	CImMobilityTestTls();
+	void ConstructL();
+	~CImMobilityTestTls();
+
+	void AddFrameworkL(CImMobilityTestFramework& aFramework);
+	CImMobilityTestFramework* RemoveFramework(CImMobilityManager& aMobilityManager, TBool& aLastOne);
+	CImMobilityTestFramework* GetFramework(TMsvId aServiceId);
+	CImMobilityTestFramework* GetFramework(CImMobilityManager& aMobilityManager);
+	CImMobilityTestFramework* GetFramework(MMobilityProtocolResp& aProtocol);
+
+private:
+	// Test framework list
+  RPointerArray<CImMobilityTestFramework> iFrameworkList;
+	};
+
+#endif //__CIMMOBILITYTESTTLS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/cmsgtestpropertymappair.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,39 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __CMSGTESTPROPERTYMAPPAIR_H__
+#define __CMSGTESTPROPERTYMAPPAIR_H__
+
+#include "tmsgtestpropertymapentry.h"
+
+class CMsgTestPropertyMapPair
+	{
+public:
+	IMPORT_C CMsgTestPropertyMapPair(TMsgTestPropertyMapEntry* aFlag, TMsgTestPropertyMapEntry* aCall);
+
+public:	
+	TMsgTestPropertyMapEntry* flag;
+	TMsgTestPropertyMapEntry* call;
+	};
+
+#endif //__CMSGTESTPROPERTYMAPPAIR_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/cmsgtestpropertywatcher.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,62 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// cmsgtestpropertwatcher.h
+// 
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __CMSGTESTPROPERTYWATCHER_H__
+#define __CMSGTESTPROPERTYWATCHER_H__
+
+#include <e32base.h>
+#include <e32property.h>
+
+class MMsgTestPropertyWatcher;
+
+class CMsgTestPropertyWatcher : public CActive
+	{
+public:
+	IMPORT_C static CMsgTestPropertyWatcher* NewL(TUid aCategory, TUint aKey, MMsgTestPropertyWatcher& aCallback);
+	IMPORT_C virtual ~CMsgTestPropertyWatcher();
+    
+	IMPORT_C RProperty& Property();
+	
+protected:
+	void ConstructL(TUid aCategory, TUint aKey,  MMsgTestPropertyWatcher& aCallback);
+	CMsgTestPropertyWatcher();
+     
+private:
+	void RunL();
+	void DoCancel();
+    
+public:
+	//TBD: these should be private.
+	TUid iCategory;
+	TUint iKey;
+
+private:
+	MMsgTestPropertyWatcher* iCallback;
+
+protected:
+	RProperty iProperty;
+	};
+
+#endif //__CMSGTESTPROPERTYWATCHER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/mmsgtestpropertywatcher.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,37 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __MMSGTESTPROPERTYWATCHER_H__
+#define __MMSGTESTPROPERTYWATCHER_H__
+
+#include <e32base.h>
+
+class RProperty;
+
+class MMsgTestPropertyWatcher
+	{
+public:
+	virtual void HandleEventL(RProperty& aProperty, TUint aKey) =0;
+	};
+
+#endif //__MMSGTESTPROPERTYWATCHER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/mobilitytestmtmapi.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,44 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __MOBILITYTESTMTMAPI_H__
+#define __MOBILITYTESTMTMAPI_H__
+
+#ifndef __MOBILITY_TEST_FRAMEWORK
+
+#define MOBILITY_TEST_CREATE(serviceId, mobilityManager)
+#define MOBILITY_TEST_DELETE(mobilityManager)
+#define MOBILITY_TEST_MTM_STATE(serviceId, state)
+
+#else //__MOBILITY_TEST_FRAMEWORK
+
+#include "timmobilitytestmtmstate.h"
+#include "cimmobilitytestframework.h"
+
+#define MOBILITY_TEST_CREATE(serviceId, mobilityManager) CImMobilityTestFramework::Create(serviceId, mobilityManager)
+#define MOBILITY_TEST_DELETE(mobilityManager) CImMobilityTestFramework::Delete(mobilityManager)
+#define MOBILITY_TEST_MTM_STATE(serviceId, state) CImMobilityTestFramework::MtmState(serviceId, state)
+
+#endif //__MOBILITY_TEST_FRAMEWORK
+
+#endif //__MOBILITYTESTMTMAPI_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/mobilitytestpropertymap.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,126 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __MOBILITYTESTPROPERTYMAP_H__
+#define __MOBILITYTESTPROPERTYMAP_H__
+
+#include "timmobilitytestmtmstate.h"
+#include "mobilitytestpropertyvalue.h"
+#include "tmsgtestpropertymapentry.h"
+
+const TMsgTestPropertyMapEntry propertyMapList[] = 
+	{
+		{"KNTSInitialValueFlag", ENTSInitialValueFlag},
+		{"KNTSPreferredCarrierUpgradeCall", ENTSPreferredCarrierUpgradeCall},
+		{"KNTSPreferredCarrierDowngradeCall", ENTSPreferredCarrierDowngradeCall},
+		{"KNTSNewCarrierActiveCall", ENTSNewCarrierActiveCall},
+		{"KNTSErrorCall", ENTSErrorCall},
+		{"KNTSMigrateToPreferredCarrierFlag", ENTSMigrateToPreferredCarrierFlag},
+		{"KNTSIgnorePreferredCarrierFlag", ENTSIgnorePreferredCarrierFlag},
+		{"KNTSNewCarrierAcceptedFlag", ENTSNewCarrierAcceptedFlag},
+		{"KNTSNewCarrierRejectedFlag", ENTSNewCarrierRejectedFlag},
+		{"KNTSPreferredCarrierUpgradeFlag", ENTSPreferredCarrierUpgradeFlag},
+		{"KNTSPreferredCarrierDowngradeFlag", ENTSPreferredCarrierDowngradeFlag},
+		{"KNTSCancelFlag", ENTSCancelFlag},
+		{"KNTSMigrationCompleteMigrateOKFlag", ENTSMigrationCompleteMigrateOKFlag},
+		{"KNTSMigrationCompleteCouldNotReconnectFlag", ENTSMigrationCompleteCouldNotReconnectFlag},
+		{"KNTSMigrationCompleteMobilityErrorFlag", ENTSMigrationCompleteMobilityErrorFlag},				
+		{"KNTSAcceptImmediatelyCall", ENTSAcceptImmediatelyCall},
+		{"KNTSAcceptStopCurrentCall", ENTSAcceptStopCurrentCall},
+		{"KNTSAcceptCompleteCurrentCall", ENTSAcceptCompleteCurrentCall},
+		{"KNTSIgnoreCall", ENTSIgnoreCall},
+		{"KNTSInitialReject",					KMobilityTestMtmStateInitialReject},
+		{"KNTSImapConnect",					KMobilityTestMtmStateImapConnect},
+		{"KNTSImapIdle",						KMobilityTestMtmStateImapIdle},
+		{"KNTSImapCopyFromLocal1",			KMobilityTestMtmStateImapCopyFromLocal1},
+		{"KNTSImapCopyFromLocal2",			KMobilityTestMtmStateImapCopyFromLocal2},
+		{"KNTSImapCopyFromLocal3",			KMobilityTestMtmStateImapCopyFromLocal3},
+		{"KNTSImapCopyToLocal1",				KMobilityTestMtmStateImapCopyToLocal1},
+		{"KNTSImapCopyToLocal2",				KMobilityTestMtmStateImapCopyToLocal2},
+		{"KNTSImapCopyToLocal3",				KMobilityTestMtmStateImapCopyToLocal3},
+		{"KNTSImapCopyToLocal4",				KMobilityTestMtmStateImapCopyToLocal4},
+		{"KNTSImapCopyToLocal5",				KMobilityTestMtmStateImapCopyToLocal5},
+		{"KNTSImapCopyToLocal6",				KMobilityTestMtmStateImapCopyToLocal6},
+		{"KNTSImapCopyToLocal7",				KMobilityTestMtmStateImapCopyToLocal7},
+		{"KNTSImapCopyWithinService1",		KMobilityTestMtmStateImapCopyWithinService1},
+		{"KNTSImapCopyWithinService2",		KMobilityTestMtmStateImapCopyWithinService2},
+		{"KNTSImapCopyWithinService3",		KMobilityTestMtmStateImapCopyWithinService3},
+		{"KNTSImapCopyWithinService4",		KMobilityTestMtmStateImapCopyWithinService4},
+		{"KNTSImapCopyWithinService5",		KMobilityTestMtmStateImapCopyWithinService5},
+		{"KNTSImapCopyWithinService6",		KMobilityTestMtmStateImapCopyWithinService6},
+		{"KNTSImapCopyWithinService7",		KMobilityTestMtmStateImapCopyWithinService7},
+		{"KNTSImapCopyWithinService8",		KMobilityTestMtmStateImapCopyWithinService8},
+		{"KNTSImapCreateFolder",				KMobilityTestMtmStateImapCreateFolder},
+		{"KNTSImapDelete1",					KMobilityTestMtmStateImapDelete1},
+		{"KNTSImapDelete2",					KMobilityTestMtmStateImapDelete2},
+		{"KNTSImapDelete3",					KMobilityTestMtmStateImapDelete3},
+		{"KNTSImapDelete4",					KMobilityTestMtmStateImapDelete4},
+		{"KNTSImapDelete5",					KMobilityTestMtmStateImapDelete5},
+		{"KNTSImapDeleteFolder1",				KMobilityTestMtmStateImapDeleteFolder1},
+		{"KNTSImapDeleteFolder2",				KMobilityTestMtmStateImapDeleteFolder2},
+		{"KNTSImapDeleteFolder3",				KMobilityTestMtmStateImapDeleteFolder3},
+		{"KNTSImapDeleteFolder4",				KMobilityTestMtmStateImapDeleteFolder4},
+		{"KNTSImapDisconnect1",				KMobilityTestMtmStateImapDisconnect1},
+		{"KNTSImapDisconnect2",				KMobilityTestMtmStateImapDisconnect2},
+		{"KNTSImapRename1",					KMobilityTestMtmStateImapRename1},
+		{"KNTSImapRename2",					KMobilityTestMtmStateImapRename2},
+		{"KNTSImapSyncFolder1",				KMobilityTestMtmStateImapSyncFolder1},
+ 		{"KNTSImapSyncFolder2",				KMobilityTestMtmStateImapSyncFolder2},
+ 		{"KNTSImapSyncFolderTree",			KMobilityTestMtmStateImapSyncFolderTree},
+		{"KNTSImapSyncEInboxEarlyDeletes",	KMobilityTestMtmImapSyncEInboxEarlyDeletes},
+		{"KNTSImapSyncEInboxEarlyExpunge",	KMobilityTestMtmImapSyncEInboxEarlyExpunge},
+		{"KNTSImapSyncEInboxSync",			KMobilityTestMtmImapSyncEInboxSync},
+		{"KNTSImapSyncESyncTree",				KMobilityTestMtmImapSyncESyncTree},
+		{"KNTSImapSyncESyncSubscriptions",	KMobilityTestMtmImapSyncESyncSubscriptions},
+		{"KNTSImapSyncEFolderEarlyDeletes",	KMobilityTestMtmImapSyncEFolderEarlyDeletes},
+		{"KNTSImapSyncEFolderEarlyExpunge",	KMobilityTestMtmImapSyncEFolderEarlyExpunge},
+		{"KNTSImapSyncESyncFolder",			KMobilityTestMtmImapSyncESyncFolder},
+		{"KNTSImapEInboxLateDeletes",			KMobilityTestMtmImapEInboxLateDeletes},
+		{"KNTSImapSyncEFolderLateDeletes",	KMobilityTestMtmImapSyncEFolderLateDeletes},
+		{"KNTSImapSyncEFolderLateExpunge",	KMobilityTestMtmImapSyncEFolderLateExpunge},
+		{"KNTSPopConnecting",					KMobilityTestMtmStatePopConnecting},
+		{"KNTSPopRefreshing",					KMobilityTestMtmStatePopRefreshing},
+		{"KNTSPopTidying",					KMobilityTestMtmStatePopTidying},
+		{"KNTSPopFindingFirstOfflineOp",		KMobilityTestMtmStatePopFindingFirstOfflineOp},
+		{"KNTSPopCancellingOfflineOps",		KMobilityTestMtmStatePopCancellingOfflineOps},
+		{"KNTSPopCopying",					KMobilityTestMtmStatePopCopying},
+		{"KNTSPopMoving",						KMobilityTestMtmStatePopMoving},
+		{"KNTSPopPopulating",					KMobilityTestMtmStatePopPopulating},
+		{"KNTSPopTopPopulating",				KMobilityTestMtmStatePopTopPopulating},
+		{"KNTSPopDeleting",					KMobilityTestMtmStatePopDeleting},
+		{"KNTSPopConnectedAndIdle",			KMobilityTestMtmStatePopConnectedAndIdle},
+		{"KNTSPopQuitting", KMobilityTestMtmStatePopQuitting},
+		{"KNTSPopRetrieving", KMobilityTestMtmStatePopRetrieving},
+		{"KNTSSmtpConnectingToSmtp",			KMobilityTestMtmStateSmtpConnectingToSmtp},
+		{"KNTSSmtpWaitingForReply",			KMobilityTestMtmStateSmtpWaitingForReply},
+		{"KNTSSmtpAuthorisingSmtp",			KMobilityTestMtmStateSmtpAuthorisingSmtp},
+		{"KNTSSmtpAuthInProgress",			KMobilityTestMtmStateSmtpAuthInProgress},
+		{"KNTSSmtpSendingStartTls",			KMobilityTestMtmStateSmtpSendingStartTls},
+		{"KNTSSmtpSettingSecurity",			KMobilityTestMtmStateSmtpSettingSecurity},
+		{"KNTSSmtpResetSmtp",					KMobilityTestMtmStateSmtpResetSmtp},
+		{"KNTSSmtpClosingSmtp",				KMobilityTestMtmStateSmtpClosingSmtp},
+		{"KNTSSmtpSendFile",					KMobilityTestMtmStateSmtpSendFile},
+		{"", 0xffffffff} // This must always be the last entry in the list
+	};
+
+#endif //__MOBILITYTESTPROPERTYMAP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/mobilitytestpropertyvalue.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,68 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __MOBILITYTESTPROPERTYVALUE_H__
+#define __MOBILITYTESTPROPERTYVALUE_H__
+
+#include <e32cmn.h>
+
+const TUid KPropertyCatMsgTestUtilityServer2={0x102857AB};
+
+static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
+
+enum TMyPropertyKeys {EMyPropertyCounter, EMyPropertyParamCall, EMyPropertyParamFlag};
+
+const TInt KMobilityTestPropertyValueEnumerationOffset = 1000;
+
+enum TMobilityTestPropertyValue
+{
+	ENTSInitialValueFlag=KMobilityTestPropertyValueEnumerationOffset,
+	
+	//MMobilityProtocolResp:
+	ENTSPreferredCarrierUpgradeCall,
+	ENTSPreferredCarrierDowngradeCall,
+	ENTSNewCarrierActiveCall,
+	ENTSErrorCall,
+	
+	//CActiveCommsMobilityApiExt:
+	ENTSMigrateToPreferredCarrierFlag,
+	ENTSIgnorePreferredCarrierFlag,
+	ENTSNewCarrierAcceptedFlag,
+	ENTSNewCarrierRejectedFlag,
+
+	//CMobilityPolicyPlugin:
+	ENTSPreferredCarrierUpgradeFlag,
+	ENTSPreferredCarrierDowngradeFlag,
+	ENTSCancelFlag,
+	ENTSMigrationCompleteMigrateOKFlag,
+	ENTSMigrationCompleteCouldNotReconnectFlag,
+	ENTSMigrationCompleteMobilityErrorFlag,
+	
+	//MImMobilityPolicyHandler:
+	ENTSAcceptImmediatelyCall,
+	ENTSAcceptStopCurrentCall,
+	ENTSAcceptCompleteCurrentCall,
+	ENTSIgnoreCall
+};
+
+#endif //__MOBILITYTESTPROPERTYVALUE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/msgnetteststub.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,92 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __MSGNETTESTSTUB_H__
+#define __MSGNETTESTSTUB_H__
+
+#ifdef __MOBILITY_TEST_FRAMEWORK
+
+#include <e32std.h>
+#include <cs_mobility_apiext.h>
+#include "mmsgtestpropertywatcher.h"
+#include <msvstd.h>
+
+class CMsgTestPropertyWatcher;
+
+namespace MSGNETTESTSTUB
+{
+
+class CActiveCommsMobilityApiExt :	public CBase,
+									public MMobilityProtocolResp,
+									public MMsgTestPropertyWatcher
+	{
+public:
+
+	//Stubbed interface:
+	IMPORT_C static CActiveCommsMobilityApiExt* NewL(RCommsSubSession& aExtensionProvider,MMobilityProtocolResp& aProtocol);
+	IMPORT_C ~CActiveCommsMobilityApiExt();
+
+	IMPORT_C void MigrateToPreferredCarrier();
+	IMPORT_C void IgnorePreferredCarrier();
+	IMPORT_C void NewCarrierAccepted();
+	IMPORT_C void NewCarrierRejected();
+
+protected:
+
+	//Internal methods:
+    void ConstructL();
+    explicit CActiveCommsMobilityApiExt(RCommsSubSession& aExtensionProvider, MMobilityProtocolResp& aProtocol);
+
+public:
+
+	// from MMobilityProtocolResp
+	void PreferredCarrierAvailable(TAccessPointInfo aOldAp, TAccessPointInfo aNewAp, TBool aIsUpgrade, TBool aIsSeamless);
+	void NewCarrierActive(TAccessPointInfo aNewAp, TBool aIsSeamless);
+	void Error(TInt aError);
+
+	// from MPropertyWatcher
+	void HandleEventL(RProperty& aProperty, TUint aKey);
+
+private:
+	
+	RCommsSubSession& iCommsSubSession;
+	MMobilityProtocolResp& iProtocol;
+
+	//Pointer to the real thing
+	::CActiveCommsMobilityApiExt* iCommsMobilityApi;
+	
+	//CMsgTestPropertyWatcher for IPC
+	CMsgTestPropertyWatcher* iPropertyWatcher;
+	
+	TMsvId iServiceId;
+	};
+
+}
+
+#ifndef LOCAL_INCLUDE
+#define CActiveCommsMobilityApiExt MSGNETTESTSTUB::CActiveCommsMobilityApiExt
+#endif // LOCAL_INCLUDE
+
+#endif //__MOBILITY_TEST_FRAMEWORK
+
+#endif //__MSGNETTESTSTUB_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/timmobilitytestmtmstate.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,130 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __TIMMOBILITYTESTMTMSTATE_H__
+#define __TIMMOBILITYTESTMTMSTATE_H__
+
+/**
+Defines the set of states where the MTM will make a call into the test
+framework to see whether some mobility action should be performed.
+
+Note that if you add to this, you also need to add to the lists which
+are found in ....
+*/
+enum TImMobilityTestMtmState
+	{
+	KMobilityTestMtmStateNone,
+	KMobilityTestMtmStateInitialReject,
+
+	// IMAP MTM states
+	KMobilityTestMtmStateImapConnect,
+	KMobilityTestMtmStateImapIdle,				// this is the first IDLE call after bg sync completes
+
+	KMobilityTestMtmStateImapCopyFromLocal1,	// APPEND message
+	KMobilityTestMtmStateImapCopyFromLocal2, 	// SELECT destination folder
+	KMobilityTestMtmStateImapCopyFromLocal3,	// sync'ing destination folder
+	
+	KMobilityTestMtmStateImapCopyToLocal1,		// SELECT source folder
+	KMobilityTestMtmStateImapCopyToLocal2,		// FETCHing the message
+	KMobilityTestMtmStateImapCopyToLocal3,		// local async copy
+	KMobilityTestMtmStateImapCopyToLocal4,		//(10) STORE /deleted flag (move only)
+	KMobilityTestMtmStateImapCopyToLocal5,		// EXPUNGE (move only)
+	KMobilityTestMtmStateImapCopyToLocal6,		// CLOSE FOLDER (move only)
+	KMobilityTestMtmStateImapCopyToLocal7,		// SELECT FOLDER (move only)
+	
+	KMobilityTestMtmStateImapCopyWithinService1,// SELECT source mailbox
+	KMobilityTestMtmStateImapCopyWithinService2,// COPY message(s)
+	KMobilityTestMtmStateImapCopyWithinService3,// STORE /deleted flag (move only)
+	KMobilityTestMtmStateImapCopyWithinService4,// EXPUNGE source folder (move only)
+	KMobilityTestMtmStateImapCopyWithinService5,// SELECT destination folder
+	KMobilityTestMtmStateImapCopyWithinService6,// sync'ing destination folder
+	KMobilityTestMtmStateImapCopyWithinService7,//(20) CLOSE folder to delete messages
+	KMobilityTestMtmStateImapCopyWithinService8,// SELECT folder after close to delete messages
+
+	KMobilityTestMtmStateImapCreateFolder,		// CREATE command issued
+
+	KMobilityTestMtmStateImapDelete1,			// SELECT source folder
+	KMobilityTestMtmStateImapDelete2,			// STORE /deleted command
+	KMobilityTestMtmStateImapDelete3,			// EXPUNGE following a delete
+	KMobilityTestMtmStateImapDelete4,			// CLOSE FOLDER following a delete
+	KMobilityTestMtmStateImapDelete5,			// SELECT FOLDER following close to delete
+
+	KMobilityTestMtmStateImapDeleteFolder1, 	// SELECT source folder
+	KMobilityTestMtmStateImapDeleteFolder2, 	// STORE /deleted (all messages)
+	KMobilityTestMtmStateImapDeleteFolder3, 	//(30) CLOSE folder
+	KMobilityTestMtmStateImapDeleteFolder4, 	// DELETE folder
+	
+	KMobilityTestMtmStateImapDisconnect1,		// sync'ing late deletes
+	KMobilityTestMtmStateImapDisconnect2,		// LOGOUT etc
+	
+	KMobilityTestMtmStateImapRename1, 			// RENAME issued
+	KMobilityTestMtmStateImapRename2, 			// SUBSCRIBE issued
+	
+	KMobilityTestMtmStateImapSyncFolder1,		// SELECT issued
+ 	KMobilityTestMtmStateImapSyncFolder2,		// sync'ing the folder
+ 	
+ 	KMobilityTestMtmStateImapSyncFolderTree,	// sync'ing the folder tree 	
+	
+	KMobilityTestMtmImapSyncEInboxEarlyDeletes,
+	KMobilityTestMtmImapSyncEInboxEarlyExpunge, //(40)
+	KMobilityTestMtmImapSyncEInboxSync,
+	KMobilityTestMtmImapSyncESyncTree,
+	KMobilityTestMtmImapSyncESyncSubscriptions,
+	KMobilityTestMtmImapSyncEFolderEarlyDeletes,
+	KMobilityTestMtmImapSyncEFolderEarlyExpunge,
+	KMobilityTestMtmImapSyncESyncFolder,
+	KMobilityTestMtmImapEInboxLateDeletes,
+	KMobilityTestMtmImapSyncEFolderLateDeletes,
+	KMobilityTestMtmImapSyncEFolderLateExpunge,
+
+	// POP MTM states
+	KMobilityTestMtmStatePopConnecting = 300,
+	KMobilityTestMtmStatePopRefreshing,
+	KMobilityTestMtmStatePopTidying,
+	KMobilityTestMtmStatePopFindingFirstOfflineOp,
+	KMobilityTestMtmStatePopCancellingOfflineOps,
+	KMobilityTestMtmStatePopCopying,
+	KMobilityTestMtmStatePopMoving,
+	KMobilityTestMtmStatePopPopulating,
+	KMobilityTestMtmStatePopTopPopulating,
+	KMobilityTestMtmStatePopDeleting,
+	KMobilityTestMtmStatePopConnectedAndIdle,
+	KMobilityTestMtmStatePopQuitting,
+	KMobilityTestMtmStatePopRetrieving,
+
+	//SMTP MTM states
+	KMobilityTestMtmStateSmtpConnectingToSmtp = 500,
+	KMobilityTestMtmStateSmtpWaitingForReply,
+	KMobilityTestMtmStateSmtpAuthorisingSmtp,
+	KMobilityTestMtmStateSmtpAuthInProgress,
+	KMobilityTestMtmStateSmtpSendingStartTls,
+	KMobilityTestMtmStateSmtpSettingSecurity,
+	KMobilityTestMtmStateSmtpResetSmtp,
+	KMobilityTestMtmStateSmtpClosingSmtp,
+	KMobilityTestMtmStateSmtpSendFile
+
+	// Do not put any values at 1000 or above as this range is used
+	// elsewhere in the test framework
+	};
+
+#endif //__TIMMOBILITYTESTMTMSTATE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/tmobilitytestpropertymapaccess.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,37 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __TMOBILITYTESTPROPERTYMAPACCESS_H__
+#define __TMOBILITYTESTPROPERTYMAPACCESS_H__
+
+#include <e32base.h>
+#include "tmsgtestpropertymapentry.h"
+
+class TMobilityTestPropertyMapAccess
+	{
+public:
+	IMPORT_C static const TMsgTestPropertyMapEntry* Get(TDesC* aName);
+	IMPORT_C static const TMsgTestPropertyMapEntry* Get(TInt aValue);
+	};
+
+#endif //__TMOBILITYTESTPROPERTYMAP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/inc/tmsgtestpropertymapentry.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,35 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+ @internalTechnology
+ @released
+*/
+
+#ifndef __TMSGTESTPROPERTYMAPENTRY_H__
+#define __TMSGTESTPROPERTYMAPENTRY_H__
+
+#include <e32base.h>
+
+struct TMsgTestPropertyMapEntry
+	{
+	const char* name;
+	TInt value;
+	};
+
+#endif //__TMSGTESTPROPERTYMAPENTRY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/src/cimmobilitytestframework.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,176 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "cimmobilitytestframework.h"
+#include "cimmobilitytesttls.h"
+#include "cimmobilitymanager.h"
+#include "cmsgtestpropertywatcher.h"
+#include "mobilitytestpropertyvalue.h"
+
+/**
+Creates a test framework.
+Static method.
+
+@param aServiceId Service ID of associated MTM
+@param aMobilityManager Associated mobility manager
+*/
+EXPORT_C void CImMobilityTestFramework::Create(TMsvId aServiceId, CImMobilityManager& aMobilityManager)
+	{
+	TRAP_IGNORE(NewL(aServiceId, aMobilityManager));
+	}
+
+/**
+Deletes a test framework.
+Static method.
+
+@param aMobilityManager Associated mobility manager
+*/	
+EXPORT_C void CImMobilityTestFramework::Delete(CImMobilityManager& aMobilityManager)
+	{
+	CImMobilityTestTls* testTls = static_cast<CImMobilityTestTls*>(Dll::Tls());
+
+	if (testTls)
+		{
+		TBool lastOne = EFalse;
+		CImMobilityTestFramework* framework = testTls->RemoveFramework(aMobilityManager, lastOne);
+
+		if (framework)
+			{
+			delete framework;
+			}
+
+		if (lastOne)
+			{
+			delete testTls;
+			}
+		}
+	}
+
+/**
+Called by an MTM when it reaches a specific operation state.
+Static method.
+
+@param aServiceId Service ID of MTM
+@param aMtmState MTM state
+*/
+EXPORT_C void CImMobilityTestFramework::MtmState(TMsvId aServiceId, TImMobilityTestMtmState aMtmState)
+	{
+	CImMobilityTestTls* testTls = static_cast<CImMobilityTestTls*>(Dll::Tls());
+
+	if (testTls)
+		{
+		CImMobilityTestFramework* framework = testTls->GetFramework(aServiceId);
+		if (framework)
+			{
+			// Flag the call
+			RProperty& property = framework->iPropertyWatcher->Property();
+   		property.Set(aMtmState);
+			}
+		}
+	}
+	
+/**
+Called by the net test stub to determine the service id.
+Static method.
+
+@param aProtocol reference to MMobilityProtocolResp
+*/
+EXPORT_C TMsvId CImMobilityTestFramework::GetServiceId(MMobilityProtocolResp& aProtocol)
+	{
+	CImMobilityTestTls* testTls = static_cast<CImMobilityTestTls*>(Dll::Tls());
+
+	if (testTls)
+		{
+		CImMobilityTestFramework* framework = testTls->GetFramework(aProtocol);
+		if (framework)
+			{
+			return framework->ServiceId();
+			}
+		}
+
+	return KErrNotFound;
+	}
+
+/**
+Factory constructor.
+Static method.
+
+@param aServiceId Service ID of associated MTM
+@param aMobilityManager Associated mobility manager
+*/
+void CImMobilityTestFramework::NewL(TMsvId aServiceId, CImMobilityManager& aMobilityManager)
+	{
+	CImMobilityTestTls* testTls = CImMobilityTestTls::NewL();
+
+	CImMobilityTestFramework* self = new (ELeave) CImMobilityTestFramework(aServiceId, aMobilityManager);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	// Store framework. Ownership is passed.
+	testTls->AddFrameworkL(*self);
+	}
+
+/**
+Class constructor.
+
+@param aServiceId Service ID of associated MTM
+@param aMobilityManager Associated mobility manager
+*/
+CImMobilityTestFramework::CImMobilityTestFramework(TMsvId aServiceId, CImMobilityManager& aMobilityManager) :
+ iMobilityManager(aMobilityManager),
+ iServiceId(aServiceId)
+	{
+	}
+
+/**
+Second phase constructor
+*/
+void CImMobilityTestFramework::ConstructL()
+	{
+	iPropertyWatcher = CMsgTestPropertyWatcher::NewL(KPropertyCatMsgTestUtilityServer2, EMyPropertyCounter, *this);
+	}
+
+/**
+Class destructor
+*/
+CImMobilityTestFramework::~CImMobilityTestFramework()
+	{
+	delete iPropertyWatcher;
+	}
+
+/**
+Returns service ID of associated MTM
+
+@return Service ID of MTM
+*/
+TMsvId CImMobilityTestFramework::ServiceId()
+	{
+	return iServiceId;
+	}
+
+/**
+Returns associated mobility maanger
+
+@return Mobility manager
+*/
+CImMobilityManager& CImMobilityTestFramework::MobilityManager()
+	{
+	return iMobilityManager;
+	}
+
+void CImMobilityTestFramework::HandleEventL(RProperty& /*aProperty*/, TUint /*aKey*/)
+	{
+	//Don't need to respond to events here.
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/src/cimmobilitytesttls.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,165 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "cimmobilitytesttls.h"
+#include "cimmobilitytestframework.h"
+#include "cimmobilitymanager.h"
+
+/**
+Factory constructor
+Static routine
+
+@return Constructed class
+*/
+CImMobilityTestTls* CImMobilityTestTls::NewL()
+	{
+	CImMobilityTestTls* self = static_cast<CImMobilityTestTls*>(Dll::Tls());
+
+	if (!self)
+		{
+		self = new (ELeave) CImMobilityTestTls();
+		CleanupStack::PushL(self);
+		self->ConstructL();
+		CleanupStack::Pop(self);
+		Dll::SetTls(self);
+		}
+
+	return self;
+	}
+
+/**
+Class constructor
+*/
+CImMobilityTestTls::CImMobilityTestTls()
+	{
+	}
+
+/**
+Second phase constructor
+*/
+void CImMobilityTestTls::ConstructL()
+	{
+	}
+
+/**
+Class destructor
+*/
+CImMobilityTestTls::~CImMobilityTestTls()
+	{
+	iFrameworkList.Reset();
+
+	Dll::SetTls(NULL);
+	}
+
+/**
+Stores a test framework. Takes ownership of the framework.
+
+@param aFramework Test framework
+*/
+void CImMobilityTestTls::AddFrameworkL(CImMobilityTestFramework& aFramework)
+	{
+	iFrameworkList.AppendL(&aFramework);
+	}
+
+/**
+Removes a test framework from the list of frameworks and passes it back
+to the caller. The caller takes ownership of the framework.
+
+@param aMobilityManager Mobility manager associated with framework
+@param aLastOne Last framework has now been removed
+@return Test framework
+*/
+CImMobilityTestFramework* CImMobilityTestTls::RemoveFramework(CImMobilityManager& aMobilityManager, TBool& aLastOne)
+	{
+	CImMobilityTestFramework* framework = NULL;
+	aLastOne = EFalse;
+
+	for (TInt count = 0; count < iFrameworkList.Count(); ++count)
+		{
+		if (&(iFrameworkList[count]->MobilityManager()) == &aMobilityManager)
+			{
+			framework = iFrameworkList[count];
+			iFrameworkList.Remove(count);
+			if (iFrameworkList.Count() == 0)
+				{
+				aLastOne = ETrue;
+				}
+			break;
+			}
+		}
+
+	return framework;
+	}
+
+/**
+Gets a test framework from the list of frameworks.
+
+@param aServiceId Service ID used as search key
+@return Test framework
+*/
+CImMobilityTestFramework* CImMobilityTestTls::GetFramework(TMsvId aServiceId)
+	{
+	for (TInt count = 0; count < iFrameworkList.Count(); ++count)
+		{
+		if (iFrameworkList[count]->ServiceId() == aServiceId)
+			{
+			return iFrameworkList[count];
+			}
+		}
+
+	return NULL;
+	}
+
+/**
+Gets a test framework from the list of frameworks.
+
+@param aMobilityManager Mobility manager used as search key
+@return Test framework
+*/
+CImMobilityTestFramework* CImMobilityTestTls::GetFramework(CImMobilityManager& aMobilityManager)
+	{
+	for (TInt count = 0; count < iFrameworkList.Count(); ++count)
+		{
+		if (&(iFrameworkList[count]->MobilityManager()) == &aMobilityManager)
+			{
+			return iFrameworkList[count];
+			}
+		}
+
+	return NULL;
+	}
+
+/**
+Gets a test framework from the list of frameworks.
+
+@param aProtocol MMobilityProtocolResp& used as search key
+@return Test framework
+*/
+CImMobilityTestFramework* CImMobilityTestTls::GetFramework(MMobilityProtocolResp& aProtocol)
+	{
+	for (TInt count = 0; count < iFrameworkList.Count(); ++count)
+		{
+		CImMobilityManager* man = &(iFrameworkList[count]->MobilityManager());
+
+		MMobilityProtocolResp* prot = static_cast<MMobilityProtocolResp*>(man);
+		
+		if (prot == &aProtocol)
+			{
+			return iFrameworkList[count];
+			}
+		}
+
+	return NULL;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/src/cmsgtestpropertymappair.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,27 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "cmsgtestpropertymappair.h"
+
+/**
+Class constructor
+
+@param aFlag Flag value
+@param aCall Call value
+*/
+EXPORT_C CMsgTestPropertyMapPair::CMsgTestPropertyMapPair(TMsgTestPropertyMapEntry* aFlag, TMsgTestPropertyMapEntry* aCall)
+: flag(aFlag), call(aCall)
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/src/cmsgtestpropertywatcher.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,72 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <e32std.h>
+#include "mmsgtestpropertywatcher.h"
+#include "cmsgtestpropertywatcher.h"
+
+static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
+
+EXPORT_C CMsgTestPropertyWatcher* CMsgTestPropertyWatcher::NewL(TUid aCategory, TUint aKey, MMsgTestPropertyWatcher& aCallback)
+    {
+    CMsgTestPropertyWatcher* self=new(ELeave) CMsgTestPropertyWatcher();
+    CleanupStack::PushL(self);
+    self->ConstructL(aCategory, aKey, aCallback);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CMsgTestPropertyWatcher::CMsgTestPropertyWatcher()
+    :CActive(EPriorityHigh)
+    {}
+
+void CMsgTestPropertyWatcher::ConstructL(TUid aCategory, TUint aKey, MMsgTestPropertyWatcher& aCallback)
+    {
+    iCategory = aCategory;
+    iKey = aKey;
+    iCallback = &aCallback;
+   
+    User::LeaveIfError(iProperty.Attach(aCategory,aKey)); 
+    CActiveScheduler::Add(this);
+
+    // initial subscription
+    iProperty.Subscribe(iStatus);
+    SetActive();
+    }
+
+EXPORT_C CMsgTestPropertyWatcher::~CMsgTestPropertyWatcher()
+    {
+    Cancel();
+    iProperty.Close();
+    }
+
+void CMsgTestPropertyWatcher::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+void CMsgTestPropertyWatcher::RunL()
+    {
+    // re-subscribe before processing new value to prevent missing updates
+    iProperty.Subscribe(iStatus);
+    SetActive();
+
+    iCallback->HandleEventL(iProperty, iKey);
+    }
+    
+EXPORT_C RProperty& CMsgTestPropertyWatcher::Property()
+	{
+	return iProperty;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/src/msgnetteststub.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,136 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// MSGMSGNETTESTSTUB.CPP
+// 
+//
+
+#define LOCAL_INCLUDE
+#include "msgnetteststub.h"
+#undef LOCAL_INCLUDE
+#include "cmsgtestpropertywatcher.h"
+#include "cimmobilitytestframework.h"
+#include "mobilitytestpropertyvalue.h"
+
+EXPORT_C MSGNETTESTSTUB::CActiveCommsMobilityApiExt* MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewL(RCommsSubSession& aExtensionProvider,MMobilityProtocolResp& aProtocol)
+{
+	CActiveCommsMobilityApiExt* self = new (ELeave) CActiveCommsMobilityApiExt(aExtensionProvider, aProtocol);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::ConstructL()
+{
+	iCommsMobilityApi = NULL;
+	//Try to construct the real thing, but trap the 'not supported' error:
+//	TRAPD(err, iCommsMobilityApi = ::CActiveCommsMobilityApiExt::NewL(aExtensionProvider, *this));
+
+	iPropertyWatcher = CMsgTestPropertyWatcher::NewL(KPropertyCatMsgTestUtilityServer2, EMyPropertyCounter, *this);
+    
+	iServiceId = CImMobilityTestFramework::GetServiceId(iProtocol);
+	User::LeaveIfError(iServiceId);
+}
+
+MSGNETTESTSTUB::CActiveCommsMobilityApiExt::CActiveCommsMobilityApiExt(RCommsSubSession& aExtensionProvider, MMobilityProtocolResp& aProtocol)
+: iCommsSubSession(aExtensionProvider), iProtocol(aProtocol)
+{
+}
+
+EXPORT_C MSGNETTESTSTUB::CActiveCommsMobilityApiExt::~CActiveCommsMobilityApiExt()
+{
+	delete iCommsMobilityApi;
+	delete iPropertyWatcher;
+}
+
+EXPORT_C void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::MigrateToPreferredCarrier()
+{
+//	Flag the call iCommsMobilityApi->MigrateToPreferredCarrier();
+	iPropertyWatcher->Property().Set(ENTSMigrateToPreferredCarrierFlag);
+}
+
+EXPORT_C void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::IgnorePreferredCarrier()
+{
+//	Flag the call iCommsMobilityApi->IgnorePreferredCarrier();
+	iPropertyWatcher->Property().Set(ENTSIgnorePreferredCarrierFlag);
+}
+
+EXPORT_C void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewCarrierAccepted()
+{
+//	Flag the call iCommsMobilityApi->NewCarrierAccepted();
+	iPropertyWatcher->Property().Set(ENTSNewCarrierAcceptedFlag);
+}
+
+EXPORT_C void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewCarrierRejected()
+{
+//	Flag the call iCommsMobilityApi->NewCarrierRejected();
+	iPropertyWatcher->Property().Set(ENTSNewCarrierRejectedFlag);
+}
+
+//Additional functionality:
+
+// from MMobilityProtocolResp
+void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::PreferredCarrierAvailable(TAccessPointInfo aOldAp, TAccessPointInfo aNewAp, TBool aIsUpgrade, TBool aIsSeamless)
+{
+	iProtocol.PreferredCarrierAvailable(aOldAp, aNewAp, aIsUpgrade, aIsSeamless);
+}
+
+void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::NewCarrierActive(TAccessPointInfo aNewAp, TBool aIsSeamless)
+{
+	iProtocol.NewCarrierActive(aNewAp, aIsSeamless);
+}
+
+void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::Error(TInt aError)
+{
+	iProtocol.Error(aError);
+}
+
+// from CMsgTestPropertyWatcher
+void MSGNETTESTSTUB::CActiveCommsMobilityApiExt::HandleEventL(RProperty& aProperty, TUint /*aKey*/)
+	{
+	
+	TInt propertyVal = ENTSInitialValueFlag;
+	User::LeaveIfError(aProperty.Get(propertyVal));
+	
+	TAccessPointInfo oldAp;
+	TAccessPointInfo newAp;		
+	oldAp.SetAccessPoint(1);
+	newAp.SetAccessPoint(1);
+		
+	TBool isSeamless = EFalse;
+
+	TInt error = 0;
+
+	switch(propertyVal)
+		{
+		// Callbacks to production code:
+		case ENTSPreferredCarrierUpgradeCall :			
+			PreferredCarrierAvailable(oldAp, newAp, ETrue, isSeamless);
+			break;
+		case ENTSPreferredCarrierDowngradeCall :
+			PreferredCarrierAvailable(oldAp, newAp, EFalse, isSeamless);
+			break;
+		case ENTSNewCarrierActiveCall :
+			NewCarrierActive(newAp, isSeamless);
+			break;
+		case ENTSErrorCall :
+			MSGNETTESTSTUB::CActiveCommsMobilityApiExt::Error(error);
+			break;
+
+		// Ignore any other calls
+		default :
+			break;
+		}
+
+  }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/mobilitytestframework/src/tmobilitytestpropertymapaccess.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,56 @@
+// Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "tmobilitytestpropertymapaccess.h"
+#include "mobilitytestpropertymap.h"
+
+EXPORT_C const TMsgTestPropertyMapEntry* TMobilityTestPropertyMapAccess::Get(TDesC* aName)
+	{
+	TInt i=0;
+
+	while (propertyMapList[i].value != 0xffffffff)
+		{
+		TBufC8<80> buf8((const unsigned char*)(propertyMapList[i].name));
+
+		TBuf<80> buf;
+		buf.Copy(buf8);
+
+		if (aName->CompareF(buf) == 0)
+			{
+			return &propertyMapList[i];
+			}
+
+		++i;
+		}
+
+	return NULL;
+	}
+
+EXPORT_C const TMsgTestPropertyMapEntry* TMobilityTestPropertyMapAccess::Get(TInt aValue)
+	{
+	TInt i=0;
+
+	while (propertyMapList[i].value != 0xFFFFFFFF)
+		{
+		if (propertyMapList[i].value == aValue)
+			{
+			return &propertyMapList[i];
+			}
+		
+		++i;
+		}
+
+	return NULL;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/bwins/T_MsgUtilityServerU.DEF	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,72 @@
+EXPORTS
+	??0CT_MsgUtils@@QAE@XZ @ 1 NONAME ; CT_MsgUtils::CT_MsgUtils(void)
+	??0CT_MsgUtilsCentralRepository@@QAE@XZ @ 2 NONAME ; CT_MsgUtilsCentralRepository::CT_MsgUtilsCentralRepository(void)
+	??0CT_MsgUtilsConfigFileMachineName@@AAE@XZ @ 3 NONAME ; CT_MsgUtilsConfigFileMachineName::CT_MsgUtilsConfigFileMachineName(void)
+	??0CT_MsgUtilsConfigFileParserUtility@@AAE@XZ @ 4 NONAME ; CT_MsgUtilsConfigFileParserUtility::CT_MsgUtilsConfigFileParserUtility(void)
+	??0CT_MsgUtilsDeleteAllChildren@@QAE@PAVCMsvSession@@J@Z @ 5 NONAME ; CT_MsgUtilsDeleteAllChildren::CT_MsgUtilsDeleteAllChildren(class CMsvSession *, long)
+	??0CT_MsgUtilsEnumConverter@@QAE@XZ @ 6 NONAME ; CT_MsgUtilsEnumConverter::CT_MsgUtilsEnumConverter(void)
+	?After@CT_MsgTimerUtils@@QAEXHAAVTRequestStatus@@@Z @ 7 NONAME ; void CT_MsgTimerUtils::After(int, class TRequestStatus &)
+	?CloseResourceFile@CT_MsgUtils@@SAXPAX@Z @ 8 NONAME ; void CT_MsgUtils::CloseResourceFile(void *)
+	?CompareFilesL@CT_MsgUtils@@SAHVTPtrC16@@0HPAV?$CArrayFixFlat@G@@AAH@Z @ 9 NONAME ; int CT_MsgUtils::CompareFilesL(class TPtrC16, class TPtrC16, int, class CArrayFixFlat<unsigned short> *, int &)
+	?CompareIapPrefs@CT_MsgUtilsReadEmailSettingsFromConfigFile@@SAHAAVCImIAPPreferences@@0@Z @ 10 NONAME ; int CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(class CImIAPPreferences &, class CImIAPPreferences &)
+	?ConstructL@CT_MsgUtilsConfigFileMachineName@@AAEXABVTDesC16@@@Z @ 11 NONAME ; void CT_MsgUtilsConfigFileMachineName::ConstructL(class TDesC16 const &)
+	?ConstructL@CT_MsgUtilsConfigFileParserUtility@@AAEXABVTDesC16@@@Z @ 12 NONAME ; void CT_MsgUtilsConfigFileParserUtility::ConstructL(class TDesC16 const &)
+	?ConvertDesToTCommDbDialogPref@CT_MsgUtilsEnumConverter@@SA?AW4TCommDbDialogPref@@AAVTDesC16@@@Z @ 13 NONAME ; enum TCommDbDialogPref CT_MsgUtilsEnumConverter::ConvertDesToTCommDbDialogPref(class TDesC16 &)
+	?ConvertDesToTFolderSubscribeType@CT_MsgUtilsEnumConverter@@SA?AW4TFolderSubscribeType@@AAVTDesC16@@@Z @ 14 NONAME ; enum TFolderSubscribeType CT_MsgUtilsEnumConverter::ConvertDesToTFolderSubscribeType(class TDesC16 &)
+	?ConvertDesToTFolderSyncType@CT_MsgUtilsEnumConverter@@SA?AW4TFolderSyncType@@AAVTDesC16@@@Z @ 15 NONAME ; enum TFolderSyncType CT_MsgUtilsEnumConverter::ConvertDesToTFolderSyncType(class TDesC16 &)
+	?ConvertDesToTImImap4PartialMailOptions@CT_MsgUtilsEnumConverter@@SA?AW4TImImap4PartialMailOptions@@AAVTDesC16@@@Z @ 16 NONAME ; enum TImImap4PartialMailOptions CT_MsgUtilsEnumConverter::ConvertDesToTImImap4PartialMailOptions(class TDesC16 &)
+	?ConvertDesToTImSMTPSendCopyToSelf@CT_MsgUtilsEnumConverter@@SA?AW4TImSMTPSendCopyToSelf@@AAVTDesC16@@@Z @ 17 NONAME ; enum TImSMTPSendCopyToSelf CT_MsgUtilsEnumConverter::ConvertDesToTImSMTPSendCopyToSelf(class TDesC16 &)
+	?ConvertDesToTImSMTPSendMessageOption@CT_MsgUtilsEnumConverter@@SA?AW4TImSMTPSendMessageOption@@AAVTDesC16@@@Z @ 18 NONAME ; enum TImSMTPSendMessageOption CT_MsgUtilsEnumConverter::ConvertDesToTImSMTPSendMessageOption(class TDesC16 &)
+	?ConvertDesToTImap4Cmds@CT_MsgUtilsEnumConverter@@SA?AW4TImap4Cmds@@AAVTDesC16@@@Z @ 19 NONAME ; enum TImap4Cmds CT_MsgUtilsEnumConverter::ConvertDesToTImap4Cmds(class TDesC16 &)
+	?ConvertDesToTImap4GetMailOptions@CT_MsgUtilsEnumConverter@@SA?AW4TImap4GetMailOptions@@AAVTDesC16@@@Z @ 20 NONAME ; enum TImap4GetMailOptions CT_MsgUtilsEnumConverter::ConvertDesToTImap4GetMailOptions(class TDesC16 &)
+	?ConvertDesToTMsgOutboxBodyEncoding@CT_MsgUtilsEnumConverter@@SA?AW4TMsgOutboxBodyEncoding@@AAVTDesC16@@@Z @ 21 NONAME ; enum TMsgOutboxBodyEncoding CT_MsgUtilsEnumConverter::ConvertDesToTMsgOutboxBodyEncoding(class TDesC16 &)
+	?ConvertDesToTPop3Cmds@CT_MsgUtilsEnumConverter@@SA?AW4TPop3Cmds@@ABVTDesC16@@@Z @ 22 NONAME ; enum TPop3Cmds CT_MsgUtilsEnumConverter::ConvertDesToTPop3Cmds(class TDesC16 const &)
+	?ConvertDesToTPop3GetMailOptions@CT_MsgUtilsEnumConverter@@SA?AW4TPop3GetMailOptions@@AAVTDesC16@@@Z @ 23 NONAME ; enum TPop3GetMailOptions CT_MsgUtilsEnumConverter::ConvertDesToTPop3GetMailOptions(class TDesC16 &)
+	?CreateChildrenSelectionL@CT_MsgUtils@@SAPAVCMsvEntrySelection@@PAVCMsvSession@@J@Z @ 24 NONAME ; class CMsvEntrySelection * CT_MsgUtils::CreateChildrenSelectionL(class CMsvSession *, long)
+	?CreateChildrenSelectionRemoteFolderL@CT_MsgUtils@@SAPAVCMsvEntrySelection@@PAVCMsvSession@@VTPtrC16@@1@Z @ 25 NONAME ; class CMsvEntrySelection * CT_MsgUtils::CreateChildrenSelectionRemoteFolderL(class CMsvSession *, class TPtrC16, class TPtrC16)
+	?CreateChildrenSelectionRemoteFolderWithTypeL@CT_MsgUtils@@SAPAVCMsvEntrySelection@@PAVCMsvSession@@VTPtrC16@@1VTUid@@@Z @ 26 NONAME ; class CMsvEntrySelection * CT_MsgUtils::CreateChildrenSelectionRemoteFolderWithTypeL(class CMsvSession *, class TPtrC16, class TPtrC16, class TUid)
+	?CreateChildrenSelectionWithTypeL@CT_MsgUtils@@SAPAVCMsvEntrySelection@@PAVCMsvSession@@JVTUid@@@Z @ 27 NONAME ; class CMsvEntrySelection * CT_MsgUtils::CreateChildrenSelectionWithTypeL(class CMsvSession *, long, class TUid)
+	?FinalProgressStatus@CT_MsgUtilsDeleteAllChildren@@QAEHAAVCMsvOperation@@ABVTRequestStatus@@@Z @ 28 NONAME ; int CT_MsgUtilsDeleteAllChildren::FinalProgressStatus(class CMsvOperation &, class TRequestStatus const &)
+	?FindEntryByNameL@CT_MsgUtils@@SAJPAVCMsvEntry@@AAVTDesC16@@1H@Z @ 29 NONAME ; long CT_MsgUtils::FindEntryByNameL(class CMsvEntry *, class TDesC16 &, class TDesC16 &, int)
+	?FindEntryByNameL@CT_MsgUtils@@SAJPAVCMsvEntry@@AAVTDesC16@@H@Z @ 30 NONAME ; long CT_MsgUtils::FindEntryByNameL(class CMsvEntry *, class TDesC16 &, int)
+	?FindEntryByNameL@CT_MsgUtils@@SAJPAVCMsvSession@@JAAVTDesC16@@1H@Z @ 31 NONAME ; long CT_MsgUtils::FindEntryByNameL(class CMsvSession *, long, class TDesC16 &, class TDesC16 &, int)
+	?FindEntryByNameL@CT_MsgUtils@@SAJPAVCMsvSession@@JAAVTDesC16@@H@Z @ 32 NONAME ; long CT_MsgUtils::FindEntryByNameL(class CMsvSession *, long, class TDesC16 &, int)
+	?FindFolderIdByName@CT_MsgUtilsEnumConverter@@SAJAAVTDesC16@@@Z @ 33 NONAME ; long CT_MsgUtilsEnumConverter::FindFolderIdByName(class TDesC16 &)
+	?GetDefaultSmtpServiceIdL@CT_MsgUtilsCentralRepository@@SAJXZ @ 34 NONAME ; long CT_MsgUtilsCentralRepository::GetDefaultSmtpServiceIdL(void)
+	?GetFieldAsInteger@CT_MsgUtilsConfigFileParserUtility@@QAEHABVTDesC16@@AAH@Z @ 35 NONAME ; int CT_MsgUtilsConfigFileParserUtility::GetFieldAsInteger(class TDesC16 const &, int &)
+	?GetFieldAsString8@CT_MsgUtilsConfigFileParserUtility@@QAEHABVTDesC16@@AAVTPtrC8@@@Z @ 36 NONAME ; int CT_MsgUtilsConfigFileParserUtility::GetFieldAsString8(class TDesC16 const &, class TPtrC8 &)
+	?GetFieldAsString@CT_MsgUtilsConfigFileParserUtility@@QAEHABVTDesC16@@AAVTPtrC16@@@Z @ 37 NONAME ; int CT_MsgUtilsConfigFileParserUtility::GetFieldAsString(class TDesC16 const &, class TPtrC16 &)
+	?GetImapAccountL@CT_MsgUtilsCentralRepository@@SAHAAVTDes16@@AAVTImapAccount@@@Z @ 38 NONAME ; int CT_MsgUtilsCentralRepository::GetImapAccountL(class TDes16 &, class TImapAccount &)
+	?GetImapServiceIdL@CT_MsgUtilsCentralRepository@@SAJAAVTDes16@@@Z @ 39 NONAME ; long CT_MsgUtilsCentralRepository::GetImapServiceIdL(class TDes16 &)
+	?GetPopAccountL@CT_MsgUtilsCentralRepository@@SAHAAVTDes16@@AAVTPopAccount@@@Z @ 40 NONAME ; int CT_MsgUtilsCentralRepository::GetPopAccountL(class TDes16 &, class TPopAccount &)
+	?GetPopServiceIdL@CT_MsgUtilsCentralRepository@@SAJAAVTDes16@@@Z @ 41 NONAME ; long CT_MsgUtilsCentralRepository::GetPopServiceIdL(class TDes16 &)
+	?GetRemoteFolderIdByNameL@CT_MsgUtils@@SAJPAVCMsvSession@@VTPtrC16@@11H@Z @ 42 NONAME ; long CT_MsgUtils::GetRemoteFolderIdByNameL(class CMsvSession *, class TPtrC16, class TPtrC16, class TPtrC16, int)
+	?GetRemoteFolderIdByNameL@CT_MsgUtils@@SAJPAVCMsvSession@@VTPtrC16@@1H@Z @ 43 NONAME ; long CT_MsgUtils::GetRemoteFolderIdByNameL(class CMsvSession *, class TPtrC16, class TPtrC16, int)
+	?GetString@CT_MsgUtilsReadEmailSettingsFromConfigFile@@CAHAAVTDesC16@@AAHHAAVTPtrC16@@@Z @ 44 NONAME ; int CT_MsgUtilsReadEmailSettingsFromConfigFile::GetString(class TDesC16 &, int &, int, class TPtrC16 &)
+	?MachineName@CT_MsgUtilsConfigFileMachineName@@QAEABVTDesC8@@XZ @ 45 NONAME ; class TDesC8 const & CT_MsgUtilsConfigFileMachineName::MachineName(void)
+	?MachineNameEmail@CT_MsgUtilsConfigFileMachineName@@QAEABVTDesC16@@XZ @ 46 NONAME ; class TDesC16 const & CT_MsgUtilsConfigFileMachineName::MachineNameEmail(void)
+	?NewL@CT_MsgTimerUtils@@SAPAV1@XZ @ 47 NONAME ; class CT_MsgTimerUtils * CT_MsgTimerUtils::NewL(void)
+	?NewL@CT_MsgUtilsConfigFileMachineName@@SAPAV1@ABVTDesC16@@@Z @ 48 NONAME ; class CT_MsgUtilsConfigFileMachineName * CT_MsgUtilsConfigFileMachineName::NewL(class TDesC16 const &)
+	?NewL@CT_MsgUtilsConfigFileParserUtility@@SAPAV1@ABVTDesC16@@@Z @ 49 NONAME ; class CT_MsgUtilsConfigFileParserUtility * CT_MsgUtilsConfigFileParserUtility::NewL(class TDesC16 const &)
+	?NewLC@CT_MsgUtilsConfigFileMachineName@@SAPAV1@ABVTDesC16@@@Z @ 50 NONAME ; class CT_MsgUtilsConfigFileMachineName * CT_MsgUtilsConfigFileMachineName::NewLC(class TDesC16 const &)
+	?OpenResourceFileL@CT_MsgUtils@@SAXAAVRResourceFile@@AAVRFs@@ABVTDesC16@@@Z @ 51 NONAME ; void CT_MsgUtils::OpenResourceFileL(class RResourceFile &, class RFs &, class TDesC16 const &)
+	?ReadDataL@CT_MsgUtils@@SAHAAVRFileReadStream@@AAVTPtr16@@HPAV?$CArrayFixFlat@G@@@Z @ 52 NONAME ; int CT_MsgUtils::ReadDataL(class RFileReadStream &, class TPtr16 &, int, class CArrayFixFlat<unsigned short> *)
+	?ReadImapIAPAndAddFieldL@CT_MsgUtilsReadEmailSettingsFromConfigFile@@CAXPAVCT_MsgUtilsConfigFileParserUtility@@ABVTDesC16@@AAVCImIAPPreferences@@@Z @ 53 NONAME ; void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadImapIAPAndAddFieldL(class CT_MsgUtilsConfigFileParserUtility *, class TDesC16 const &, class CImIAPPreferences &)
+	?ReadImapIAPAndAddL@CT_MsgUtilsReadEmailSettingsFromConfigFile@@CAXPAVCT_MsgUtilsConfigFileParserUtility@@ABVTDesC16@@AAVCImIAPPreferences@@@Z @ 54 NONAME ; void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadImapIAPAndAddL(class CT_MsgUtilsConfigFileParserUtility *, class TDesC16 const &, class CImIAPPreferences &)
+	?ReadImapSettingsFromConfigurationFileL@CT_MsgUtilsReadEmailSettingsFromConfigFile@@SAXAAVTDesC16@@AAVCImImap4Settings@@AAVCImIAPPreferences@@ABV2@@Z @ 55 NONAME ; void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadImapSettingsFromConfigurationFileL(class TDesC16 &, class CImImap4Settings &, class CImIAPPreferences &, class TDesC16 const &)
+	?ReadPopIAPAndAddFieldL@CT_MsgUtilsReadEmailSettingsFromConfigFile@@CAXPAVCT_MsgUtilsConfigFileParserUtility@@ABVTDesC16@@AAVCImIAPPreferences@@@Z @ 56 NONAME ; void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopIAPAndAddFieldL(class CT_MsgUtilsConfigFileParserUtility *, class TDesC16 const &, class CImIAPPreferences &)
+	?ReadPopIAPAndAddL@CT_MsgUtilsReadEmailSettingsFromConfigFile@@CAXPAVCT_MsgUtilsConfigFileParserUtility@@ABVTDesC16@@AAVCImIAPPreferences@@@Z @ 57 NONAME ; void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopIAPAndAddL(class CT_MsgUtilsConfigFileParserUtility *, class TDesC16 const &, class CImIAPPreferences &)
+	?ReadPopSettingsFromConfigurationFileL@CT_MsgUtilsReadEmailSettingsFromConfigFile@@SAXAAVTDesC16@@AAVCImPop3Settings@@AAVCImIAPPreferences@@ABV2@@Z @ 58 NONAME ; void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(class TDesC16 &, class CImPop3Settings &, class CImIAPPreferences &, class TDesC16 const &)
+	?ReadSmtpIAPAndAddFieldL@CT_MsgUtilsReadEmailSettingsFromConfigFile@@CAXPAVCT_MsgUtilsConfigFileParserUtility@@ABVTDesC16@@AAVCImIAPPreferences@@@Z @ 59 NONAME ; void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpIAPAndAddFieldL(class CT_MsgUtilsConfigFileParserUtility *, class TDesC16 const &, class CImIAPPreferences &)
+	?ReadSmtpIAPAndAddL@CT_MsgUtilsReadEmailSettingsFromConfigFile@@CAXPAVCT_MsgUtilsConfigFileParserUtility@@ABVTDesC16@@AAVCImIAPPreferences@@@Z @ 60 NONAME ; void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpIAPAndAddL(class CT_MsgUtilsConfigFileParserUtility *, class TDesC16 const &, class CImIAPPreferences &)
+	?ReadSmtpSettingsFromConfigurationFileL@CT_MsgUtilsReadEmailSettingsFromConfigFile@@SAXAAVTDesC16@@AAVCImSmtpSettings@@AAVCImIAPPreferences@@ABV2@@Z @ 61 NONAME ; void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(class TDesC16 &, class CImSmtpSettings &, class CImIAPPreferences &, class TDesC16 const &)
+	?SearchMessageBySubjectL@CT_MsgUtils@@SAJPAVCMsvSession@@JVTPtrC16@@@Z @ 62 NONAME ; long CT_MsgUtils::SearchMessageBySubjectL(class CMsvSession *, long, class TPtrC16)
+	?StartL@CT_MsgUtilsDeleteAllChildren@@QAEXAAVTRequestStatus@@@Z @ 63 NONAME ; void CT_MsgUtilsDeleteAllChildren::StartL(class TRequestStatus &)
+	?ConvertDesToEventCode@CT_MsgUtilsEnumConverter@@SA?AW4TInstrumentationPoint@@AAVTDesC16@@@Z @ 64 NONAME ; enum TInstrumentationPoint CT_MsgUtilsEnumConverter::ConvertDesToEventCode(class TDesC16 &)
+	?ConvertDesToTSmtpCmdsL@CT_MsgUtilsEnumConverter@@SA?AW4TSmtpCmds@@AAVTDesC16@@@Z @ 65 NONAME ; enum TSmtpCmds CT_MsgUtilsEnumConverter::ConvertDesToTSmtpCmdsL(class TDesC16 &)
+	?SearchMessageBySubjectL@CT_MsgUtils@@SAJPAVCMsvSession@@JVTPtrC16@@H@Z @ 66 NONAME ; long CT_MsgUtils::SearchMessageBySubjectL(class CMsvSession *, long, class TPtrC16, int)
+	?ConvertDesToBearerTypes@CT_MsgUtilsEnumConverter@@SAKABVTDesC16@@@Z @ 67 NONAME ; unsigned long CT_MsgUtilsEnumConverter::ConvertDesToBearerTypes(class TDesC16 const &)
+	?GetSmtpAccountL@CT_MsgUtilsCentralRepository@@SAHAAVTDes16@@AAVTSmtpAccount@@@Z @ 68 NONAME ; int CT_MsgUtilsCentralRepository::GetSmtpAccountL(class TDes16 &, class TSmtpAccount &)
+	?GetSmtpServiceIdL@CT_MsgUtilsCentralRepository@@SAJAAVTDes16@@@Z @ 69 NONAME ; long CT_MsgUtilsCentralRepository::GetSmtpServiceIdL(class TDes16 &)
+	?StartL@CT_MsgUtilsDeleteAllChildren@@QAEXHAAVTRequestStatus@@@Z @ 70 NONAME ; void CT_MsgUtilsDeleteAllChildren::StartL(int, class TRequestStatus &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/bwins/messagingtestutility2u.def	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,14 @@
+EXPORTS
+	?Connect@RMessagingTestUtilityServer2@@QAEHXZ @ 1 NONAME ; int RMessagingTestUtilityServer2::Connect(void)
+	?CopyFile@RMessagingTestUtilityServer2@@QAEHABVTDesC16@@0@Z @ 2 NONAME ; int RMessagingTestUtilityServer2::CopyFile(class TDesC16 const &, class TDesC16 const &)
+	?DeleteFile@RMessagingTestUtilityServer2@@QAEHABVTDesC16@@@Z @ 3 NONAME ; int RMessagingTestUtilityServer2::DeleteFile(class TDesC16 const &)
+	?DeleteMessageStore@RMessagingTestUtilityServer2@@QAEHJ@Z @ 4 NONAME ; int RMessagingTestUtilityServer2::DeleteMessageStore(long)
+	?EventHandlerAdd@RMessagingTestUtilityServer2@@QAEHABVTDesC16@@0@Z @ 5 NONAME ; int RMessagingTestUtilityServer2::EventHandlerAdd(class TDesC16 const &, class TDesC16 const &)
+	?EventHandlerCheck@RMessagingTestUtilityServer2@@QAEHXZ @ 6 NONAME ; int RMessagingTestUtilityServer2::EventHandlerCheck(void)
+	?EventHandlerInit@RMessagingTestUtilityServer2@@QAEHXZ @ 7 NONAME ; int RMessagingTestUtilityServer2::EventHandlerInit(void)
+	?FileExists@RMessagingTestUtilityServer2@@QAEHABVTDesC16@@@Z @ 8 NONAME ; int RMessagingTestUtilityServer2::FileExists(class TDesC16 const &)
+	?GetDirL@RMessagingTestUtilityServer2@@QAEHABVTDesC16@@IIAAPAVCDir@@@Z @ 9 NONAME ; int RMessagingTestUtilityServer2::GetDirL(class TDesC16 const &, unsigned int, unsigned int, class CDir * &)
+	?KillProcess@RMessagingTestUtilityServer2@@QAEHVTProcessId@@@Z @ 10 NONAME ; int RMessagingTestUtilityServer2::KillProcess(class TProcessId)
+	?MkDir@RMessagingTestUtilityServer2@@QAEHABVTDesC16@@@Z @ 11 NONAME ; int RMessagingTestUtilityServer2::MkDir(class TDesC16 const &)
+	?RmDir@RMessagingTestUtilityServer2@@QAEHABVTDesC16@@@Z @ 12 NONAME ; int RMessagingTestUtilityServer2::RmDir(class TDesC16 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/eabi/T_MsgUtilityServerU.DEF	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,86 @@
+EXPORTS
+	_ZN11CT_MsgUtils13CompareFilesLE7TPtrC16S0_iP13CArrayFixFlatItERi @ 1 NONAME
+	_ZN11CT_MsgUtils16FindEntryByNameLEP11CMsvSessionlR7TDesC16S3_i @ 2 NONAME
+	_ZN11CT_MsgUtils16FindEntryByNameLEP11CMsvSessionlR7TDesC16i @ 3 NONAME
+	_ZN11CT_MsgUtils16FindEntryByNameLEP9CMsvEntryR7TDesC16S3_i @ 4 NONAME
+	_ZN11CT_MsgUtils16FindEntryByNameLEP9CMsvEntryR7TDesC16i @ 5 NONAME
+	_ZN11CT_MsgUtils17CloseResourceFileEPv @ 6 NONAME
+	_ZN11CT_MsgUtils17OpenResourceFileLER13RResourceFileR3RFsRK7TDesC16 @ 7 NONAME
+	_ZN11CT_MsgUtils23SearchMessageBySubjectLEP11CMsvSessionl7TPtrC16 @ 8 NONAME
+	_ZN11CT_MsgUtils24CreateChildrenSelectionLEP11CMsvSessionl @ 9 NONAME
+	_ZN11CT_MsgUtils24GetRemoteFolderIdByNameLEP11CMsvSession7TPtrC16S2_S2_i @ 10 NONAME
+	_ZN11CT_MsgUtils24GetRemoteFolderIdByNameLEP11CMsvSession7TPtrC16S2_i @ 11 NONAME
+	_ZN11CT_MsgUtils32CreateChildrenSelectionWithTypeLEP11CMsvSessionl4TUid @ 12 NONAME
+	_ZN11CT_MsgUtils36CreateChildrenSelectionRemoteFolderLEP11CMsvSession7TPtrC16S2_ @ 13 NONAME
+	_ZN11CT_MsgUtils44CreateChildrenSelectionRemoteFolderWithTypeLEP11CMsvSession7TPtrC16S2_4TUid @ 14 NONAME
+	_ZN11CT_MsgUtils9ReadDataLER15RFileReadStreamR6TPtr16iP13CArrayFixFlatItE @ 15 NONAME
+	_ZN11CT_MsgUtilsC1Ev @ 16 NONAME
+	_ZN11CT_MsgUtilsC2Ev @ 17 NONAME
+	_ZN16CT_MsgTimerUtils4NewLEv @ 18 NONAME
+	_ZN16CT_MsgTimerUtils5AfterEiR14TRequestStatus @ 19 NONAME
+	_ZN24CT_MsgUtilsEnumConverter18FindFolderIdByNameER7TDesC16 @ 20 NONAME
+	_ZN24CT_MsgUtilsEnumConverter21ConvertDesToTPop3CmdsERK7TDesC16 @ 21 NONAME
+	_ZN24CT_MsgUtilsEnumConverter22ConvertDesToTImap4CmdsER7TDesC16 @ 22 NONAME
+	_ZN24CT_MsgUtilsEnumConverter27ConvertDesToTFolderSyncTypeER7TDesC16 @ 23 NONAME
+	_ZN24CT_MsgUtilsEnumConverter29ConvertDesToTCommDbDialogPrefER7TDesC16 @ 24 NONAME
+	_ZN24CT_MsgUtilsEnumConverter31ConvertDesToTPop3GetMailOptionsER7TDesC16 @ 25 NONAME
+	_ZN24CT_MsgUtilsEnumConverter32ConvertDesToTFolderSubscribeTypeER7TDesC16 @ 26 NONAME
+	_ZN24CT_MsgUtilsEnumConverter32ConvertDesToTImap4GetMailOptionsER7TDesC16 @ 27 NONAME
+	_ZN24CT_MsgUtilsEnumConverter33ConvertDesToTImSMTPSendCopyToSelfER7TDesC16 @ 28 NONAME
+	_ZN24CT_MsgUtilsEnumConverter34ConvertDesToTMsgOutboxBodyEncodingER7TDesC16 @ 29 NONAME
+	_ZN24CT_MsgUtilsEnumConverter36ConvertDesToTImSMTPSendMessageOptionER7TDesC16 @ 30 NONAME
+	_ZN24CT_MsgUtilsEnumConverter38ConvertDesToTImImap4PartialMailOptionsER7TDesC16 @ 31 NONAME
+	_ZN24CT_MsgUtilsEnumConverterC1Ev @ 32 NONAME
+	_ZN24CT_MsgUtilsEnumConverterC2Ev @ 33 NONAME
+	_ZN28CT_MsgUtilsCentralRepository14GetPopAccountLER6TDes16R11TPopAccount @ 34 NONAME
+	_ZN28CT_MsgUtilsCentralRepository15GetImapAccountLER6TDes16R12TImapAccount @ 35 NONAME
+	_ZN28CT_MsgUtilsCentralRepository16GetPopServiceIdLER6TDes16 @ 36 NONAME
+	_ZN28CT_MsgUtilsCentralRepository17GetImapServiceIdLER6TDes16 @ 37 NONAME
+	_ZN28CT_MsgUtilsCentralRepository24GetDefaultSmtpServiceIdLEv @ 38 NONAME
+	_ZN28CT_MsgUtilsCentralRepositoryC1Ev @ 39 NONAME
+	_ZN28CT_MsgUtilsCentralRepositoryC2Ev @ 40 NONAME
+	_ZN28CT_MsgUtilsDeleteAllChildren19FinalProgressStatusER13CMsvOperationRK14TRequestStatus @ 41 NONAME
+	_ZN28CT_MsgUtilsDeleteAllChildren6StartLER14TRequestStatus @ 42 NONAME
+	_ZN28CT_MsgUtilsDeleteAllChildrenC1EP11CMsvSessionl @ 43 NONAME
+	_ZN28CT_MsgUtilsDeleteAllChildrenC2EP11CMsvSessionl @ 44 NONAME
+	_ZN32CT_MsgUtilsConfigFileMachineName10ConstructLERK7TDesC16 @ 45 NONAME
+	_ZN32CT_MsgUtilsConfigFileMachineName11MachineNameEv @ 46 NONAME
+	_ZN32CT_MsgUtilsConfigFileMachineName16MachineNameEmailEv @ 47 NONAME
+	_ZN32CT_MsgUtilsConfigFileMachineName4NewLERK7TDesC16 @ 48 NONAME
+	_ZN32CT_MsgUtilsConfigFileMachineName5NewLCERK7TDesC16 @ 49 NONAME
+	_ZN32CT_MsgUtilsConfigFileMachineNameC1Ev @ 50 NONAME
+	_ZN32CT_MsgUtilsConfigFileMachineNameC2Ev @ 51 NONAME
+	_ZN34CT_MsgUtilsConfigFileParserUtility10ConstructLERK7TDesC16 @ 52 NONAME
+	_ZN34CT_MsgUtilsConfigFileParserUtility16GetFieldAsStringERK7TDesC16R7TPtrC16 @ 53 NONAME
+	_ZN34CT_MsgUtilsConfigFileParserUtility17GetFieldAsIntegerERK7TDesC16Ri @ 54 NONAME
+	_ZN34CT_MsgUtilsConfigFileParserUtility17GetFieldAsString8ERK7TDesC16R6TPtrC8 @ 55 NONAME
+	_ZN34CT_MsgUtilsConfigFileParserUtility4NewLERK7TDesC16 @ 56 NONAME
+	_ZN34CT_MsgUtilsConfigFileParserUtilityC1Ev @ 57 NONAME
+	_ZN34CT_MsgUtilsConfigFileParserUtilityC2Ev @ 58 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile15CompareIapPrefsER17CImIAPPreferencesS1_ @ 59 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile17ReadPopIAPAndAddLEP34CT_MsgUtilsConfigFileParserUtilityRK7TDesC16R17CImIAPPreferences @ 60 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile18ReadImapIAPAndAddLEP34CT_MsgUtilsConfigFileParserUtilityRK7TDesC16R17CImIAPPreferences @ 61 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile18ReadSmtpIAPAndAddLEP34CT_MsgUtilsConfigFileParserUtilityRK7TDesC16R17CImIAPPreferences @ 62 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile22ReadPopIAPAndAddFieldLEP34CT_MsgUtilsConfigFileParserUtilityRK7TDesC16R17CImIAPPreferences @ 63 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile23ReadImapIAPAndAddFieldLEP34CT_MsgUtilsConfigFileParserUtilityRK7TDesC16R17CImIAPPreferences @ 64 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile23ReadSmtpIAPAndAddFieldLEP34CT_MsgUtilsConfigFileParserUtilityRK7TDesC16R17CImIAPPreferences @ 65 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile37ReadPopSettingsFromConfigurationFileLER7TDesC16R15CImPop3SettingsR17CImIAPPreferencesRKS0_ @ 66 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile38ReadImapSettingsFromConfigurationFileLER7TDesC16R16CImImap4SettingsR17CImIAPPreferencesRKS0_ @ 67 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile38ReadSmtpSettingsFromConfigurationFileLER7TDesC16R15CImSmtpSettingsR17CImIAPPreferencesRKS0_ @ 68 NONAME
+	_ZN42CT_MsgUtilsReadEmailSettingsFromConfigFile9GetStringER7TDesC16RiiR7TPtrC16 @ 69 NONAME
+	_ZTI16CT_MsgTimerUtils @ 70 NONAME ; #<TI>#
+	_ZTI28CT_MsgUtilsDeleteAllChildren @ 71 NONAME ; #<TI>#
+	_ZTI32CT_MsgUtilsConfigFileMachineName @ 72 NONAME ; #<TI>#
+	_ZTI34CT_MsgUtilsConfigFileParserUtility @ 73 NONAME ; #<TI>#
+	_ZTV16CT_MsgTimerUtils @ 74 NONAME ; #<VT>#
+	_ZTV28CT_MsgUtilsDeleteAllChildren @ 75 NONAME ; #<VT>#
+	_ZTV32CT_MsgUtilsConfigFileMachineName @ 76 NONAME ; #<VT>#
+	_ZTV34CT_MsgUtilsConfigFileParserUtility @ 77 NONAME ; #<VT>#
+	_ZN24CT_MsgUtilsEnumConverter21ConvertDesToEventCodeER7TDesC16 @ 78 NONAME
+	_ZN24CT_MsgUtilsEnumConverter22ConvertDesToTSmtpCmdsLER7TDesC16 @ 79 NONAME
+	_ZN11CT_MsgUtils23SearchMessageBySubjectLEP11CMsvSessionl7TPtrC16i @ 80 NONAME
+	_ZN24CT_MsgUtilsEnumConverter23ConvertDesToBearerTypesERK7TDesC16 @ 81 NONAME
+	_ZN28CT_MsgUtilsCentralRepository15GetSmtpAccountLER6TDes16R12TSmtpAccount @ 82 NONAME
+	_ZN28CT_MsgUtilsCentralRepository17GetSmtpServiceIdLER6TDes16 @ 83 NONAME
+	_ZN28CT_MsgUtilsDeleteAllChildren6StartLEiR14TRequestStatus @ 84 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/eabi/messagingtestutility2u.def	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,14 @@
+EXPORTS
+	_ZN28RMessagingTestUtilityServer210DeleteFileERK7TDesC16 @ 1 NONAME
+	_ZN28RMessagingTestUtilityServer210FileExistsERK7TDesC16 @ 2 NONAME
+	_ZN28RMessagingTestUtilityServer211KillProcessE10TProcessId @ 3 NONAME
+	_ZN28RMessagingTestUtilityServer215EventHandlerAddERK7TDesC16S2_ @ 4 NONAME
+	_ZN28RMessagingTestUtilityServer216EventHandlerInitEv @ 5 NONAME
+	_ZN28RMessagingTestUtilityServer217EventHandlerCheckEv @ 6 NONAME
+	_ZN28RMessagingTestUtilityServer218DeleteMessageStoreEl @ 7 NONAME
+	_ZN28RMessagingTestUtilityServer25MkDirERK7TDesC16 @ 8 NONAME
+	_ZN28RMessagingTestUtilityServer25RmDirERK7TDesC16 @ 9 NONAME
+	_ZN28RMessagingTestUtilityServer27ConnectEv @ 10 NONAME
+	_ZN28RMessagingTestUtilityServer27GetDirLERK7TDesC16jjRP4CDir @ 11 NONAME
+	_ZN28RMessagingTestUtilityServer28CopyFileERK7TDesC16S2_ @ 12 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/group/T_Utils.mmp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,54 @@
+// Copyright (c) 2004-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// @file T_Utils.mmp
+// 
+//
+
+
+TARGET			t_msgutilityserver.dll
+TARGETPATH		/system/libs
+TARGETTYPE		DLL
+
+CAPABILITY ALL -TCB
+
+UID			0 0x10274071
+VENDORID 		0x70000001
+
+
+SYSTEMINCLUDE 	/epoc32/include
+
+
+USERINCLUDE	../inc
+SOURCEPATH	../src
+SOURCE		T_TimerUtils.cpp
+SOURCE		T_Utils.cpp
+SOURCE		T_UtilsCentralRepository.cpp
+SOURCE		T_UtilsConfigFileMachineName.cpp
+SOURCE		T_UtilsConfigFileParserUtility.cpp
+SOURCE		T_UtilsDeleteAllChildren.cpp
+SOURCE		T_UtilsEnumConverter.cpp
+SOURCE		T_UtilsReadEmailSettingsFromConfigFile.cpp
+
+
+LIBRARY 		testexecuteutils.lib
+LIBRARY			testexecutelogclient.lib
+LIBRARY			imut.lib 
+LIBRARY			bafl.lib
+LIBRARY			etext.lib
+LIBRARY			estor.lib 
+LIBRARY			msgs.lib
+LIBRARY			euser.lib
+LIBRARY			imcm.lib
+LIBRARY			efsrv.lib
+LIBRARY			charconv.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/group/bld.inf	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,31 @@
+// Copyright (c) 2005-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// bld.inf file for the Integ Test Pop server
+// 
+//
+ 
+PRJ_TESTMMPFILES
+T_Utils.mmp
+
+
+PRJ_TESTEXPORTS
+../inc/T_Utils.h					/epoc32/include/t_utils.h	
+../inc/T_UtilsEnumConverter.h				/epoc32/include/t_utilsenumconverter.h
+../inc/T_UtilsConfigFileParserUtility.h			/epoc32/include/t_utilsconfigfileparserutility.h	
+../inc/T_UtilsCentralRepository.h			/epoc32/include/t_utilscentralrepository.h	
+../inc/T_UtilsReadEmailSettingsFromConfigFile.h		/epoc32/include/t_utilsreademailsettingsfromconfigfile.h
+../inc/T_UtilsConfigFileMachineName.h			/epoc32/include/t_utilsconfigfilemachinename.h
+../inc/T_TimerUtils.h					/epoc32/include/t_timerutils.h
+../inc/T_UtilsDeleteAllChildren.h			/epoc32/include/t_utilsdeleteallchildren.h
+../inc/t_testinstrumentation.h				/epoc32/include/t_testinstrumentation.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/inc/T_TimerUtils.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,55 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file which contains the utility functions for the CTimer derived objects
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_TIMER_UTILS_H__
+#define __T_TIMER_UTILS_H__
+
+
+// epoc includes
+#include <e32base.h>
+
+/**
+This class provides the implementation of the Timer utilities
+*/
+class CT_MsgTimerUtils : public CTimer
+	{
+public:
+	IMPORT_C static CT_MsgTimerUtils* NewL();
+	~CT_MsgTimerUtils();
+	IMPORT_C void After(TInt aSec,TRequestStatus& aStatus);
+
+protected:
+	void RunL();
+
+private:
+	CT_MsgTimerUtils();
+
+private:
+	TRequestStatus* iRequestStatus;
+	};
+#endif //__T_TIMER_UTILS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/inc/T_Utils.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,109 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file which contains the common utility functions
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_UTILS_H__
+#define __T_UTILS_H__
+
+
+// Epoc includes
+#include <msvapi.h>
+
+// Forward Declaration
+class RResourceFile;
+
+/**
+Implements a class to contain the utility functions required across servers
+*/
+class CT_MsgUtils
+	{	
+public:
+	IMPORT_C CT_MsgUtils();
+	~CT_MsgUtils();
+
+	// Returns the EntryID of the entry based on the entry name
+	IMPORT_C static TMsvId FindEntryByNameL(CMsvSession* aSession, TMsvId aParentId, TDesC& aEntryName, TBool aCaseSensitive = EFalse);
+	 
+	// Returns the EntryID of the entry based on the entry name and entry parent name
+	IMPORT_C static TMsvId FindEntryByNameL(CMsvSession* aSession, TMsvId aParentId, TDesC& aEntryName, TDesC& aParentEntryName, TBool aCaseSensitive = EFalse);
+	
+	// Returns the EntryId of the entry based on the entry name under the given parent entry
+	IMPORT_C static TMsvId FindEntryByNameL(CMsvEntry* aEntry,TDesC& aEntryName, TBool aCaseSensitive = EFalse);
+	
+	// Returns the EntryID of the entry based on the entry name and entry parent name under the given parent entry
+	IMPORT_C static TMsvId FindEntryByNameL(CMsvEntry* aEntry,TDesC& aEntryName, TDesC& aParentEntryName, TBool aCaseSensitive = EFalse);
+
+	// Creates a selection of the children
+	IMPORT_C static CMsvEntrySelection* CreateChildrenSelectionL(CMsvSession* aSession, TMsvId aEntryId);
+
+	// Creates a selection of the children with a specified type
+	IMPORT_C static CMsvEntrySelection* CreateChildrenSelectionWithTypeL(CMsvSession* aSession, TMsvId aEntryId, TUid aType);
+
+	// Returns a selection of the child entries under the specified remote folder
+	IMPORT_C static CMsvEntrySelection*  CreateChildrenSelectionRemoteFolderL(CMsvSession* aSession,TPtrC aAccountName,
+															TPtrC aFolderName);
+
+	// Returns a selection of the child entries under the specified remote folder with a specified type
+	IMPORT_C static CMsvEntrySelection*  CreateChildrenSelectionRemoteFolderWithTypeL(CMsvSession* aSession,TPtrC aAccountName,
+															TPtrC aFolderName, TUid aType);
+									
+	// Searches for a given entry under the specified remote folder Id for IMAP
+	IMPORT_C static TMsvId GetRemoteFolderIdByNameL(CMsvSession* aSession,TPtrC aAccountName,TPtrC aFolderName, TBool aCaseSensitive = EFalse);
+	
+	// Searches for a given entry under the specified remote folder Id for IMAP - overloaded version with parent folder name
+	IMPORT_C static TMsvId GetRemoteFolderIdByNameL(CMsvSession* aSession,TPtrC aAccountName,TPtrC aFolderName, TPtrC aParentFolderName, TBool aCaseSensitive = EFalse);
+
+	// Searches for a message in a given folder based ont he message subject
+	IMPORT_C static TMsvId SearchMessageBySubjectL(CMsvSession* aSession, TMsvId afolderId, TPtrC aSubject);
+	
+	// Searches for a message in a given folder based ont he message subject ..overloaded
+	IMPORT_C static TMsvId SearchMessageBySubjectL(CMsvSession* aSession,TMsvId afolderId,TPtrC aSubject, TBool aVisibleFlag);
+	
+	// Compares two input files
+	IMPORT_C static TInt CompareFilesL(TPtrC aFileOne, TPtrC aFileTwo, TBool aIsUnicode,CArrayFixFlat<TUint16>* aIgnoreCharList,
+																			TBool& aDiffFlag);
+
+	// Reads data chunk from the file stream.Returns ETrue if the EOF found.
+	IMPORT_C static TBool ReadDataL(RFileReadStream& aFileReadStream,TPtr& aPtrLineBuffer, TBool aIsUnicode, 
+																	CArrayFixFlat<TUint16>* aIgnoreCharList);
+
+	IMPORT_C static void OpenResourceFileL(RResourceFile& rFile, RFs& anFs, const TDesC& aFileName );
+ 		
+ 	//Closes the Open Resource File
+ 	IMPORT_C static void CloseResourceFile( TAny* aFile );
+ 	
+ private:
+ 	// Recursively searches the EntryID of the entry based on the entry name
+ 	TMsvId static RecFindEntryByNameL(CMsvEntry& aEntry, TDesC& aEntryName, TBool aCaseSensitive);
+ 	
+ 	// Recursively searches the EntryID of the entry based on the entry name and parent entry name
+ 	TMsvId static RecFindEntryByNameL(CMsvEntry& aEntry, TDesC& aEntryName, TDesC& aParentEntryName, TBool aCaseSensitive);
+ 	
+ 	// Checks if the given parent name matches the name of the given parent entry
+ 	TBool static CheckParent(CMsvEntry& aParentEntry, TDesC& aParentEntryName);
+	};
+#endif //__T_UTILS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/inc/T_UtilsCentralRepository.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,56 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the header file for CT_MsgUtilsCentralRepository class and
+// contains the common utility functions that use the Central Repository
+// 
+//
+
+#ifndef __T_UTILS_CENTRAL_REPOSITORY_H__
+#define __T_UTILS_CENTRAL_REPOSITORY_H__
+
+
+// epoc includes
+#include <cemailaccounts.h>
+
+/**
+Implements the utility functions related to the Central Repository
+*/
+class CT_MsgUtilsCentralRepository
+	{	
+public:
+	IMPORT_C CT_MsgUtilsCentralRepository();
+	~CT_MsgUtilsCentralRepository();
+
+	// Gets the Imap service Id based on the account name
+	IMPORT_C static TMsvId GetImapServiceIdL(TDes& aAccountName);
+
+	// Gets the Pop service Id based on the account name
+	IMPORT_C static TMsvId GetPopServiceIdL(TDes& aAccountName);
+	
+	// Gets the Smtp service Id based on the account name
+	IMPORT_C static TMsvId GetSmtpServiceIdL(TDes& aAccountName);
+
+	// Gets the default Smtp service Id
+	IMPORT_C static TMsvId GetDefaultSmtpServiceIdL();
+	
+	// Checks if the specified Imap account is present in the Central Repository
+	IMPORT_C static TBool GetImapAccountL( TDes& aAccountName, TImapAccount& aImapAccount );
+
+	// Checks if the specified Pop account is present in the Central Repository
+	IMPORT_C static TBool GetPopAccountL( TDes& aAccountName, TPopAccount& aPopAccount );
+	
+	// Checks if the specified Smtp account is present in the Central Repository
+	IMPORT_C static TBool GetSmtpAccountL(TDes& aAccountName, TSmtpAccount& aSmtpAccount);
+	};
+#endif //__T_UTILS_CENTRAL_REPOSITORY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/inc/T_UtilsConfigFileMachineName.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,59 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file for CT_MsgUtilsConfigFileMachineName 
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_UTILS_CONFIG_FILE_MACHINE_NAME_H__
+#define __T_UTILS_CONFIG_FILE_MACHINE_NAME_H__
+
+
+// epoc includes
+#include <e32base.h>
+
+
+/**
+CT_MsgUtilsConfigFileMachineName is an utility class, can be used 
+to create automatic email acounts using the machine name.
+*/
+class CT_MsgUtilsConfigFileMachineName : public CBase
+	{
+public:
+	IMPORT_C static CT_MsgUtilsConfigFileMachineName* NewL(const TDesC& aPtrEmailAdd);
+	IMPORT_C static CT_MsgUtilsConfigFileMachineName* NewLC(const TDesC& aPtrEmailAdd);
+   ~CT_MsgUtilsConfigFileMachineName();
+
+	IMPORT_C const TDesC8& MachineName();
+	IMPORT_C const TDesC& MachineNameEmail();
+
+private:
+	IMPORT_C CT_MsgUtilsConfigFileMachineName();
+	IMPORT_C void ConstructL(const TDesC& aPtrEmailAdd); 
+
+private:
+	HBufC8* iMachineName;
+	HBufC* iMachineNameEmail;
+	};
+#endif //__T_UTILS_CONFIG_FILE_MACHINE_NAME_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/inc/T_UtilsConfigFileParserUtility.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,60 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file for CT_MsgUtilsConfigFileParserUtility class
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+
+#ifndef __T_UTILS_CONFIG_FILE_PARSER_UTILITY_H__
+#define __T_UTILS_CONFIG_FILE_PARSER_UTILITY_H__
+
+
+// epoc includes
+#include <e32base.h>
+
+
+/**
+This utility class used to parse a .txt(Email settings) file.
+*/
+class CT_MsgUtilsConfigFileParserUtility : public CBase
+	{
+public:
+	 IMPORT_C static CT_MsgUtilsConfigFileParserUtility* NewL(const TDesC& aFileName);
+	~CT_MsgUtilsConfigFileParserUtility();
+	
+	IMPORT_C TInt GetFieldAsInteger(const TDesC& aFieldName, TInt& aValue);
+	IMPORT_C TInt GetFieldAsString(const TDesC& aFieldName, TPtrC& aString);
+	IMPORT_C TInt GetFieldAsString8(const TDesC& aFieldName, TPtrC8& aString);
+
+private:
+	IMPORT_C CT_MsgUtilsConfigFileParserUtility();
+	IMPORT_C void ConstructL(const TDesC& aFileName); 
+
+private:
+	RPointerArray<HBufC> iName;
+	RPointerArray<HBufC> iContent;
+	RPointerArray<HBufC8> iContent8;
+	};
+#endif //__T_UTILS_CONFIG_FILE_PARSER_UTILITY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/inc/T_UtilsDeleteAllChildren.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,88 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file for CT_MsgUtilsDeleteAllChildren
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_UTILS_DELETE_ALL_CHILDREN_H__
+#define __T_UTILS_DELETE_ALL_CHILDREN_H__
+
+
+// epoc includes
+#include <msvids.h>
+
+// Forward Declaration
+class CMsvSession;
+class CMsvOperation;
+
+
+/**
+Implements a utilty that performs deletion of all the children entries
+*/
+class CT_MsgUtilsDeleteAllChildren : public CActive
+	{
+public:
+	IMPORT_C CT_MsgUtilsDeleteAllChildren(CMsvSession* aSession,TMsvId aParentId = KMsvRootIndexEntryId);
+   ~CT_MsgUtilsDeleteAllChildren();
+
+	IMPORT_C void StartL(TRequestStatus& aStatus);
+	IMPORT_C void StartL(TBool aBlockDelete, TRequestStatus& aStatus);
+	
+	// Returns the number of the children entries that are not deleted
+	TInt Undeleted() {return (iUndeletedChildren);}
+	
+	// Gets information about a completed operation.
+	IMPORT_C TInt FinalProgressStatus(CMsvOperation& aOperation,const TRequestStatus& aStatus);
+
+protected:
+	void DoCancel();
+	void RunL();
+
+private:
+	CMsvSession* iSession;
+	TMsvId iParentId;
+	CMsvEntry* iEntry;
+	CMsvEntrySelection*	iSelection;
+	TRequestStatus* iRequestStatus;
+	TInt iTotalChildren;
+	TInt iCurrentChild;
+	TInt iUndeletedChildren;
+	CMsvOperation* iOperation;
+
+private:
+	enum State
+		{
+		EStateThisLevel,
+		EStateNextLevel,
+		EBlockDelete
+		};
+	TInt iState;
+
+private:
+	CT_MsgUtilsDeleteAllChildren* iNextLevel;
+	};
+
+
+#endif //__T_UTILS_DELETE_ALL_CHILDREN_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/inc/T_UtilsEnumConverter.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,115 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file which contains the utility to map the string to the 
+* corresponding enumerator value
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+
+#ifndef __T_UTILS_ENUM_CONVERTER_H__
+#define __T_UTILS_ENUM_CONVERTER_H__
+
+
+// User Include
+#include <t_testinstrumentation.h>
+
+// epoc inlcudes
+#include <cdbcols.h>
+#include <imapset.h>
+#include <smtpset.h>
+#include <pop3set.h>
+#include <imapcmds.h>
+#include <smtpcmds.h>
+
+// STR_SWITCH... STR_CASE... STR_SWITCH_END macro can be used as 
+// switch case that would take string.
+#define STR_SWITCH(str)  {\
+        TBuf<100> __ps(str);\
+        while(1) {
+
+#define STR_SWITCH_END()  break; } }
+
+#define STR_CASE(str) if(__ps == str)
+
+#define DEFAULT_CASE()
+
+
+/**
+CT_MsgUtilsEnumConverter is utility class used to map the string to the 
+corresponding enumerator value.
+*/
+class CT_MsgUtilsEnumConverter
+	{
+public:
+	IMPORT_C CT_MsgUtilsEnumConverter();
+	~CT_MsgUtilsEnumConverter();
+	
+	//Utility functions
+
+	// Maps the local folder names to the corresponding folder Ids
+	IMPORT_C static TMsvId FindFolderIdByName( TDesC& aFolderName );
+
+	// Maps the  pop3 command names with the corresponding values
+	IMPORT_C static TPop3Cmds ConvertDesToTPop3Cmds( const TDesC& aPopCmdName );
+
+	// Maps the  Imap4 command names with the corresponding values
+	IMPORT_C static TImap4Cmds ConvertDesToTImap4Cmds(TDesC& aImapCmdName);
+	
+	// Maps the  SMTP command names with the corresponding values
+	IMPORT_C static TSmtpCmds ConvertDesToTSmtpCmdsL(TDesC& aSmtpCmdName);
+
+	// Maps the TCommDbDialogPref enumerations		
+	IMPORT_C static TCommDbDialogPref ConvertDesToTCommDbDialogPref( TDesC& aDialogPrefStr );
+	
+	// Maps the TImap4GetMailOptions enumerations	
+	IMPORT_C static TImap4GetMailOptions ConvertDesToTImap4GetMailOptions( TDesC& aMailOption );
+
+	// Maps the TFolderSyncType Enumerations	
+	IMPORT_C static TFolderSyncType ConvertDesToTFolderSyncType( TDesC& aFolderSyncType );
+	
+	// Maps the TFolderSubscribeType Enumerations	
+	IMPORT_C static TFolderSubscribeType ConvertDesToTFolderSubscribeType( TDesC& aFolderSubscriberType );
+
+	// Maps the TImImap4PartialMailOptions Enumerations
+	IMPORT_C static TImImap4PartialMailOptions ConvertDesToTImImap4PartialMailOptions( TDesC& aPartialMailOption );
+
+	// Maps the TMsgOutboxBodyEncoding enumerations							
+	IMPORT_C static TMsgOutboxBodyEncoding ConvertDesToTMsgOutboxBodyEncoding( TDesC& aOutboxBodyEncoding );  
+
+	// Maps the TImSMTPSendMessageOption Enumerations
+	IMPORT_C static TImSMTPSendMessageOption ConvertDesToTImSMTPSendMessageOption( TDesC& aSendMsgOption );
+
+	// Maps the TImSMTPSendCopyToSelf Enumerations
+	IMPORT_C static TImSMTPSendCopyToSelf ConvertDesToTImSMTPSendCopyToSelf( TDesC& aSmtpCopyToSelf );
+	
+	// Maps the TPop3GetMailOptions Enumerations
+	IMPORT_C static TPop3GetMailOptions ConvertDesToTPop3GetMailOptions( TDesC& aPop3MailOption );
+
+	// Maps the Eventcode strings to their numeric value
+	IMPORT_C static TInstrumentationPoint ConvertDesToEventCode(TDesC& aEventCodeString);
+
+	// Maps bearer types strings to their numeric values
+	IMPORT_C static TUint32 ConvertDesToBearerTypes(const TDesC& aBearerTypesString);
+	};
+#endif //__T_UTILS_ENUM_CONVERTER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/inc/T_UtilsReadEmailSettingsFromConfigFile.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,87 @@
+/**
+* Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This is the header file for CT_MsgUtilsReadEmailSettingsFromConfigFile
+* 
+*
+*/
+
+
+
+
+
+/**
+ @file
+*/
+
+ 
+#ifndef __T_READ_EMAIL_SETTINGS_FROM_CONFIG_FILE_H__
+#define __T_READ_EMAIL_SETTINGS_FROM_CONFIG_FILE_H__
+
+_LIT(KNone, "NONE");
+
+// Forward declarations
+class CImIAPPreferences;
+class CImImap4Settings;
+class CImPop3Settings;
+class CImSmtpSettings;
+class CT_MsgUtilsConfigFileParserUtility;
+class TImapAccount;
+
+
+/**
+CT_MsgUtilsReadEmailSettingsFromConfigFile is the utility class used to read the
+fields from the configuration/setting file and and update the set the data members of 
+CImImap4Settings, CImPop3Settings, CImSmtpSettings and CImIAPPreferences objects.
+*/
+class CT_MsgUtilsReadEmailSettingsFromConfigFile
+	{
+public:	
+	CT_MsgUtilsReadEmailSettingsFromConfigFile() {};
+	
+	~CT_MsgUtilsReadEmailSettingsFromConfigFile() {};
+	
+	IMPORT_C static TBool CompareIapPrefs(CImIAPPreferences& prefs1, CImIAPPreferences& prefs2);
+	
+	IMPORT_C static void ReadImapSettingsFromConfigurationFileL(TDesC& aSettingsFile,
+							CImImap4Settings& aImapSet, CImIAPPreferences& aImapIapPref, const TDesC& aPtrEmailAdd = KNone());
+										
+	IMPORT_C static void ReadPopSettingsFromConfigurationFileL(TDesC& aSettingsFile,
+							CImPop3Settings& aPopSet, CImIAPPreferences& aPopIapPref, const TDesC& aPtrEmailAdd = KNone());
+										
+	IMPORT_C static void ReadSmtpSettingsFromConfigurationFileL(TDesC& aSettingsFile,
+							CImSmtpSettings& aSmtpSet, CImIAPPreferences& aSmtpIapPref,const TDesC& aPtrEmailAdd = KNone());
+	
+private:
+	IMPORT_C static void ReadImapIAPAndAddL(CT_MsgUtilsConfigFileParserUtility* aScriptFileParser,
+			const TDesC& aParamListName, CImIAPPreferences& aIapPref);
+			
+	IMPORT_C static void ReadImapIAPAndAddFieldL(CT_MsgUtilsConfigFileParserUtility* aScriptFileParser, 
+			const TDesC& aFieldName, CImIAPPreferences& aIapPref);
+	
+	IMPORT_C static void ReadPopIAPAndAddL(CT_MsgUtilsConfigFileParserUtility* aScriptFileParser,
+			const TDesC& aParamListName, CImIAPPreferences& aIapPref);
+			
+	IMPORT_C static void ReadPopIAPAndAddFieldL(CT_MsgUtilsConfigFileParserUtility* aScriptFileParser, 
+			const TDesC& aFieldName, CImIAPPreferences& aIapPref);
+			
+	IMPORT_C static void ReadSmtpIAPAndAddL(CT_MsgUtilsConfigFileParserUtility* aScriptFileParser, 
+			const TDesC& aParamListName, CImIAPPreferences& aSmtpIapPref);
+			
+	IMPORT_C static void ReadSmtpIAPAndAddFieldL(CT_MsgUtilsConfigFileParserUtility* aScriptFileParser, 
+			const TDesC& aFieldName, CImIAPPreferences& aIapPref);
+			
+	IMPORT_C static TBool GetString(TDesC& aStringPtr, TInt& aStart, TInt aEnd, TPtrC& aBaseString);
+	};
+#endif //__T_READ_EMAIL_SETTINGS_FROM_CONFIG_FILE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/inc/t_testinstrumentation.h	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2007-2009 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 "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* @file t_testInstrumentation.h
+* This contains the list of event codes that are used to identify a particular event.
+* These event codes are used by the EvenlogServer to generate a specif type of log for a specific event.
+* 
+*
+*/
+
+
+
+
+
+
+#ifndef __TEST_INSTRUMENTATION_H__
+#define __TEST_INSTRUMENTATION_H__
+
+//	Epoc Include
+#include <e32base.h>
+
+/** 
+List of event codes.
+*/
+	enum TInstrumentationPoint
+		{
+		// Event codes 0 to 20 has been reserved for error/specific condition
+		EBadEventCode			= 0,
+		EImapRamUsageStart		= 21,
+		EImapRamUsageStop,
+		EPopRamUsageStart		= 23,
+		EPopRamUsageStop,
+		ESmtpRamUsageStart		= 25,
+		ESmtpRamUsageStop,
+		ESmtpRamUsageCreateMessageStart = 27,
+		ESmtpRamUsageCreateMessageStop,
+		ESmtpRamUsageSendMessageStart	= 29,
+		ESmtpRamUsageSendMessageStop,
+		ESmtpCreateMessageSpeedStart	= 31,
+		ESmtpCreateMessageSpeedStop,
+		ESmtpSendMessageSpeedStart		= 33,
+		ESmtpSendMessageSpeedStop,
+		EImapDownloadMessageSpeedStart	= 35,
+		EImapDownloadMessageSpeedStop
+		};
+
+
+#endif /* __TEST_INSTRUMENTATION_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/src/T_TimerUtils.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,99 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the Cpp file which contains the utility functions for the CTimer derived objects
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// user include
+#include <t_timerutils.h>
+
+
+const TInt KValue={1000000};
+/**
+NewL()
+It performs the two phase construction and returns an object
+of type CT_MsgTimerUtils
+
+@leave KErrNoMemory
+@return
+Returns pointer to an object of CT_MsgTimerUtils
+*/
+EXPORT_C CT_MsgTimerUtils* CT_MsgTimerUtils::NewL()
+	{
+	CT_MsgTimerUtils* self = new (ELeave) CT_MsgTimerUtils();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CActiveScheduler::Add(self);
+	CleanupStack::Pop();
+	return self;
+	}
+	
+
+
+/**
+CT_MsgTimerUtils()
+Constructor
+*/
+CT_MsgTimerUtils::CT_MsgTimerUtils() : CTimer(EPriorityHigh)
+	{
+	}
+
+
+
+/**
+~CT_MsgTimerUtils()
+Destructor
+*/
+CT_MsgTimerUtils::~CT_MsgTimerUtils()
+	{
+	iRequestStatus = 0; //To Remove Lint Warning
+	}
+
+
+/**
+After()
+Calls the After function CTimer for the given number of secs
+
+@param aSec
+No. of seconds
+
+@param aStatus
+Completion status of a request
+
+@see CTimer::After()
+*/
+EXPORT_C void CT_MsgTimerUtils::After(TInt aSec,TRequestStatus& aStatus)
+	{
+	iRequestStatus = &aStatus;
+	aStatus = KRequestPending;
+	TTimeIntervalMicroSeconds32 interval = aSec*KValue;
+	CTimer::After(interval);
+	}
+
+
+/**
+RunL()
+Gives the status of the operation 
+*/
+void CT_MsgTimerUtils::RunL()
+	{
+	User::RequestComplete(iRequestStatus,iStatus.Int());
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/src/T_Utils.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,904 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the Cpp file which contains the utility functions common across the servers
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User includes
+#include <t_utils.h>
+#include <t_utilscentralrepository.h>
+
+// Epoc includes
+#include <msvids.h>
+#include <bautils.h>
+#include <msvutils.h>
+#include <barsc.h>
+
+
+// Literals Used
+const TInt KDefBufferSize = 1024;
+
+
+/**
+CT_MsgUtils()
+Constructor
+*/
+EXPORT_C CT_MsgUtils::CT_MsgUtils()
+	{
+	}
+
+
+/**
+~CT_MsgUtils()
+Constructor
+*/
+CT_MsgUtils::~CT_MsgUtils()
+	{
+	}
+
+/**
+OpenResourceFileL()
+Opens a resource File
+
+@param rFile
+Resource File Handle
+
+@param anFs
+File Session associated
+
+@param aFileName
+The Name of resource File to be opened
+*/
+EXPORT_C void CT_MsgUtils::OpenResourceFileL(RResourceFile& rFile, RFs& anFs, const TDesC& aFileName )
+ 	{
+ 	// open resource file
+ 	TFileName fileName(aFileName);
+ 	MsvUtils::AddPathAndExtensionToResFileL(fileName);
+ 	BaflUtils::NearestLanguageFile( anFs, fileName );
+ 	if (BaflUtils::FileExists(anFs,fileName))
+  		{
+ 		rFile.OpenL( anFs, fileName );
+  		return;
+  		}
+  	User::Leave(KErrNotFound);
+ 	}
+
+/**
+CloseResourceFile()
+Closes a recource File
+
+@param aFile
+The Name of resource File to be closed
+*/
+ EXPORT_C void CT_MsgUtils::CloseResourceFile( TAny* aFile )
+ 	{
+ 	((RResourceFile*)aFile)->Close();
+ 	}
+
+
+/**
+FindEntryByNameL()
+Search the entries under a given folder ID by name of the entry
+i.e, iDescription or iDetails value of an entry
+
+@param aSession
+Session object
+
+@param aParentId
+Parent Id under which the entry needs to be found
+
+@param aEntryName
+The entry name that needs to be found
+
+@leave KErrNotFound
+Leaves if no entry's iDescription or iDetails matches with aEntryName
+
+@return
+Id of the entry that match 
+*/
+EXPORT_C TMsvId CT_MsgUtils::FindEntryByNameL(CMsvSession* aSession, TMsvId aParentId, TDesC& aEntryName, TBool aCaseSensitive)
+	{
+	
+	TMsvId msgEntryId = KMsvNullIndexEntryId;
+
+	// Set the context to the Parent
+	CMsvEntry* entry = CMsvEntry::NewL(*aSession, aParentId,TMsvSelectionOrdering
+									(KMsvNoGrouping,EMsvSortByNone, ETrue));
+	CleanupStack::PushL(entry);
+	
+	entry->SetEntryL(aParentId);
+ 	
+ 	msgEntryId = FindEntryByNameL(entry, aEntryName, aCaseSensitive);
+ 	
+ 	CleanupStack::PopAndDestroy(entry);
+ 	
+ 	return msgEntryId;
+	}
+
+
+/**
+FindEntryByNameL()
+Search the entries under a given folder ID by name of the entry
+i.e, iDescription or iDetails value of an entry
+
+@param aSession
+Session object
+
+@param aParentId
+Parent Id under which the entry needs to be found
+
+@param aEntryName
+The entry name that needs to be found
+
+@param aParentEntryName
+The Parent entry name that needs to be matched with the entry found
+
+@leave KErrNotFound
+Leaves if no entry's iDescription or iDetails matches with aEntryName
+
+@return
+Id of the entry that match 
+*/
+EXPORT_C TMsvId CT_MsgUtils::FindEntryByNameL(CMsvSession* aSession, TMsvId aParentId, TDesC& aEntryName, TDesC& aParentEntryName, TBool aCaseSensitive)
+	{
+	
+	TMsvId msgEntryId = KMsvNullIndexEntryId;
+	
+	// Set the context to the Parent
+	CMsvEntry* entry = CMsvEntry::NewL(*aSession, aParentId,TMsvSelectionOrdering
+									(KMsvNoGrouping,EMsvSortByNone, ETrue));
+	CleanupStack::PushL(entry);
+	
+	entry->SetEntryL(aParentId);
+
+ 	msgEntryId = FindEntryByNameL(entry, aEntryName, aParentEntryName, aCaseSensitive);
+ 	
+ 	CleanupStack::PopAndDestroy(entry);
+ 	
+ 	return msgEntryId;
+	}
+
+
+/**
+FindEntryByNameL()
+Search the entries under a given entry(an object of CMsvEntry) by name of the entry
+i.e, iDescription or iDetails value of an entry
+
+@param aEntry	
+Parent entry under which the given entry needs to be searched
+
+@param aEntryName
+The entry name that needs to be found
+
+@leave KErrNotFound
+Leaves if no entry's iDescription or iDetails matches with aEntryName
+
+@return
+Id of the entry that match 
+*/
+EXPORT_C TMsvId  CT_MsgUtils::FindEntryByNameL(CMsvEntry* aEntry,TDesC& aEntryName, TBool aCaseSensitive)
+	{
+	TMsvId msgEntryId = KMsvNullIndexEntryId;
+	
+	msgEntryId = RecFindEntryByNameL(*aEntry, aEntryName, aCaseSensitive);
+	
+	if(msgEntryId == KMsvNullIndexEntryId)
+		{
+		User::Leave(KErrNotFound);
+		}
+
+	return msgEntryId;
+	}
+
+
+/**
+FindEntryByNameL()
+Search the entries under a given entry(an object of CMsvEntry) by name of the entry
+i.e, iDescription or iDetails value of an entry
+
+@param aEntry	
+Parent entry under which the given entry needs to be searched
+
+@param aEntryName
+The entry name that needs to be found
+
+@param aParentEntryName
+The Parent entry name that needs to be matched with the entry found
+
+@leave KErrNotFound
+Leaves if no entry's iDescription or iDetails matches with aEntryName
+
+@return
+Id of the entry that match 
+*/
+EXPORT_C TMsvId  CT_MsgUtils::FindEntryByNameL(CMsvEntry* aEntry,TDesC& aEntryName, TDesC& aParentEntryName, TBool aCaseSensitive)
+	{
+	TMsvId msgEntryId = KMsvNullIndexEntryId;
+	
+	msgEntryId = RecFindEntryByNameL(*aEntry, aEntryName, aParentEntryName, aCaseSensitive);
+	
+	if(msgEntryId == KMsvNullIndexEntryId)
+		{
+		User::Leave(KErrNotFound);
+		}
+
+	return msgEntryId;
+	}
+
+
+/**
+RecFindEntryByNameL()
+Recursively search the entries (including all sub entries) under a given entry (an object of CMsvEntry) 
+by name of the entry i.e, iDescription or iDetails value of an entry
+
+@param aEntry	
+Parent entry under which the given entry needs to be searched
+
+@param aEntryName
+The entry name that needs to be found
+
+@leave KErrNotFound
+Leaves if no entry's iDescription or iDetails matches with aEntryName
+
+@return
+Id of the entry that match 
+*/
+TMsvId  CT_MsgUtils::RecFindEntryByNameL(CMsvEntry& aEntry, TDesC& aEntryName, TBool aCaseSensitive)
+ 	{
+ 
+ 	TMsvId msgEntryId = KMsvNullIndexEntryId;
+ 	
+ 	CMsvEntrySelection* selection = aEntry.ChildrenL();
+ 	CleanupStack::PushL(selection);
+ 	// Search for the entry in the children selection, based on the entry name given
+ 	TBool	found = EFalse;
+ 	TInt count = selection->Count();
+ 	for (TInt index = 0; (index<count) && (!found); index++)
+ 		{
+  		// Set the context to the child entry
+  		aEntry.SetEntryL((*selection)[index]);
+
+		if (aCaseSensitive)
+			{
+			if (( aEntryName.Compare( aEntry.Entry().iDescription ) == 0 ) ||
+			    ( aEntryName.Compare( aEntry.Entry().iDetails ) == 0 ))
+				{
+				found = ETrue;
+				}
+			}
+		else if (( aEntryName.CompareF( aEntry.Entry().iDescription ) == 0 ) ||
+		         ( aEntryName.CompareF( aEntry.Entry().iDetails ) == 0 ))
+			{
+			found = ETrue;
+			}
+
+		if (found)
+			{
+			msgEntryId = (*selection)[index];
+			}
+		else
+			{
+			CMsvEntry* nextEntry = CMsvEntry::NewL(aEntry.Session(), (*selection)[index],TMsvSelectionOrdering(KMsvNoGrouping, EMsvSortByNone, ETrue));
+			CleanupStack::PushL(nextEntry);
+
+			msgEntryId = RecFindEntryByNameL(*nextEntry, aEntryName, aCaseSensitive);
+			if(msgEntryId != KMsvNullIndexEntryId)
+				{
+				found = ETrue;
+				}
+   		CleanupStack::PopAndDestroy(nextEntry);  
+   		}
+ 		}
+		
+ 	CleanupStack::PopAndDestroy(selection);
+ 	return msgEntryId;
+ 	}
+
+
+/**
+RecFindEntryByNameL()
+Recursively search the entries (including all sub entries) under a given entry (an object of CMsvEntry) 
+by name of the entry i.e, iDescription or iDetails value of an entry
+
+@param aEntry	
+Parent entry under which the given entry needs to be searched
+
+@param aEntryName
+The entry name that needs to be found
+
+@param aParentEntryName
+The Parent entry name that needs to be matched with the entry found
+
+@leave KErrNotFound
+Leaves if no entry's iDescription or iDetails matches with aEntryName
+
+@return
+Id of the entry that match 
+*/
+TMsvId  CT_MsgUtils::RecFindEntryByNameL(CMsvEntry& aEntry, TDesC& aEntryName, TDesC& aParentEntryName, TBool aCaseSensitive)
+ 	{
+ 	TMsvId msgEntryId = KMsvNullIndexEntryId;
+ 	
+ 	CMsvEntrySelection* selection = aEntry.ChildrenL();
+ 	CleanupStack::PushL(selection);
+ 	// Search for the entry in the children selection, based on the entry name given
+ 	TBool	found = EFalse;
+ 	TInt count = selection->Count();
+	TBool matched = EFalse;
+ 	
+ 	for (TInt index = 0; (index<count) && (!found); index++)
+ 		{
+  		// Set the context to the child entry
+  		aEntry.SetEntryL((*selection)[index]);
+
+		matched = EFalse;
+
+		if (aCaseSensitive)
+			{
+			if (( aEntryName.Compare( aEntry.Entry().iDescription ) == 0 ) ||
+			    ( aEntryName.Compare( aEntry.Entry().iDetails ) == 0 ))
+				{
+				matched = ETrue;
+				}
+			}
+		else if (( aEntryName.CompareF( aEntry.Entry().iDescription ) == 0 ) ||
+		         ( aEntryName.CompareF( aEntry.Entry().iDetails ) == 0 ))
+			{
+			matched = ETrue;
+			}
+
+		if (matched)
+			{
+			//Check Parent
+			CMsvEntry* parentEntry = CMsvEntry::NewL(aEntry.Session(), aEntry.Entry().Parent(),TMsvSelectionOrdering(KMsvNoGrouping, EMsvSortByNone, ETrue));
+			CleanupStack::PushL(parentEntry);
+
+			if(CheckParent(*parentEntry,aParentEntryName))
+				{
+				found = ETrue;
+				msgEntryId = (*selection)[index];
+				}
+			CleanupStack::PopAndDestroy(parentEntry);
+			}
+
+		if (!found)
+			{
+			CMsvEntry* nextEntry = CMsvEntry::NewL(aEntry.Session(), (*selection)[index],TMsvSelectionOrdering(KMsvNoGrouping, EMsvSortByNone, ETrue));
+			CleanupStack::PushL(nextEntry);
+
+			msgEntryId = RecFindEntryByNameL(*nextEntry, aEntryName, aParentEntryName, aCaseSensitive);
+			if(msgEntryId != KMsvNullIndexEntryId)
+				{
+				found = ETrue;
+				}
+			CleanupStack::PopAndDestroy(nextEntry);
+			}
+  		}
+
+ 	CleanupStack::PopAndDestroy(selection);
+ 	return msgEntryId;
+ 	}
+ 
+ 
+/**
+CheckParent()
+Checks if the given parent name matches the name of the given parent entry
+
+@param aParentEntry	
+Parent entry whose name is to be checked
+
+@param aParentEntryName
+The Parent entry name that we are checking against
+
+@return
+ETrue if they match and EFalse if they do not
+*/
+TBool CT_MsgUtils::CheckParent(CMsvEntry& aParentEntry, TDesC& aParentEntryName)
+	{
+
+ 	TBool ret = EFalse;
+ 	
+ 	if (( aParentEntryName.CompareF( aParentEntry.Entry().iDescription ) == 0 ) ||
+     	( aParentEntryName.CompareF( aParentEntry.Entry().iDetails ) == 0 ))
+ 		{
+ 		ret = ETrue;
+ 		}
+ 	
+ 	return ret;
+	}
+
+
+/**
+CreateChildrenSelectionL()
+This function creates a selection of the children entries under a given parent Id
+
+@param aSession	
+A CMsvSession object
+		
+@param aEntryId	
+Id of the entry
+
+@return
+Returns a selection of all child entries under the given entry
+*/
+EXPORT_C CMsvEntrySelection* CT_MsgUtils::CreateChildrenSelectionL(CMsvSession* aSession, 
+																   TMsvId       aEntryId)
+	{
+	CMsvEntry* entry = CMsvEntry::NewL(*aSession, aEntryId,TMsvSelectionOrdering
+									( KMsvNoGrouping,EMsvSortByNone, ETrue));
+	CleanupStack::PushL(entry);
+	entry->SetEntryL(aEntryId);
+
+	TMsvSelectionOrdering order;
+	order.SetShowInvisibleEntries(ETrue);
+	entry->SetSortTypeL(order);
+
+	CMsvEntrySelection* selection = entry->ChildrenL();
+	CleanupStack::PopAndDestroy(entry);
+	
+	return selection;
+	}
+
+/**
+CreateChildrenSelectionWithTypeL()
+This function creates a selection of the children entries under a given parent Id
+which are of a specified type.
+
+@param aSession	
+A CMsvSession object
+		
+@param aEntryId	
+Id of the entry
+
+@param aType
+Type of entry to look for
+
+@return
+Returns a selection of all child entries under the given entry of the specified type
+*/
+EXPORT_C CMsvEntrySelection* CT_MsgUtils::CreateChildrenSelectionWithTypeL(CMsvSession* aSession, TMsvId aEntryId, TUid aType)
+	{
+	CMsvEntry* entry = CMsvEntry::NewL(*aSession, aEntryId, TMsvSelectionOrdering(KMsvNoGrouping, EMsvSortByNone, ETrue));
+	CleanupStack::PushL(entry);
+	entry->SetEntryL(aEntryId);
+
+	TMsvSelectionOrdering order;
+	order.SetShowInvisibleEntries(ETrue);
+	entry->SetSortTypeL(order);
+
+	CMsvEntrySelection* selection = entry->ChildrenWithTypeL(aType);
+	CleanupStack::PopAndDestroy(entry);
+
+	return selection;
+	}
+
+
+/**
+CreateChildrenSelectionRemoteFolderL()
+This function creates a selection of the child entries under the 
+remote folder Id if the service name is specified
+
+@param aSession		
+A CMsvSession object
+
+@param aAccountName	
+The account name or service name
+
+@param aFolderName
+The name of the remote folder whose entries need to be fetched
+
+@return
+The selection of all entries under the given entry
+*/
+EXPORT_C CMsvEntrySelection*  CT_MsgUtils::CreateChildrenSelectionRemoteFolderL(CMsvSession*
+										aSession,TPtrC aAccountName,TPtrC aFolderName)
+	{
+	TMsvId remoteFolderId = GetRemoteFolderIdByNameL(aSession, aAccountName, aFolderName);
+	return 	CreateChildrenSelectionL(aSession,remoteFolderId);
+	}
+
+/**
+CreateChildrenSelectionRemoteFolderWithTypeL()
+This function creates a selection of the child entries under the 
+remote folder Id with a specified type if the service name is specified
+
+@param aSession		
+A CMsvSession object
+
+@param aAccountName	
+The account name or service name
+
+@param aFolderName
+The name of the remote folder whose entries need to be fetched
+
+@param aType
+Type of entry to look for
+
+@return
+The selection of all entries under the given entry with the specified type
+*/
+EXPORT_C CMsvEntrySelection*  CT_MsgUtils::CreateChildrenSelectionRemoteFolderWithTypeL(CMsvSession*
+										aSession,TPtrC aAccountName,TPtrC aFolderName, TUid aType)
+	{
+	TMsvId remoteFolderId = GetRemoteFolderIdByNameL(aSession, aAccountName, aFolderName);
+	return CreateChildrenSelectionWithTypeL(aSession, remoteFolderId, aType);
+	}
+
+
+/**
+GetRemoteFolderIdByNameL()
+Searches for a given entry under the remote folder Id specified and gets it Id
+
+@param aSession		
+A CMsvSession object
+
+@param aAccountName
+The account name
+
+@param aFolderName
+The name of the remote folder whose Id is to be found
+
+@return
+The Id of the specified folder
+*/
+EXPORT_C TMsvId CT_MsgUtils::GetRemoteFolderIdByNameL(CMsvSession* aSession,TPtrC aAccountName,TPtrC aFolderName, TBool aCaseSensitive)
+	{
+	TMsvId imapServiceId = CT_MsgUtilsCentralRepository::GetImapServiceIdL((TDes&)aAccountName);
+	return CT_MsgUtils::FindEntryByNameL(aSession, imapServiceId, (TDesC&)aFolderName, aCaseSensitive);
+	}
+
+
+/**
+GetRemoteFolderIdByNameL()
+Searches for a given entry under the remote folder Id specified and gets it Id
+
+@param aSession		
+A CMsvSession object
+
+@param aAccountName
+The account name
+
+@param aFolderName
+The name of the remote folder whose Id is to be found
+
+@param aFolderName
+The name of the remote parent folder of the entry to be found
+
+@return
+The Id of the specified folder
+*/
+EXPORT_C TMsvId CT_MsgUtils::GetRemoteFolderIdByNameL(CMsvSession* aSession,TPtrC aAccountName,TPtrC aFolderName, TPtrC aParentFolderName, TBool aCaseSensitive)
+	{
+	TMsvId imapServiceId = CT_MsgUtilsCentralRepository::GetImapServiceIdL((TDes&)aAccountName);
+	return CT_MsgUtils::FindEntryByNameL(aSession, imapServiceId, (TDesC&)aFolderName, (TDesC&)aParentFolderName, aCaseSensitive);
+	}
+
+
+/**
+SearchMessageBySubjectL()
+This function searches for a message based on the 
+subject under the specified local folder
+
+@param aSession
+A CMsvSession object
+
+@param afolderId
+The folder Id under which the search needs to be done
+
+@param aSubject
+The subject name of the message
+
+@leave KErrNotFound
+Leaves if the message is not found
+
+@return
+If the message is found it returns the message Id
+*/
+EXPORT_C TMsvId CT_MsgUtils::SearchMessageBySubjectL(CMsvSession* aSession,TMsvId afolderId,TPtrC aSubject)
+	{
+	TMsvId	messageId = KMsvNullIndexEntryId;
+
+	CMsvEntry*	entry = aSession->GetEntryL(afolderId);
+	CleanupStack::PushL(entry);
+
+	// Set the entry to the source folder id
+	entry->SetEntryL(afolderId);
+
+	//Get CMsvEntrySelection object
+	CMsvEntrySelection*	selection = entry->ChildrenL();
+	CleanupStack::PushL(selection);
+	
+	TInt count = selection->Count();
+
+	if ( count > 0)
+		{
+		CMsvEntry*	childEntry = aSession->GetEntryL(selection->At(0));
+		CleanupStack::PushL(childEntry);
+
+		for(TInt entryIndex = 0 ; entryIndex< count; entryIndex++)
+			{
+			childEntry->SetEntryL(selection->At(entryIndex));
+					
+			if (childEntry->Entry().iDescription.Compare(aSubject) == 0)
+				{	
+				messageId = selection->At(entryIndex);
+				break;
+				}
+			}
+		CleanupStack::PopAndDestroy(childEntry);
+		}
+	if(messageId == KMsvNullIndexEntryId)
+		{
+		User::Leave(KErrNotFound);
+		}
+	CleanupStack::PopAndDestroy(2,entry);	//selection,entry
+	return messageId; 
+	}
+	
+/**
+SearchMessageBySubjectL()
+This function searches for a message based on the subject 
+under the specified local folder. This fucntion provides the
+flexibility of making the invisible children entries visible.
+
+@param aSession
+A CMsvSession object
+
+@param afolderId
+The folder Id under which the search needs to be done
+
+@param aSubject
+The subject name of the message
+
+@leave KErrNotFound
+Leaves if the message is not found
+
+@return
+If the message is found it returns the message Id
+*/
+EXPORT_C TMsvId CT_MsgUtils::SearchMessageBySubjectL(CMsvSession* aSession,TMsvId afolderId,TPtrC aSubject, TBool aVisibleFlag)
+	{
+	TMsvId	messageId = KMsvNullIndexEntryId;
+
+	CMsvEntry*	entry = aSession->GetEntryL(afolderId);
+	CleanupStack::PushL(entry);
+
+	// Set the entry to the source folder id
+	entry->SetEntryL(afolderId);
+	if(aVisibleFlag)
+		{
+		// Make the message entries visible
+		TMsvSelectionOrdering order;
+		order.SetShowInvisibleEntries(ETrue);
+		entry->SetSortTypeL(order);	
+		}
+
+	//Get CMsvEntrySelection object
+	CMsvEntrySelection*	selection = entry->ChildrenL();
+	CleanupStack::PushL(selection);
+	
+	TInt count = selection->Count();
+
+	if ( count > 0)
+		{
+		CMsvEntry*	childEntry = aSession->GetEntryL(selection->At(0));
+		CleanupStack::PushL(childEntry);
+
+		for(TInt entryIndex = 0 ; entryIndex< count; entryIndex++)
+			{
+			childEntry->SetEntryL(selection->At(entryIndex));
+					
+			if (childEntry->Entry().iDescription.Compare(aSubject) == 0)
+				{	
+				messageId = selection->At(entryIndex);
+				break;
+				}
+			}
+		CleanupStack::PopAndDestroy(childEntry);
+		}
+	if(messageId == KMsvNullIndexEntryId)
+		{
+		User::Leave(KErrNotFound);
+		}
+	CleanupStack::PopAndDestroy(2,entry);	//selection,entry
+	return messageId; 
+	}
+	
+/**
+CompareFilesL()
+Compares two input files (ASCII & Unicode).
+
+@param aFileOne
+The first file to be compared
+
+@param aFileTwo
+The second file to be compared
+
+@param aIsUnicode
+To check if its unicode
+
+@param aIgnoreCharList
+An array of type CArrayFixFlat
+
+@param aDiffFlag
+Flag to indicate the difference
+
+@return
+Returns ETrue if the files are different.
+*/
+EXPORT_C TInt CT_MsgUtils::CompareFilesL(TPtrC aFileOne, TPtrC aFileTwo, TBool aIsUnicode,
+									  CArrayFixFlat<TUint16>* aIgnoreCharList, TBool& aDiffFlag)
+	{
+	// Return Code
+	TInt retCode = KErrNone;
+
+	// Streams for the file1 and file2 to compare
+	RFileReadStream fileReadStream1;
+	RFileReadStream fileReadStream2;
+
+	// Files difference flag
+	aDiffFlag = EFalse;
+
+	RFs iFs;
+	User::LeaveIfError(iFs.Connect());
+
+	// Open file one to compare in the read only mode
+	retCode = fileReadStream1.Open( iFs, aFileOne, EFileShareReadersOnly);
+
+	// If the file open of the first file is successful then open the second file, also in read only mode
+	if(retCode == KErrNone)
+		{
+		retCode = fileReadStream2.Open( iFs, aFileTwo, EFileShareReadersOnly);
+
+		// The file open of the second file is successful
+		if(retCode == KErrNone)
+			{
+			// To hold the line content of file one 
+			HBufC* lineOneBuffer = HBufC::NewLC(KDefBufferSize);
+			TPtr ptrLineOne = lineOneBuffer->Des();
+			
+			// To hold the line content of file two
+			HBufC* lineTwoBuffer = HBufC::NewLC(KDefBufferSize);
+			TPtr ptrLineTwo = lineTwoBuffer->Des();
+
+			// End of File indicators
+			TBool	eofOne = EFalse;
+			TBool	eofTwo = EFalse; 
+			
+			// Read the file one and file two data
+			do   
+				{
+				// Read file one data
+				eofOne = ReadDataL(fileReadStream1, ptrLineOne, aIsUnicode, aIgnoreCharList);
+
+				// Read file two data
+				eofTwo = ReadDataL(fileReadStream2, ptrLineTwo, aIsUnicode, aIgnoreCharList);
+
+				// Check EOF state of the files.
+				// Either both the files will be in EOF state or 
+				// none of the files will be in EOF state			  
+				if((!eofOne && !eofTwo)||(eofOne && eofTwo))
+	            	{			
+					// Compare the read lines from file one and the file two
+					if(ptrLineOne.Compare(ptrLineTwo) != 0)
+						{
+						// Different data content so set the differnce flag
+						aDiffFlag = ETrue;
+						}
+					}
+				else
+					{
+					// Different EOF 
+					aDiffFlag = ETrue;
+					}
+				} while(!eofOne && !eofTwo && !aDiffFlag);				
+			
+			// Delete line buffers
+			CleanupStack::PopAndDestroy(2, lineOneBuffer);				
+			}
+		}
+	
+	// Close the open streams
+	fileReadStream1.Close();
+	fileReadStream2.Close();	
+
+	iFs.Close();
+	// Return the difference flag
+	return retCode;
+	}
+
+
+/**
+ReadDataL()
+Reads data chunk from the file stream. Returns ETrue if the EOF found
+
+@param aFileReadStream
+File Stream
+
+@param aPtrLineBuffer		
+Buffer to hold a line
+
+@param aIsUnicode
+To check if its unicode
+
+@param aIgnoreCharList
+List of the characters to be ignored
+
+@leave KErrNotFound
+Leaves if aIgnoreCharList is empty
+
+@return 
+Return end of file flag	
+*/
+EXPORT_C TBool CT_MsgUtils::ReadDataL(RFileReadStream& aFileReadStream,
+	  TPtr& aPtrLineBuffer, TBool aIsUnicode, CArrayFixFlat<TUint16>* aIgnoreCharList)
+ 	{
+	TUint16			element = 0;
+	TKeyArrayFix	key(0, ECmpTUint16);
+	TInt			charPosition = 0;
+	TBool			eof = EFalse;
+	TInt			errorCode = KErrNone;
+	TUint8			aCharASCII = 0;
+	
+	aPtrLineBuffer.FillZ();
+	aPtrLineBuffer.SetLength(0);	
+	
+	// Validate the input ignore char list
+	if (!aIgnoreCharList)
+		{
+		// Invalid parameter passed to ReadDataL: No ignore char list passed
+		User::Leave(KErrNotFound);
+		}
+
+	// Read data from file and store it in lineBuffer 
+	do   
+		{
+		if(aIsUnicode)
+			{
+			TRAP(errorCode, (element = aFileReadStream.ReadUint16L()));
+			}
+		else
+			{
+			TRAP(errorCode, (aCharASCII = aFileReadStream.ReadUint8L()));
+			element = (TUint16) aCharASCII;
+			}
+			
+		if (errorCode != KErrEof)
+			{		
+			// Check the availability of ignore char in the array							
+			if ( aIgnoreCharList->Find(element, key, charPosition) != KErrNone )
+				{
+				// Append the char to the buffer if the read char is not ignore char
+				aPtrLineBuffer.Append(element);
+				}
+			}								
+			else
+				{
+				eof = ETrue;
+				break;
+				}
+				
+			// Stop at the end of line or no more data 
+			} while(aPtrLineBuffer.Length() < KDefBufferSize);
+	
+	// Return end of file flag		
+	return eof;	
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/src/T_UtilsCentralRepository.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,292 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+// User includes
+#include <t_utilscentralrepository.h>
+
+// epoc includes
+#include <msvids.h>
+
+/**
+CT_MsgUtilsCentralRepository()
+Constructor
+*/
+EXPORT_C CT_MsgUtilsCentralRepository::CT_MsgUtilsCentralRepository()
+	{
+	}
+
+
+/**
+~CT_MsgUtilsCentralRepository()
+Destructor
+*/
+CT_MsgUtilsCentralRepository::~CT_MsgUtilsCentralRepository()
+	{
+	}
+
+
+/**
+GetDefaultSmtpServiceIdL()
+This function return the default Smtp Service Id. This method requires that a
+related IMAP4 or POP3 account has been previously created in the central
+repository - this is because SMTP accounts do not exist independently but only
+as part of an IMAP4 or POP3 account
+
+@return
+Entry ID of the default SMTP service entry
+*/
+EXPORT_C TMsvId CT_MsgUtilsCentralRepository::GetDefaultSmtpServiceIdL()
+	{
+	CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
+	
+	TSmtpAccount smtpAccount;
+	smtpAccount.iSmtpService = KMsvNullIndexEntryId;
+	User::LeaveIfError(emailAccounts->DefaultSmtpAccountL(smtpAccount));
+
+	CleanupStack::PopAndDestroy(emailAccounts);
+	
+	return smtpAccount.iSmtpService;
+	}
+
+
+/**
+GetImapServiceIdL()
+This function returns the Service Id of the IMAP account with the specified name
+
+@param aName
+The Imap account name
+
+@return
+It returns entry Id of an IMAP service
+*/
+EXPORT_C TMsvId CT_MsgUtilsCentralRepository::GetImapServiceIdL(TDes& aName)
+	{
+	TImapAccount imapAccount;
+	TMsvId imapServiceId = KMsvNullIndexEntryId;
+
+	TBool returnValue = GetImapAccountL( aName, imapAccount );
+	
+	if ( returnValue )
+		{
+		imapServiceId = imapAccount.iImapService;
+		}
+	return imapServiceId;
+	}
+
+
+/**
+GetPopServiceIdL()
+This function returns the Service Id of the POP account with the specified name
+
+@param aName
+The Pop account name
+
+@return
+Returns entry Id of an POP service
+*/
+EXPORT_C TMsvId CT_MsgUtilsCentralRepository::GetPopServiceIdL(TDes& aName)
+	{
+	TPopAccount popAccount;
+	TMsvId popServiceId = KMsvNullIndexEntryId;
+
+	TBool returnValue = GetPopAccountL( aName, popAccount );
+	
+	if ( returnValue )
+		{
+		popServiceId = popAccount.iPopService;
+		}
+	return popServiceId;
+	}
+
+/**
+GetSmtpServiceIdL()
+This function returns the Service Id of the SMTP account with the specified name
+
+@param aName
+The Smtp account name
+
+@return
+Returns entry Id of an SMTP service
+*/
+EXPORT_C TMsvId CT_MsgUtilsCentralRepository::GetSmtpServiceIdL(TDes& aName)
+	{
+	TSmtpAccount smtpAccount;
+	TMsvId smtpServiceId = KMsvNullIndexEntryId;
+
+	TBool returnValue = GetSmtpAccountL(aName, smtpAccount);
+	
+	if (returnValue)
+		{
+		smtpServiceId = smtpAccount.iSmtpService;
+		}
+	return smtpServiceId;
+	}
+
+/**
+GetImapAccountL()
+Searches the IMAP account with the specified name and 
+returns the TImapAccount oject associted to it.
+
+@param aName
+The Imap account name
+
+@param aImapAccount
+An object of type TImapAccount
+
+@leave KErrNotFound
+Leaves if no account found with the supplied name.
+
+@return
+ETrue if the account is found, else EFalse
+*/
+EXPORT_C TBool CT_MsgUtilsCentralRepository::GetImapAccountL(TDes& aName, TImapAccount& aImapAccount )
+	{
+	TImapAccount imapAccount;
+	imapAccount.iImapService = KMsvNullIndexEntryId;
+
+	// Get the list of IMAP accounts
+	RArray<TImapAccount> accountIds;
+
+	CEmailAccounts *emailAccounts = CEmailAccounts::NewLC();	
+	emailAccounts->GetImapAccountsL(accountIds);
+	
+	// Search for the account with the given name in the list of IMAP accounts
+	TBool accountFound = EFalse;
+	for( TInt index = 0; index < accountIds.Count(); index++)
+		{
+		TImapAccount tempAccount = accountIds[index];
+		TPtrC accountPtr( tempAccount.iImapAccountName );
+
+		if( accountPtr.Compare(aName) == 0 )
+			{
+			aImapAccount = tempAccount;
+			accountFound = ETrue;
+			break;
+			}
+		}
+	if(!accountFound)
+		{
+		User::Leave(KErrNotFound);
+		}
+	CleanupStack::PopAndDestroy(emailAccounts);
+	accountIds.Reset();
+	
+	return accountFound;
+	}
+
+
+/**
+GetPopAccountL()
+Searches the POP account with the specified name and 
+returns the TPopAccount oject associted to it.
+
+@param aName
+The Imap account name
+
+@param aPopAccount
+An object of type TPopAccount
+
+@leave KErrNotFound
+Leaves if no account found with the supplied name.
+
+@return
+ETrue if the account is found, else EFalse
+*/
+EXPORT_C TBool CT_MsgUtilsCentralRepository::GetPopAccountL(TDes& aName, TPopAccount& aPopAccount )
+	{
+	TPopAccount popAccount;
+	popAccount.iPopService = KMsvNullIndexEntryId;
+
+	// Get the list of POP accounts
+	RArray<TPopAccount> accountIds;
+
+	CEmailAccounts *emailAccounts = CEmailAccounts::NewLC();	
+	emailAccounts->GetPopAccountsL(accountIds);
+	
+	// Search for the account with the given name in the list of POP accounts
+	TBool accountFound = EFalse;
+	for( TInt index = 0; index < accountIds.Count(); index++)
+		{
+		TPopAccount tempAccount = accountIds[index];
+		TPtrC accountPtr( tempAccount.iPopAccountName );
+
+		if( accountPtr.Compare(aName) == 0 )
+			{
+			aPopAccount = tempAccount;
+			accountFound = ETrue;
+			break;
+			}
+		}
+	if(!accountFound)
+		{
+		User::Leave(KErrNotFound);
+		}
+	CleanupStack::PopAndDestroy(emailAccounts);
+	accountIds.Reset();
+
+	return accountFound;
+	}
+
+/**
+GetSmtpAccountL()
+Searches the SMTP account with the specified name and 
+returns the TSmtpAccount oject associted to it.
+
+@param aName
+The Smtp account name
+
+@param aSmtpAccount
+An object of type TSmtpAccount
+
+@leave KErrNotFound
+Leaves if no account found with the supplied name.
+
+@return
+ETrue if the account is found, else EFalse
+*/
+EXPORT_C TBool CT_MsgUtilsCentralRepository::GetSmtpAccountL(TDes& aName, TSmtpAccount& aSmtpAccount)
+	{
+	TSmtpAccount smtpAccount;
+	smtpAccount.iSmtpService = KMsvNullIndexEntryId;
+
+	// Get the list of SMTP accounts
+	RArray<TSmtpAccount> accountIds;
+
+	CEmailAccounts *emailAccounts = CEmailAccounts::NewLC();	
+	emailAccounts->GetSmtpAccountsL(accountIds);
+	
+	// Search for the account with the given name in the list of SMTP accounts
+	TBool accountFound = EFalse;
+	for( TInt index = 0; index < accountIds.Count(); index++)
+		{
+		TSmtpAccount tempAccount = accountIds[index];
+		TPtrC accountPtr( tempAccount.iSmtpAccountName );
+
+		if( accountPtr.Compare(aName) == 0 )
+			{
+			aSmtpAccount = tempAccount;
+			accountFound = ETrue;
+			break;
+			}
+		}
+	if(!accountFound)
+		{
+		User::Leave(KErrNotFound);
+		}
+	CleanupStack::PopAndDestroy(emailAccounts);
+	accountIds.Reset();
+
+	return accountFound;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/src/T_UtilsConfigFileMachineName.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,157 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+/**
+ @file
+*/
+
+// User include
+#include <t_utilsconfigfilemachinename.h>
+
+// Epoc include
+#include <f32file.h>
+
+
+//Literals used
+_LIT(KFileName,"c:\\smoketest\\MachineName.txt");
+_LIT(KAtEmailAddress,"@msexchange2k.closedtest.intra");
+
+
+/**
+NewL()
+Allocates and creates a new CT_MsgConnectPop3Server object
+
+@param aPtrEmailAdd
+@leave KErrNoMemory
+@return
+The newly created CT_MsgUtilsConfigFileMachineName object
+*/
+EXPORT_C CT_MsgUtilsConfigFileMachineName* CT_MsgUtilsConfigFileMachineName::NewL(const TDesC& aPtrEmailAdd)
+	{
+	CT_MsgUtilsConfigFileMachineName* self = new (ELeave) CT_MsgUtilsConfigFileMachineName();
+	CleanupStack::PushL(self);
+	self->ConstructL(aPtrEmailAdd);
+	CleanupStack::Pop(self);
+	return self;	
+	}
+
+
+/**
+NewLC()
+Allocates and creates a new CT_MsgUtilsConfigFileMachineName object, leaving the 
+object on the cleanup stack.
+
+@param aPtrEmailAdd
+@leave KErrNoMemory
+@return
+The newly created CT_MsgUtilsConfigFileMachineName object
+*/
+EXPORT_C CT_MsgUtilsConfigFileMachineName* CT_MsgUtilsConfigFileMachineName::NewLC(const TDesC& aPtrEmailAdd)
+	{
+	CT_MsgUtilsConfigFileMachineName* self = new (ELeave) CT_MsgUtilsConfigFileMachineName();
+	CleanupStack::PushL(self);
+	self->ConstructL(aPtrEmailAdd);
+	return self;	
+	}
+
+
+/**
+CT_MsgUtilsConfigFileMachineName()
+Constructor
+*/
+EXPORT_C CT_MsgUtilsConfigFileMachineName::CT_MsgUtilsConfigFileMachineName()
+	{	
+	}
+
+
+/**
+ConstructL()
+Reads the machine name from the Machine config file("c:\\smoketest\\MachineName.txt")
+and constructs the data members.
+
+@param aPtrEmailAdd
+*/	
+EXPORT_C void CT_MsgUtilsConfigFileMachineName::ConstructL(const TDesC& aPtrEmailAdd)
+	{
+	RFs fs;
+	User::LeaveIfError(fs.Connect());
+	CleanupClosePushL(fs);
+	RFile file;	
+	User::LeaveIfError(file.Open(fs, KFileName, EFileRead));
+	
+	CleanupClosePushL(file);
+	TInt  fileSize;
+	User::LeaveIfError(file.Size(fileSize));
+	iMachineName = HBufC8::NewL(fileSize);
+	TPtr8 bufferPtr = iMachineName->Des();
+	User::LeaveIfError(file.Read(bufferPtr));
+	
+	if (aPtrEmailAdd.Compare(_L("NONE"))==0)
+		iMachineNameEmail = HBufC::NewL(iMachineName->Length() + KAtEmailAddress.iTypeLength);
+	else
+		iMachineNameEmail = HBufC::NewL(iMachineName->Length() + aPtrEmailAdd.Length() + 1);
+	
+	iMachineNameEmail->Des().Copy(*iMachineName);
+	
+	if (aPtrEmailAdd.Compare(_L("NONE"))==0)
+		iMachineNameEmail->Des().Append(KAtEmailAddress);
+	else
+		{
+		iMachineNameEmail->Des().Append(_L("@"));
+		iMachineNameEmail->Des().Append(aPtrEmailAdd);
+		}
+
+	
+	CleanupStack::PopAndDestroy(2,&fs);
+	}
+
+
+/**
+MachineNameEmail()
+Returns an email address with the host machine name.
+
+@return
+Email address of the machine
+*/
+EXPORT_C const TDesC& CT_MsgUtilsConfigFileMachineName::MachineNameEmail()
+	{
+	return (*iMachineNameEmail);
+	}
+
+
+/**
+MachineName()
+Returns the host machine name
+
+@return
+Machine name
+*/
+EXPORT_C const TDesC8& CT_MsgUtilsConfigFileMachineName::MachineName()
+	{
+	return (*iMachineName);	
+	}
+	
+
+/**
+~CT_MsgUtilsConfigFileMachineName()
+Destructor
+*/
+CT_MsgUtilsConfigFileMachineName::~CT_MsgUtilsConfigFileMachineName()
+  {
+  delete iMachineName;	
+  delete iMachineNameEmail;
+  }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/src/T_UtilsConfigFileParserUtility.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,275 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the CPP file which contains utility functions for parsing the config file
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User include
+#include <t_utilsconfigfileparserutility.h>
+
+// epoc inlcude
+#include <f32file.h>
+
+// contants and literals used
+const TInt KFileBufferSize = 1024;
+_LIT8(KComment,"*#*");
+
+
+/**
+NewL()
+Allocates and creates a new CT_MsgUtilsConfigFileParserUtility object
+
+@param aFileName
+Name of the file to be parsed
+
+@leave KErrNoMemory
+@return
+The newly created CT_MsgUtilsConfigFileParserUtility object
+*/
+EXPORT_C CT_MsgUtilsConfigFileParserUtility* CT_MsgUtilsConfigFileParserUtility::NewL(const TDesC& aFileName)
+	{
+	CT_MsgUtilsConfigFileParserUtility* self = new (ELeave) CT_MsgUtilsConfigFileParserUtility();
+	CleanupStack::PushL(self);
+	self->ConstructL(aFileName);
+	CleanupStack::Pop();
+	return self;
+	}
+	
+
+/**
+CT_MsgUtilsConfigFileParserUtility()
+Constructor
+*/
+EXPORT_C CT_MsgUtilsConfigFileParserUtility::CT_MsgUtilsConfigFileParserUtility()
+	{
+	}
+
+
+/**
+~CT_MsgUtilsConfigFileParserUtility()
+Destructor
+*/
+CT_MsgUtilsConfigFileParserUtility::~CT_MsgUtilsConfigFileParserUtility()
+	{
+	iName.ResetAndDestroy();
+	iContent.ResetAndDestroy();
+	iContent8.ResetAndDestroy();
+	}
+
+
+/**
+ConstructL()
+Parses a .txt file and creates Arrays of fields and there values
+
+@param aFileName
+Name of the file to be parsed.
+*/
+EXPORT_C void CT_MsgUtilsConfigFileParserUtility::ConstructL(const TDesC& aFileName)
+	{
+	RFs fileServerSession;
+
+	fileServerSession.Connect();
+
+	RFile file;
+	User::LeaveIfError(file.Open(fileServerSession, aFileName, EFileRead));
+
+	TInt eof = EFalse;
+	TInt fileOffset = 0;
+	TBuf8<KFileBufferSize> fileBuffer;
+
+	while (!eof)
+		{
+		fileBuffer.SetLength(0);
+		User::LeaveIfError(file.Read(fileOffset, fileBuffer, KFileBufferSize));
+		TInt read = fileBuffer.Length();
+
+		if (read < KFileBufferSize)
+			{
+			fileBuffer.Append('\n');
+			eof = ETrue;
+			}
+
+		TInt lineOverflow = fileBuffer.Locate('\n');
+		
+		if ((lineOverflow == KErrNotFound) && (read == KFileBufferSize))
+			{
+			User::Leave(KErrOverflow);
+			}
+
+		TInt eol = EFalse;
+		
+		while (!eol)
+			{
+			TInt lineFeedLocation = fileBuffer.Locate('\n');
+			
+			if (lineFeedLocation == KErrNotFound)
+				{
+				eol = ETrue;
+				}
+			
+			else
+				{
+				fileOffset += lineFeedLocation + 1;
+				TInt lineLength;
+				if ((lineFeedLocation != 0) && (fileBuffer[lineFeedLocation - 1] == '\r'))
+					{
+					lineLength = lineFeedLocation - 1;
+					}
+					
+				else
+					{
+					lineLength = lineFeedLocation;
+					}
+					
+				TPtrC8 line  = fileBuffer.Left(lineLength);
+				TInt commentLocation = line.Match(KComment);
+				
+				if (commentLocation != KErrNotFound)
+					{
+					TPtrC8 skipComment = line.Left(commentLocation);
+					line.Set(skipComment);
+					}
+					
+				TInt seperatorLocation = line.Locate('=');
+				
+				if (seperatorLocation != KErrNotFound)
+					{
+					if ((seperatorLocation == 0) || (seperatorLocation == line.Length() - 1))
+						{
+						seperatorLocation = KErrNotFound;
+						}
+					}
+					
+				if (seperatorLocation != KErrNotFound)
+					{
+					TPtrC8 namePtr = line.Left(seperatorLocation);
+					HBufC8* nameBuf8 = HBufC8::NewL(namePtr.Length());
+					CleanupStack::PushL(nameBuf8);
+					
+					TPtr8 name8 = nameBuf8->Des();
+					name8.Copy(namePtr);
+					name8.Trim();
+					HBufC* nameBuf16 = HBufC::NewL(namePtr.Length());
+					TPtr name16 = nameBuf16->Des();
+					name16.Copy(name8);
+					iName.Append(nameBuf16);
+					CleanupStack::PopAndDestroy(nameBuf8);
+
+					TPtrC8 contentPtr = line.Mid(seperatorLocation + 1);
+					HBufC8* contentBuf8 = HBufC8::NewL(contentPtr.Length());
+					CleanupStack::PushL(contentBuf8);
+					TPtr8 content8 = contentBuf8->Des();
+					content8.Copy(contentPtr);
+					content8.Trim();
+					
+					HBufC* contentBuf16 = HBufC::NewL(contentPtr.Length());
+					TPtr content16 = contentBuf16->Des();
+					content16.Copy(content8);
+					iContent.Append(contentBuf16);
+					iContent8.Append(contentBuf8);
+					CleanupStack::Pop(contentBuf8);
+					}
+				TPtrC8 theRest = fileBuffer.Mid(lineFeedLocation + 1);
+				fileBuffer.Copy(theRest);
+				}
+			}
+		}
+	
+	file.Close();
+	fileServerSession.Close();
+	}
+
+
+/**
+GetFieldAsInteger()
+Retrives the content of a field name and Interpret it as an integer.
+
+@param aFieldName
+@param aValue
+@return
+Returns an integer corresponding to the field
+*/
+EXPORT_C TInt CT_MsgUtilsConfigFileParserUtility::GetFieldAsInteger(const TDesC& aFieldName, TInt& aValue)
+	{
+	TInt count = iName.Count();
+
+	for (TInt i = 0; i<count; i++)
+		{
+		if (iName[i]->Compare(aFieldName) == 0)
+			{ 
+			TPtrC content = iContent[i]->Des();
+			TLex lex(content);
+			lex.Val(aValue);
+			return (KErrNone);
+			}
+		}
+	return (KErrNotFound);
+	}
+
+
+/**
+GetFieldAsString()
+Retrives the content of a field name and Interpret it as an string
+
+@param aFieldName
+@param aValue
+@return
+Returns an string corresponding to the field
+*/
+EXPORT_C TInt CT_MsgUtilsConfigFileParserUtility::GetFieldAsString(const TDesC& aFieldName, TPtrC& aString)
+	{
+	TInt count = iName.Count();
+
+	for (TInt i = 0; i<count; i++)
+		{
+		if (iName[i]->Compare(aFieldName) == 0)
+			{ 
+			aString.Set(*iContent[i]);
+			return (KErrNone);
+			}
+		}
+	return (KErrNotFound);
+	}
+
+
+/**
+GetFieldAsString8()
+Retrives the content of a field name and Interpret it as an 8-bit descriptor
+
+@param aFieldName
+@param aValue
+@return
+Returns an 8-bit descriptor corresponding to the field
+*/
+EXPORT_C TInt CT_MsgUtilsConfigFileParserUtility::GetFieldAsString8(const TDesC& aFieldName, TPtrC8& aString)
+	{
+	TInt count = iName.Count();
+	
+	for (TInt i = 0; i<count; i++)
+		{
+		if (iName[i]->Compare(aFieldName) == 0)
+			{ 
+			aString.Set(*iContent8[i]);
+			return (KErrNone);
+			}
+		}
+	return (KErrNotFound);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/src/T_UtilsDeleteAllChildren.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,267 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the Cpp file which contains the utility functions to delete all children in the
+// message store
+// 
+//
+
+
+
+/**
+ @file
+*/
+
+
+// User includes
+#include <t_utilsdeleteallchildren.h>
+	
+// Epoc includes
+#include <msvapi.h>
+#include <msvuids.h>
+
+/**
+CT_MsgUtilsDeleteAllChildren()
+Constructor
+
+@param aSession
+An object of CMsvSession
+
+@param aParentId
+Entry ID of whose children would be deleted
+*/
+EXPORT_C CT_MsgUtilsDeleteAllChildren::CT_MsgUtilsDeleteAllChildren(CMsvSession* aSession,TMsvId aParentId) 
+: CActive(EPriorityNormal), iSession(aSession), iParentId(aParentId) 
+	{
+	CActiveScheduler::Add(this);
+	}
+
+
+/**
+~CT_MsgUtilsDeleteAllChildren()
+Destructor
+*/
+CT_MsgUtilsDeleteAllChildren::~CT_MsgUtilsDeleteAllChildren()
+	{
+	delete iEntry;
+	delete iSelection;
+	}
+
+
+/**
+StartL()
+Deletes the children entries of the specified parent
+
+@param aStatus			
+*/
+EXPORT_C void CT_MsgUtilsDeleteAllChildren::StartL(TRequestStatus& aStatus)
+	{
+	StartL(EFalse, aStatus);
+	}
+
+/**
+StartL()
+Deletes the children entries of the specified parent
+
+@param aBlockDelete Delete all in one go
+@param aStatus			
+*/
+EXPORT_C void CT_MsgUtilsDeleteAllChildren::StartL(TBool aBlockDelete, TRequestStatus& aStatus)
+	{
+	iRequestStatus = &aStatus;
+	aStatus = KRequestPending;
+
+	// Creates a new CMsvEntry for the specified parent entry ID nad sets the context
+	// to that entry.
+	if(iEntry==NULL)
+	{
+	iEntry = CMsvEntry::NewL(*iSession,iParentId,TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
+	}
+	iEntry->SetEntryL(iParentId);
+	
+	// Gets a selection containing the IDs of children
+	iSelection = iEntry->ChildrenL();
+	iTotalChildren = iSelection->Count();
+	
+	// If the entry has no children entries, then signals the thread that the asynchronous request 
+	// is complete.
+	if (iTotalChildren == 0)
+		{
+		User::RequestComplete(iRequestStatus,KErrNone);
+		}
+		
+	
+	// If the entry has children entries then,delete child entries of the context
+	// recursively through all the descendants
+	else
+		{
+		if (aBlockDelete)
+			{
+			iOperation = iEntry->DeleteL(*iSelection ,iStatus);
+			iState = EBlockDelete;
+			}
+		else
+			{
+			iOperation = iEntry->DeleteL((*iSelection)[iCurrentChild],iStatus);
+			iState = EStateThisLevel;
+			}
+		
+		SetActive();
+		}
+	}
+
+
+/**
+DoCancel()
+Implements cancellation of an outstanding request
+
+@see CActive::Cancel()
+*/
+void CT_MsgUtilsDeleteAllChildren::DoCancel()
+	{
+	switch (iState)
+		{
+		case EStateThisLevel:
+		case EBlockDelete:
+			iOperation->Cancel();
+			break;
+
+		case EStateNextLevel:
+			iNextLevel->Cancel();
+			break;
+		}
+	}
+
+
+/**
+RunL()
+Handles an active object's request completion event
+
+@see CActive::RunL()
+*/
+void CT_MsgUtilsDeleteAllChildren::RunL()
+	{
+	TInt err;
+
+	switch (iState)
+		{
+		case EStateThisLevel:
+			
+			err = CT_MsgUtilsDeleteAllChildren::FinalProgressStatus(*iOperation,iStatus);
+			delete iOperation;
+			iOperation = NULL;
+
+			switch (err)
+				{
+				case KErrAccessDenied:
+					iUndeletedChildren++;
+					if(iNextLevel==NULL)
+					{
+					iNextLevel = new (ELeave) CT_MsgUtilsDeleteAllChildren(iSession,(*iSelection)[iCurrentChild]);
+					}
+					iNextLevel->StartL(iStatus);
+					SetActive();
+					iState = EStateNextLevel;
+					break;
+				
+				case KErrNone:
+					if (++iCurrentChild == iTotalChildren)
+						{
+						User::RequestComplete(iRequestStatus,KErrNone);
+						}
+					else
+						{
+						iOperation = iEntry->DeleteL((*iSelection)[iCurrentChild],iStatus);
+						SetActive();
+						}
+					break;
+					
+				default:
+					User::RequestComplete(iRequestStatus,err);
+					break;			
+				}
+				break;
+
+		case EStateNextLevel:
+			err = iStatus.Int();
+			iUndeletedChildren += iNextLevel->Undeleted();
+			delete iNextLevel;
+			iNextLevel = NULL;
+
+			switch (err)
+				{
+				case KErrNone:
+					if (++iCurrentChild == iTotalChildren)
+						{
+						User::RequestComplete(iRequestStatus,KErrNone);
+						}
+					else
+						{
+						iOperation = iEntry->DeleteL((*iSelection)[iCurrentChild],iStatus);
+						SetActive();
+						iState = EStateThisLevel;
+						}
+					break;
+				default:
+					User::RequestComplete(iRequestStatus,err);
+					break;
+				}
+			break;
+
+		case EBlockDelete:
+			{
+			err = CT_MsgUtilsDeleteAllChildren::FinalProgressStatus(*iOperation,iStatus);
+			delete iOperation;
+			iOperation = NULL;
+
+			User::RequestComplete(iRequestStatus,err);
+			break;
+			}
+		}
+	}
+
+	
+/**
+FinalProgressStatus()
+This function gets the information about a completed operation for the local entries..
+
+@param aOperation	
+Used to get progress information about the operation
+
+@param aStatus	
+@return
+The error code
+*/
+EXPORT_C TInt CT_MsgUtilsDeleteAllChildren::FinalProgressStatus(CMsvOperation& aOperation,const TRequestStatus& aStatus)
+	{
+	TInt err = KErrNone;
+
+	if (aOperation.Mtm() == KUidMsvLocalServiceMtm)
+		{
+		TPckgBuf<TMsvLocalOperationProgress> progress;
+		progress.Copy(aOperation.FinalProgress());
+		err = progress().iError;
+		}
+	else
+		{
+		if (iState == EBlockDelete)
+			{
+			TRAP_IGNORE(err = McliUtils::GetProgressErrorL(aOperation));
+			}
+		else
+			{
+			err = aStatus.Int();
+			}
+		}
+	return (err);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/src/T_UtilsEnumConverter.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,1462 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file contains the utility functions to map a string to the corresponding enumerator values.
+// 
+//
+
+// User includes
+#include <t_utilsenumconverter.h>
+
+// epoc includes
+#include <msvids.h>
+#include <cdbcols.h>
+
+// Literals Used
+
+// Local Folder Ids
+_LIT(KStrGlobalInBoxIndexEntryId,"KMsvGlobalInBoxIndexEntryId");
+_LIT(KStrGlobalOutBoxIndexEntryId,"KMsvGlobalOutBoxIndexEntryId");
+_LIT(KStrSentEntryId,"KMsvSentEntryId");
+_LIT(KStrDraftEntryId,"KMsvDraftEntryId");
+_LIT(KStrDeletedEntryFolderEntryId,"KMsvDeletedEntryFolderEntryId");
+_LIT(KStrRootIndexEntryId,"KMsvRootIndexEntryId");
+_LIT(KStrTempIndexEntryId,"KMsvTempIndexEntryId");
+_LIT(KStrLocalServiceIndexEntryId,"KMsvLocalServiceIndexEntryId");
+_LIT(KStrUnknownServiceIndexEntryId,"KMsvUnknownServiceIndexEntryId");
+_LIT(KStrFirstFreeEntryId,"KFirstFreeEntryId");
+
+
+//Pop3 Specific Commands
+_LIT(KStrPOP3MTMIsConnected, "KPOP3MTMIsConnected");
+_LIT(KStrPOP3MTMConnect,"KPOP3MTMConnect");
+_LIT(KStrPOP3MTMDisconnect,"KPOP3MTMDisconnect");	
+_LIT(KStrPOP3MTMCopyNewMailWhenAlreadyConnected,"KPOP3MTMCopyNewMailWhenAlreadyConnected");
+_LIT(KStrPOP3MTMConnectAndCopyNewMailAndStayOnline,"KPOP3MTMConnectAndCopyNewMailAndStayOnline");
+_LIT(KStrPOP3MTMConnectAndCopyNewMailAndDisconnect,"KPOP3MTMConnectAndCopyNewMailAndDisconnect");
+_LIT(KStrPOP3MTMMoveNewMailWhenAlreadyConnected,"KPOP3MTMMoveNewMailWhenAlreadyConnected");
+_LIT(KStrPOP3MTMConnectAndMoveNewMailAndStayOnline,"KPOP3MTMConnectAndMoveNewMailAndStayOnline");
+_LIT(KStrPOP3MTMConnectAndMoveNewMailAndDisconnect,"KPOP3MTMConnectAndMoveNewMailAndDisconnect");
+_LIT(KStrPOP3MTMCopyMailSelectionWhenAlreadyConnected,"KPOP3MTMCopyMailSelectionWhenAlreadyConnected");
+_LIT(KStrPOP3MTMConnectAndCopyMailSelectionAndStayOnline,"KPOP3MTMConnectAndCopyMailSelectionAndStayOnline");
+_LIT(KStrPOP3MTMConnectAndCopyMailSelectionAndDisconnect,"KPOP3MTMConnectAndCopyMailSelectionAndDisconnect");
+_LIT(KStrPOP3MTMMoveMailSelectionWhenAlreadyConnected,"KPOP3MTMMoveMailSelectionWhenAlreadyConnected");
+_LIT(KStrPOP3MTMConnectAndMoveMailSelectionAndStayOnline,"KPOP3MTMConnectAndMoveMailSelectionAndStayOnline");
+_LIT(KStrPOP3MTMConnectAndMoveMailSelectionAndDisconnect,"KPOP3MTMConnectAndMoveMailSelectionAndDisconnect");
+_LIT(KStrPOP3MTMCopyAllMailWhenAlreadyConnected,"KPOP3MTMCopyAllMailWhenAlreadyConnected");
+_LIT(KStrPOP3MTMConnectAndCopyAllMailAndStayOnline,"KPOP3MTMConnectAndCopyAllMailAndStayOnline");
+_LIT(KStrPOP3MTMConnectAndCopyAllMailAndDisconnect,"KPOP3MTMConnectAndCopyAllMailAndDisconnect");
+_LIT(KStrPOP3MTMMoveAllMailWhenAlreadyConnected,"KPOP3MTMMoveAllMailWhenAlreadyConnected");
+_LIT(KStrPOP3MTMConnectAndMoveAllMailAndStayOnline,"KPOP3MTMConnectAndMoveAllMailAndStayOnline");
+_LIT(KStrPOP3MTMConnectAndMoveAllMailAndDisconnect,"KPOP3MTMConnectAndMoveAllMailAndDisconnect");
+_LIT(KStrPOP3MTMCancelOfflineOperations,"KPOP3MTMCancelOfflineOperations");
+_LIT(KStrPOP3MTMCancelSendOnNextConnection,"KPOP3MTMCancelSendOnNextConnection");
+_LIT(KStrPOP3MTMCreateNewEmailMessage,"KPOP3MTMCreateNewEmailMessage");
+_LIT(KStrPOP3MTMCreateReplyEmailMessage,"KPOP3MTMCreateReplyEmailMessage");
+_LIT(KStrPOP3MTMCreateForwardEmailMessage,"KPOP3MTMCreateForwardEmailMessage");
+_LIT(KStrPOP3MTMCreateForwardAsAttachmentEmailMessage,"KPOP3MTMCreateForwardAsAttachmentEmailMessage");
+_LIT(KStrPOP3MTMCreateReceiptEmailMessage,"KPOP3MTMCreateReceiptEmailMessage");
+_LIT(KStrPOP3MTMPopulate,"KPOP3MTMPopulate");
+_LIT(KStrPOP3MTMPopulateNew,"KPOP3MTMPopulateNew");
+_LIT(KStrPOP3MTMPopulateAll,"KPOP3MTMPopulateAll");
+
+
+// TImapCmds specific Enumerations
+_LIT(KStrIMAP4MTMIsConnected, "KIMAP4MTMIsConnected");
+_LIT(KStrIMAP4MTMConnect, "KIMAP4MTMConnect");
+_LIT(KStrIMAP4MTMConnectAndSynchronise, "KIMAP4MTMConnectAndSynchronise");
+_LIT(KStrIMAP4MTMCancelBackgroundSynchronise, "KIMAP4MTMCancelBackgroundSynchronise");
+_LIT(KStrIMAP4MTMStartBatch, "KIMAP4MTMStartBatch");
+_LIT(KStrIMAP4MTMEndBatch, "KIMAP4MTMEndBatch");
+_LIT(KStrIMAP4MTMBusy, "KIMAP4MTMBusy");
+_LIT(KStrIMAP4MTMSelect, "KIMAP4MTMSelect");
+_LIT(KStrIMAP4MTMSynchronise, "KIMAP4MTMSynchronise");
+_LIT(KStrIMAP4MTMSyncTree, "KIMAP4MTMSyncTree");
+_LIT(KStrIMAP4MTMReserved10, "KIMAP4MTMReserved10");
+_LIT(KStrIMAP4MTMFullSync, "KIMAP4MTMFullSync");
+_LIT(KStrIMAP4MTMDisconnect, "KIMAP4MTMDisconnect");
+_LIT(KStrIMAP4MTMLocalSubscribe, "KIMAP4MTMLocalSubscribe");
+_LIT(KStrIMAP4MTMLocalUnsubscribe, "KIMAP4MTMLocalUnsubscribe");
+_LIT(KStrIMAP4MTMReserved15, "KIMAP4MTMReserved15");
+_LIT(KStrIMAP4MTMReserved16, "KIMAP4MTMReserved16");
+_LIT(KStrIMAP4MTMInboxNewSync, "KIMAP4MTMInboxNewSync");
+_LIT(KStrIMAP4MTMFolderFullSync, "KIMAP4MTMFolderFullSync");
+_LIT(KStrIMAP4MTMWaitForBackground, "KIMAP4MTMWaitForBackground");
+_LIT(KStrIMAP4MTMRenameFolder, "KIMAP4MTMRenameFolder");
+_LIT(KStrIMAP4MTMUndeleteAll, "KIMAP4MTMUndeleteAll");
+_LIT(KStrIMAP4MTMCancelOffLineOperations, "KIMAP4MTMCancelOffLineOperations");
+_LIT(KStrIMAP4MTMPopulate, "KIMAP4MTMPopulate");
+_LIT(KStrIMAP4MTMSyncSubscription, "KIMAP4MTMSyncSubscription");
+_LIT(KStrIMAP4MTMConnectAndSyncCompleteAfterConnect, "KIMAP4MTMConnectAndSyncCompleteAfterConnect");
+_LIT(KStrIMAP4MTMConnectAndSyncCompleteAfterFullSync, "KIMAP4MTMConnectAndSyncCompleteAfterFullSync");
+_LIT(KStrIMAP4MTMConnectAndSyncCompleteAfterDisconnect, "KIMAP4MTMConnectAndSyncCompleteAfterDisconnect");
+_LIT(KStrIMAP4MTMCancelSendOnNextConnection, "KIMAP4MTMCancelSendOnNextConnection");
+_LIT(KStrIMAP4MTMCopyNewMailWhenAlreadyConnected, "KIMAP4MTMCopyNewMailWhenAlreadyConnected");
+_LIT(KStrIMAP4MTMConnectAndCopyNewMailAndStayOnline, "KIMAP4MTMConnectAndCopyNewMailAndStayOnline");
+_LIT(KStrIMAP4MTMConnectAndCopyNewMailAndDisconnect, "KIMAP4MTMConnectAndCopyNewMailAndDisconnect");
+_LIT(KStrIMAP4MTMMoveNewMailWhenAlreadyConnected, "KIMAP4MTMMoveNewMailWhenAlreadyConnected");
+_LIT(KStrIMAP4MTMConnectAndMoveNewMailAndStayOnline, "KIMAP4MTMConnectAndMoveNewMailAndStayOnline");
+_LIT(KStrIMAP4MTMConnectAndMoveNewMailAndDisconnect, "KIMAP4MTMConnectAndMoveNewMailAndDisconnect");
+_LIT(KStrIMAP4MTMCopyMailSelectionWhenAlreadyConnected, "KIMAP4MTMCopyMailSelectionWhenAlreadyConnected");
+_LIT(KStrIMAP4MTMConnectAndCopyMailSelectionAndStayOnline, "KIMAP4MTMConnectAndCopyMailSelectionAndStayOnline");
+_LIT(KStrIMAP4MTMConnectAndCopyMailSelectionAndDisconnect, "KIMAP4MTMConnectAndCopyMailSelectionAndDisconnect");
+_LIT(KStrIMAP4MTMMoveMailSelectionWhenAlreadyConnected, "KIMAP4MTMMoveMailSelectionWhenAlreadyConnected");
+_LIT(KStrIMAP4MTMConnectAndMoveMailSelectionAndStayOnline, "KIMAP4MTMConnectAndMoveMailSelectionAndStayOnline");
+_LIT(KStrIMAP4MTMConnectAndMoveMailSelectionAndDisconnect, "KIMAP4MTMConnectAndMoveMailSelectionAndDisconnect");
+_LIT(KStrIMAP4MTMCopyAllMailWhenAlreadyConnected, "KIMAP4MTMCopyAllMailWhenAlreadyConnected");
+_LIT(KStrIMAP4MTMConnectAndCopyAllMailAndStayOnline, "KIMAP4MTMConnectAndCopyAllMailAndStayOnline");
+_LIT(KStrIMAP4MTMConnectAndCopyAllMailAndDisconnect, "KIMAP4MTMConnectAndCopyAllMailAndDisconnect");
+_LIT(KStrIMAP4MTMMoveAllMailWhenAlreadyConnected, "KIMAP4MTMMoveAllMailWhenAlreadyConnected");
+_LIT(KStrIMAP4MTMConnectAndMoveAllMailAndStayOnline, "KIMAP4MTMConnectAndMoveAllMailAndStayOnline");
+_LIT(KStrIMAP4MTMConnectAndMoveAllMailAndDisconnect, "KIMAP4MTMConnectAndMoveAllMailAndDisconnect");
+_LIT(KStrIMAP4MTMPopulateMailSelectionWhenAlreadyConnected, "KIMAP4MTMPopulateMailSelectionWhenAlreadyConnected");
+_LIT(KStrIMAP4MTMConnectAndPopulateMailSelectionAndStayOnline, "KIMAP4MTMConnectAndPopulateMailSelectionAndStayOnline");
+_LIT(KStrIMAP4MTMConnectAndPopulateMailSelectionAndDisconnect, "KIMAP4MTMConnectAndPopulateMailSelectionAndDisconnect");
+_LIT(KStrIMAP4MTMPopulateNewMailWhenAlreadyConnected, "KIMAP4MTMPopulateNewMailWhenAlreadyConnected");
+_LIT(KStrIMAP4MTMPopulateAllMailWhenAlreadyConnected, "KIMAP4MTMPopulateAllMailWhenAlreadyConnected");
+_LIT(KStrIMAP4MTMConnectAndPopulateNewMailAndStayOnline, "KIMAP4MTMConnectAndPopulateNewMailAndStayOnline");
+_LIT(KStrIMAP4MTMConnectAndPopulateNewMailAndDisconnect, "KIMAP4MTMConnectAndPopulateNewMailAndDisconnect");
+_LIT(KStrIMAP4MTMConnectAndPopulateAllMailAndStayOnline, "KIMAP4MTMConnectAndPopulateAllMailAndStayOnline");
+_LIT(KStrIMAP4MTMConnectAndPopulateAllMailAndDisconnect, "KIMAP4MTMConnectAndPopulateAllMailAndDisconnect");
+_LIT(KStrIMAP4MTMCreateNewEmailMessage, "KIMAP4MTMCreateNewEmailMessage");
+_LIT(KStrIMAP4MTMCreateReplyEmailMessage, "KIMAP4MTMCreateReplyEmailMessage");
+_LIT(KStrIMAP4MTMCreateForwardEmailMessage, "KIMAP4MTMCreateForwardEmailMessage");
+_LIT(KStrIMAP4MTMCreateForwardAsAttachmentEmailMessage, "KIMAP4MTMCreateForwardAsAttachmentEmailMessage");
+_LIT(KStrIMAP4MTMCreateReceiptEmailMessage, "KIMAP4MTMCreateReceiptEmailMessage");
+
+
+// TSmtpCmds specific Enumerations
+_LIT(KStrSMTPMTMCreateNewEmailMessage, "KSMTPMTMCreateNewEmailMessage");
+_LIT(KStrSMTPMTMCreateReplyEmailMessage, "KSMTPMTMCreateReplyEmailMessage");
+_LIT(KStrSMTPMTMCreateForwardEmailMessage, "KSMTPMTMCreateForwardEmailMessage");
+_LIT(KStrSMTPMTMCreateForwardAsAttachmentEmailMessage, "KSMTPMTMCreateForwardAsAttachmentEmailMessage");
+_LIT(KStrSMTPMTMCreateReceiptEmailMessage, "KSMTPMTMCreateReceiptEmailMessage");
+_LIT(KStrSMTPMTMSendOnNextConnection, "KSMTPMTMSendOnNextConnection");
+
+// DownloadType specific Enumerations
+//_LIT(KStrPartialDownload,"PartialDownload");
+//_LIT(KStrFullDownload,"FullDownload");
+
+
+// TCommDbDialogPref specific Enumerations
+//_LIT(KStrECommDbDialogPrefUnknown, "TCommDbDialogPref::ECommDbDialogPrefUnknown");
+_LIT(KStrECommDbDialogPrefPrompt, "TCommDbDialogPref::ECommDbDialogPrefPrompt");
+_LIT(KStrECommDbDialogPrefWarn, "TCommDbDialogPref::ECommDbDialogPrefWarn");
+_LIT(KStrECommDbDialogPrefDoNotPrompt,"TCommDbDialogPref::ECommDbDialogPrefDoNotPrompt");
+_LIT(KStrECommDbDialogPrefPromptIfWrongMode, "TCommDbDialogPref::ECommDbDialogPrefPromptIfWrongMode");
+
+
+// TImap4GetMailOptions specific Enumerations
+//_LIT(KStrEGetImap4EmailHeaders, "TImap4GetMailOptions::EGetImap4EmailHeaders");
+_LIT(KStrEGetImap4EmailBodyText, "TImap4GetMailOptions::EGetImap4EmailBodyText");
+_LIT(KStrEGetImap4EmailBodyTextAndAttachments, "TImap4GetMailOptions::EGetImap4EmailBodyTextAndAttachments");
+_LIT(KStrEGetImap4EmailAttachments, "TImap4GetMailOptions::EGetImap4EmailAttachments");
+_LIT(KStrEGetImap4EmailBodyAlternativeText, "TImap4GetMailOptions::EGetImap4EmailBodyAlternativeText");
+
+
+// TFolderSyncType specific Enumerations
+_LIT(KStrEUseCombination, "TFolderSyncType::EUseCombination");
+_LIT(KStrEUseLocal, "TFolderSyncType::EUseLocal");
+//_LIT(KStrEUseRemote, "TFolderSyncType::EUseRemote");	
+
+
+// TFolderSubscribeType specific Enumerations
+//_LIT(KStrEUpdateNeither, "TFolderSubscribeType::EUpdateNeither");
+_LIT(KStrEUpdateLocal, "TFolderSubscribeType::EUpdateLocal");
+_LIT(KStrEUpdateRemote, "TFolderSubscribeType::EUpdateRemote");
+_LIT(KStrEUpdateBoth, "TFolderSubscribeType::EUpdateBoth");
+
+
+// TImImap4PartialMailOptions specific Enumerations
+//_LIT(KStrENoSizeLimits, "TImImap4PartialMailOptions::ENoSizeLimits");
+_LIT(KStrEBodyTextOnly, "TImImap4PartialMailOptions::EBodyTextOnly");
+_LIT(KStrEAttachmentsOnly, "TImImap4PartialMailOptions::EAttachmentsOnly");
+_LIT(KStrEBodyTextAndAttachments, "TImImap4PartialMailOptions::EBodyTextAndAttachments");
+_LIT(KStrECumulative, "TImImap4PartialMailOptions::ECumulative");
+_LIT(KStrEBodyAlternativeText, "TImImap4PartialMailOptions::EBodyAlternativeText");
+
+
+// TMsgOutboxBodyEncoding specific Enumerations
+//_LIT(KStrEMsgOutboxDefault, "TMsgOutboxBodyEncoding::EMsgOutboxDefault");
+_LIT(KStrEMsgOutboxNoAlgorithm, "TMsgOutboxBodyEncoding::EMsgOutboxNoAlgorithm");
+_LIT(KStrEMsgOutboxMIME, "TMsgOutboxBodyEncoding::EMsgOutboxMIME");
+_LIT(KStrEMsgOutboxMHTMLAsMIME, "TMsgOutboxBodyEncoding::EMsgOutboxMHTMLAsMIME");
+_LIT(KStrEMsgOutboxMHTMLAlternativeAsMIME, "TMsgOutboxBodyEncoding::EMsgOutboxMHTMLAlternativeAsMIME");
+
+
+// TImSMTPSendMessageOption specific Enumerations
+//_LIT(KStrESendMessageImmediately , "TImSMTPSendMessageOption::ESendMessageImmediately ");
+_LIT(KStrESendMessageOnNextConnection, "TImSMTPSendMessageOption::ESendMessageOnNextConnection");
+_LIT(KStrESendMessageOnRequest, "TImSMTPSendMessageOption::ESendMessageOnRequest");
+
+
+// TImSMTPSendCopyToSelf specific Enumerations
+//_LIT(KStrESendNoCopy, "TImSMTPSendCopyToSelf::ESendNoCopy");
+_LIT(KStrESendCopyAsToRecipient, "TImSMTPSendCopyToSelf::ESendCopyAsToRecipient");
+_LIT(KStrESendCopyAsCcRecipient, "TImSMTPSendCopyToSelf::ESendCopyAsCcRecipient");
+_LIT(KStrESendCopyAsBccRecipient, "TImSMTPSendCopyToSelf::ESendCopyAsBccRecipient");
+
+
+// TPop3GetMailOptions specific Enumerations
+//_LIT(KStrEGetPop3EmailHeaders , "TPop3GetMailOptions::EGetPop3EmailHeaders");
+_LIT(KStrEGetPop3EmailMessages, "TPop3GetMailOptions::EGetPop3EmailMessages");
+
+
+// RAM Usage Logging Eventcodes
+_LIT(KStrImapRamUsageStart, "TInstrumentationPoint::EImapRamUsageStart");
+_LIT(KStrImapRamUsageStop, "TInstrumentationPoint::EImapRamUsageStop");
+_LIT(KStrPopRamUsageStart, "TInstrumentationPoint::EPopRamUsageStart");
+_LIT(KStrPopRamUsageStop, "TInstrumentationPoint::EPopRamUsageStop");
+_LIT(KStrSmtpRamUsageStart, "TInstrumentationPoint::ESmtpRamUsageStart");
+_LIT(KStrSmtpRamUsageStop, "TInstrumentationPoint::ESmtpRamUsageStop");
+_LIT(KStrSmtpRamUsageCreateMessageStart, "TInstrumentationPoint::ESmtpRamUsageCreateMessageStart");
+_LIT(KStrSmtpRamUsageCreateMessageStop, "TInstrumentationPoint::ESmtpRamUsageCreateMessageStop");
+_LIT(KStrSmtpRamUsageSendMessageStart, "TInstrumentationPoint::ESmtpRamUsageSendMessageStart");
+_LIT(KStrSmtpRamUsageSendMessageStop, "TInstrumentationPoint::ESmtpRamUsageSendMessageStop");
+_LIT(KStrSmtpCreateMessageSpeedStart, "TInstrumentationPoint::ESmtpCreateMessageSpeedStart");
+_LIT(KStrSmtpCreateMessageSpeedStop, "TInstrumentationPoint::ESmtpCreateMessageSpeedStop");
+_LIT(KStrSmtpSendMessageSpeedStart, "TInstrumentationPoint::ESmtpSendMessageSpeedStart");
+_LIT(KStrSmtpSendMessageSpeedStop, "TInstrumentationPoint::ESmtpSendMessageSpeedStop");
+_LIT(KStrImapDownloadMessageSpeedStart, "TInstrumentationPoint::EImapDownloadMessageSpeedStart");
+_LIT(KStrImapDownloadMessageSpeedStop, "TInstrumentationPoint::EImapDownloadMessageSpeedStop");
+
+// Bearer types
+_LIT(KStrBearerTypeUnknown, "Unknown");
+_LIT(KStrBearerTypeCsd, "CSD");
+_LIT(KStrBearerTypeWcdma, "Wcdma");
+_LIT(KStrBearerTypeLan, "LAN");
+_LIT(KStrBearerTypeCdma2000, "Cdma2000");
+_LIT(KStrBearerTypeVirtual, "Virtual");
+_LIT(KStrBearerTypePan, "PAN");
+_LIT(KStrBearerTypeWlan, "WLAN");
+_LIT(KStrBearerTypePsd, "PSD");
+_LIT(KStrBearerTypeCsdLan, "CSDLAN");
+
+/**
+CT_MsgUtilsEnumConverter()
+Constructor
+*/
+EXPORT_C CT_MsgUtilsEnumConverter::CT_MsgUtilsEnumConverter()
+	{
+	}
+
+/**
+~CT_MsgUtilsEnumConverter()
+Destructor
+*/
+CT_MsgUtilsEnumConverter::~CT_MsgUtilsEnumConverter()
+	{
+	}
+
+
+/**
+FindFolderIdByName()
+Returns the ID of the local folder based on the folder name.
+If the folder name given does not match then it returns -1.
+
+@param aFolderName
+Folder name whose ID need to be returned. Folder name is assumed to be in string form
+of the standard folder ID. Eg., GlobalInBoxIndexEntryId
+
+@return
+ID of the folder
+*/
+EXPORT_C TMsvId CT_MsgUtilsEnumConverter::FindFolderIdByName(TDesC& aFolderName)
+	{
+	TMsvId folderId;
+
+	STR_SWITCH(aFolderName)
+	
+	STR_CASE(KStrGlobalInBoxIndexEntryId)
+		{
+		folderId = KMsvGlobalInBoxIndexEntryId;
+		break;
+		}
+	STR_CASE(KStrGlobalOutBoxIndexEntryId)
+		{
+		folderId = KMsvGlobalOutBoxIndexEntryId;
+		break;
+		}
+	STR_CASE(KStrSentEntryId)
+		{
+		folderId = KMsvSentEntryId;
+		break;
+		}
+	STR_CASE(KStrDraftEntryId)
+		{
+		folderId = KMsvDraftEntryId;
+		break;
+		}
+	STR_CASE(KStrDeletedEntryFolderEntryId)
+		{
+		folderId = KMsvDeletedEntryFolderEntryId;
+		break;
+		}
+	STR_CASE(KStrRootIndexEntryId)
+		{
+		folderId = KMsvRootIndexEntryId;
+		break;
+		}
+	STR_CASE(KStrTempIndexEntryId)
+		{
+		folderId = KMsvTempIndexEntryId;
+		break;
+		}
+	STR_CASE(KStrLocalServiceIndexEntryId)
+		{
+		folderId = KMsvLocalServiceIndexEntryId;
+		break;
+		}
+	STR_CASE(KStrUnknownServiceIndexEntryId)
+		{
+		folderId = KMsvUnknownServiceIndexEntryId;
+		break;
+		}
+	STR_CASE(KStrFirstFreeEntryId)
+		{
+		folderId = KFirstFreeEntryId;
+		break;
+		}
+	DEFAULT_CASE()	// match not found
+		{
+		folderId = KErrNotFound;
+		}
+		
+	STR_SWITCH_END()
+
+	return folderId;
+	}
+
+
+/**
+ConvertDesToTPop3Cmds()
+Returns the corresponding Pop3 Command
+
+@param aPopCmdName
+POP command name
+
+@return
+POP3-specific commands
+*/
+EXPORT_C TPop3Cmds CT_MsgUtilsEnumConverter::ConvertDesToTPop3Cmds(const TDesC& aPopCmdName)
+	{
+	TPop3Cmds ret = KPOP3MTMConnect;
+
+	STR_SWITCH(aPopCmdName)
+
+	STR_CASE(KStrPOP3MTMIsConnected)
+		{
+		ret = KPOP3MTMIsConnected;
+		break;
+		}	
+	STR_CASE(KStrPOP3MTMConnect)
+		{
+		ret = KPOP3MTMConnect;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMDisconnect )
+		{
+		ret = KPOP3MTMDisconnect;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMCopyNewMailWhenAlreadyConnected )
+		{
+		ret = KPOP3MTMCopyNewMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndCopyNewMailAndStayOnline)
+		{
+		ret = KPOP3MTMConnectAndCopyNewMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndCopyNewMailAndDisconnect)
+		{
+		ret = KPOP3MTMConnectAndCopyNewMailAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMMoveNewMailWhenAlreadyConnected)
+		{
+		ret = KPOP3MTMMoveNewMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndMoveNewMailAndStayOnline)
+		{
+		ret = KPOP3MTMConnectAndMoveNewMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndMoveNewMailAndDisconnect)
+		{
+		ret = KPOP3MTMConnectAndMoveNewMailAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMCopyMailSelectionWhenAlreadyConnected)
+		{
+		ret = KPOP3MTMCopyMailSelectionWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndCopyMailSelectionAndStayOnline)
+		{
+		ret = KPOP3MTMConnectAndCopyMailSelectionAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndCopyMailSelectionAndDisconnect)
+		{
+		ret = KPOP3MTMConnectAndCopyMailSelectionAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMMoveMailSelectionWhenAlreadyConnected)
+		{
+		ret = KPOP3MTMMoveMailSelectionWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndMoveMailSelectionAndStayOnline)
+		{
+		ret = KPOP3MTMConnectAndMoveMailSelectionAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndMoveMailSelectionAndDisconnect)
+		{
+		ret = KPOP3MTMConnectAndMoveMailSelectionAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMCopyAllMailWhenAlreadyConnected)
+		{
+		ret = KPOP3MTMCopyAllMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndCopyAllMailAndStayOnline)
+		{
+		ret = KPOP3MTMConnectAndCopyAllMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndCopyAllMailAndDisconnect)
+		{
+		ret = KPOP3MTMConnectAndCopyAllMailAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMMoveAllMailWhenAlreadyConnected)
+		{
+		ret = KPOP3MTMMoveAllMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndMoveAllMailAndStayOnline)
+		{
+		ret = KPOP3MTMConnectAndMoveAllMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMConnectAndMoveAllMailAndDisconnect)
+		{
+		ret = KPOP3MTMConnectAndMoveAllMailAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMCancelOfflineOperations)
+		{
+		ret = KPOP3MTMCancelOfflineOperations;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMCancelSendOnNextConnection)
+		{
+		ret = KPOP3MTMCancelSendOnNextConnection;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMCreateNewEmailMessage)
+		{
+		ret = KPOP3MTMCreateNewEmailMessage;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMCreateReplyEmailMessage)
+		{
+		ret = KPOP3MTMCreateReplyEmailMessage;
+		break;
+		}		
+	STR_CASE(KStrPOP3MTMCreateForwardEmailMessage)
+		{
+		ret = KPOP3MTMCreateForwardEmailMessage;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMCreateForwardAsAttachmentEmailMessage)
+		{
+		ret = KPOP3MTMCreateForwardAsAttachmentEmailMessage;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMCreateReceiptEmailMessage)
+		{
+		ret = KPOP3MTMCreateReceiptEmailMessage;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMPopulate)
+		{
+		ret = KPOP3MTMPopulate;
+		break;
+		}
+	STR_CASE(KStrPOP3MTMPopulateNew)
+		{
+		ret = KPOP3MTMPopulateNew;
+		break;
+		}		
+	STR_CASE(KStrPOP3MTMPopulateAll)
+		{
+		ret = KPOP3MTMPopulateAll;
+		break;
+		}
+
+	DEFAULT_CASE()
+		{
+		ret = KPOP3MTMConnect;
+		}
+		
+	STR_SWITCH_END()
+	
+	return ret;
+	}
+
+
+/**
+ConvertDesToTImap4Cmds()
+Returns the corresponding IMAP4 Command
+
+@param aImapCmdName
+IMAP command name
+
+@return
+IMAP4-specific commands
+*/
+EXPORT_C TImap4Cmds CT_MsgUtilsEnumConverter::ConvertDesToTImap4Cmds(TDesC& aImapCmdName)
+	{
+	TImap4Cmds  ret;
+	STR_SWITCH(aImapCmdName)
+		
+	STR_CASE(KStrIMAP4MTMIsConnected)
+		{
+		ret = KIMAP4MTMIsConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnect)
+		{
+		ret = KIMAP4MTMConnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndSynchronise)
+		{
+		ret = KIMAP4MTMConnectAndSynchronise;
+		break;
+		}				
+	STR_CASE(KStrIMAP4MTMCancelBackgroundSynchronise)
+		{
+		ret = KIMAP4MTMCancelBackgroundSynchronise;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMStartBatch)
+		{
+		ret = KIMAP4MTMStartBatch;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMEndBatch)
+		{
+		ret = KIMAP4MTMEndBatch;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMBusy)
+		{
+		ret = KIMAP4MTMBusy;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMSelect)
+		{
+		ret = KIMAP4MTMSelect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMSynchronise)
+		{
+		ret = KIMAP4MTMSynchronise;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMSyncTree)
+		{
+		ret = KIMAP4MTMSyncTree;
+		break;
+		}				
+	STR_CASE(KStrIMAP4MTMReserved10)
+		{
+		ret = KIMAP4MTMReserved10;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMFullSync)
+		{
+		ret = KIMAP4MTMFullSync;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMDisconnect)
+		{
+		ret = KIMAP4MTMDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMLocalSubscribe)
+		{
+		ret = KIMAP4MTMLocalSubscribe;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMLocalUnsubscribe)
+		{
+		ret = KIMAP4MTMLocalUnsubscribe;
+		break;
+		}					
+	STR_CASE(KStrIMAP4MTMReserved15)
+		{
+		ret = KIMAP4MTMReserved15;
+		break;
+		}					
+	STR_CASE(KStrIMAP4MTMReserved16)
+		{
+		ret = KIMAP4MTMReserved16;
+		break;
+		}					
+	STR_CASE(KStrIMAP4MTMInboxNewSync)
+		{
+		ret = KIMAP4MTMInboxNewSync;
+		break;
+		}					
+	STR_CASE(KStrIMAP4MTMFolderFullSync)
+		{
+		ret = KIMAP4MTMFolderFullSync;
+		break;
+		}					
+	STR_CASE(KStrIMAP4MTMWaitForBackground)
+		{
+		ret = KIMAP4MTMWaitForBackground;
+		break;
+		}					
+	STR_CASE(KStrIMAP4MTMRenameFolder)
+		{
+		ret = KIMAP4MTMRenameFolder;
+		break;
+		}					
+	STR_CASE(KStrIMAP4MTMUndeleteAll)
+		{
+		ret = KIMAP4MTMUndeleteAll;
+		break;
+		}			
+							
+	STR_CASE(KStrIMAP4MTMCancelOffLineOperations)
+		{
+		ret = KIMAP4MTMCancelOffLineOperations;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMPopulate)
+		{
+		ret = KIMAP4MTMPopulate;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMSyncSubscription)
+		{
+		ret = KIMAP4MTMSyncSubscription;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndSyncCompleteAfterConnect)
+		{
+		ret = KIMAP4MTMConnectAndSyncCompleteAfterConnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndSyncCompleteAfterFullSync)
+		{
+		ret = KIMAP4MTMConnectAndSyncCompleteAfterFullSync;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndSyncCompleteAfterDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndSyncCompleteAfterDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMCancelSendOnNextConnection)
+		{
+		ret = KIMAP4MTMCancelSendOnNextConnection;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMCopyNewMailWhenAlreadyConnected)
+		{
+		ret = KIMAP4MTMCopyNewMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndCopyNewMailAndStayOnline)
+		{
+		ret = KIMAP4MTMConnectAndCopyNewMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndCopyNewMailAndDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndCopyNewMailAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMMoveNewMailWhenAlreadyConnected)
+		{
+		ret = KIMAP4MTMMoveNewMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndMoveNewMailAndStayOnline)
+		{
+		ret = KIMAP4MTMConnectAndMoveNewMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndMoveNewMailAndDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndMoveNewMailAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMCopyMailSelectionWhenAlreadyConnected)
+		{
+		ret = KIMAP4MTMCopyMailSelectionWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndCopyMailSelectionAndStayOnline)
+		{
+		ret = KIMAP4MTMConnectAndCopyMailSelectionAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndCopyMailSelectionAndDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndCopyMailSelectionAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMMoveMailSelectionWhenAlreadyConnected)
+		{
+		ret = KIMAP4MTMMoveMailSelectionWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndMoveMailSelectionAndStayOnline)
+		{
+		ret = KIMAP4MTMConnectAndMoveMailSelectionAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndMoveMailSelectionAndDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndMoveMailSelectionAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMCopyAllMailWhenAlreadyConnected)
+		{
+		ret = KIMAP4MTMCopyAllMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndCopyAllMailAndStayOnline)
+		{
+		ret = KIMAP4MTMConnectAndCopyAllMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndCopyAllMailAndDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndCopyAllMailAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMMoveAllMailWhenAlreadyConnected)
+		{
+		ret = KIMAP4MTMMoveAllMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndMoveAllMailAndStayOnline)
+		{
+		ret = KIMAP4MTMConnectAndMoveAllMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndMoveAllMailAndDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndMoveAllMailAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMPopulateMailSelectionWhenAlreadyConnected)
+		{
+		ret = KIMAP4MTMPopulateMailSelectionWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndPopulateMailSelectionAndStayOnline)
+		{
+		ret = KIMAP4MTMConnectAndPopulateMailSelectionAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndPopulateMailSelectionAndDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndPopulateMailSelectionAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMPopulateNewMailWhenAlreadyConnected)
+		{
+		ret = KIMAP4MTMPopulateNewMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMPopulateAllMailWhenAlreadyConnected)
+		{
+		ret = KIMAP4MTMPopulateAllMailWhenAlreadyConnected;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndPopulateNewMailAndStayOnline)
+		{
+		ret = KIMAP4MTMConnectAndPopulateNewMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndPopulateNewMailAndDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndPopulateNewMailAndDisconnect;
+		break;
+		}		
+	STR_CASE(KStrIMAP4MTMConnectAndPopulateAllMailAndStayOnline)
+		{
+		ret = KIMAP4MTMConnectAndPopulateAllMailAndStayOnline;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMConnectAndPopulateAllMailAndDisconnect)
+		{
+		ret = KIMAP4MTMConnectAndPopulateAllMailAndDisconnect;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMCreateNewEmailMessage)
+		{
+		ret = KIMAP4MTMCreateNewEmailMessage;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMCreateReplyEmailMessage)
+		{
+		ret = KIMAP4MTMCreateReplyEmailMessage;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMCreateForwardEmailMessage)
+		{
+		ret = KIMAP4MTMCreateForwardEmailMessage;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMCreateForwardAsAttachmentEmailMessage)
+		{
+		ret = KIMAP4MTMCreateForwardAsAttachmentEmailMessage;
+		break;
+		}
+	STR_CASE(KStrIMAP4MTMCreateReceiptEmailMessage)
+		{
+		ret = KIMAP4MTMCreateReceiptEmailMessage;
+		break;
+		}
+	DEFAULT_CASE()
+		{
+		ret = KIMAP4MTMConnectAndSynchronise;
+		}
+		
+	STR_SWITCH_END()	
+	return ret;
+	}
+
+
+/**
+ConvertDesToTSmtpCmdsL()
+Returns the corresponding SMTP Command
+
+@param aSmtpCmdName
+SMTP command name
+
+@return
+SMTP-specific commands
+*/
+EXPORT_C TSmtpCmds CT_MsgUtilsEnumConverter::ConvertDesToTSmtpCmdsL(TDesC& aSmtpCmdName)
+	{
+	TSmtpCmds  ret = KSMTPMTMCreateNewEmailMessage;
+	STR_SWITCH(aSmtpCmdName)
+		
+	STR_CASE(KStrSMTPMTMCreateNewEmailMessage)
+		{
+		ret = KSMTPMTMCreateNewEmailMessage;
+		break;
+		}
+	STR_CASE(KStrSMTPMTMCreateReplyEmailMessage)
+		{
+		ret = KSMTPMTMCreateReplyEmailMessage;
+		break;
+		}
+	STR_CASE(KStrSMTPMTMCreateForwardEmailMessage)
+		{
+		ret = KSMTPMTMCreateForwardEmailMessage;
+		break;
+		}
+	STR_CASE(KStrSMTPMTMCreateForwardAsAttachmentEmailMessage)
+		{
+		ret = KSMTPMTMCreateForwardAsAttachmentEmailMessage;
+		break;
+		}
+	STR_CASE(KStrSMTPMTMCreateReceiptEmailMessage)
+		{
+		ret = KSMTPMTMCreateReceiptEmailMessage;
+		break;
+		}
+	STR_CASE(KStrSMTPMTMSendOnNextConnection)
+		{
+		ret = KSMTPMTMSendOnNextConnection;
+		break;
+		}
+
+	DEFAULT_CASE()
+		{
+		User::Leave(KErrNotSupported);
+		}
+		
+	STR_SWITCH_END()	
+	return ret;
+	}
+
+	
+/**
+ConvertDesToTCommDbDialogPref()
+Returns the corresponding TCommDbDialogPref Enumeration
+
+@param aDialogPrefStr
+@return 
+TCommDbDialogPref enumeration
+*/	
+EXPORT_C TCommDbDialogPref CT_MsgUtilsEnumConverter::ConvertDesToTCommDbDialogPref(TDesC& aDialogPrefStr)
+	{
+	TCommDbDialogPref dialogPref;
+
+	STR_SWITCH(aDialogPrefStr)
+
+	STR_CASE(KStrECommDbDialogPrefPrompt)
+		{
+		dialogPref = ECommDbDialogPrefPrompt;
+		break;
+		}
+	STR_CASE(KStrECommDbDialogPrefWarn)
+		{
+		dialogPref = ECommDbDialogPrefWarn;
+		break;
+		}
+	STR_CASE(KStrECommDbDialogPrefDoNotPrompt)
+		{
+		dialogPref = ECommDbDialogPrefDoNotPrompt;
+		break;
+		}
+	STR_CASE(KStrECommDbDialogPrefPromptIfWrongMode)
+		{
+		dialogPref = ECommDbDialogPrefPromptIfWrongMode;
+		break;
+		}
+	DEFAULT_CASE()
+		{
+		dialogPref = ECommDbDialogPrefUnknown;
+		}
+	STR_SWITCH_END()
+
+	return dialogPref;
+	}	
+
+	
+/**
+ConvertDesToTImap4GetMailOptions()
+Returns the corresponding TImap4GetMailOptions Enumeration
+
+@param aMailOption
+@return
+TImap4GetMailOptions enumeration
+*/	
+EXPORT_C TImap4GetMailOptions CT_MsgUtilsEnumConverter::ConvertDesToTImap4GetMailOptions(TDesC& aMailOption)
+	{ 
+	TImap4GetMailOptions options = EGetImap4EmailAttachments;
+	
+	STR_SWITCH(aMailOption)
+	
+	STR_CASE(KStrEGetImap4EmailBodyText)
+		{
+		options = EGetImap4EmailBodyText;
+		break;
+		}
+	STR_CASE(KStrEGetImap4EmailBodyTextAndAttachments)
+		{
+		options = EGetImap4EmailBodyTextAndAttachments;
+		break;
+		}
+	STR_CASE(KStrEGetImap4EmailAttachments)
+		{
+		options = EGetImap4EmailAttachments;
+		break;
+		}
+	STR_CASE(KStrEGetImap4EmailBodyAlternativeText)
+		{
+		options = EGetImap4EmailBodyAlternativeText;
+		break;
+		}
+	DEFAULT_CASE()
+		{
+		options = EGetImap4EmailHeaders;
+		}
+	STR_SWITCH_END()
+
+	return options;
+	}	
+
+
+/**
+ConvertDesToTFolderSyncType()
+Returns the corresponding TFolderSyncType Enumeration
+
+@param aFolderSyncType
+@return
+TFolderSyncType enumeration
+*/	
+EXPORT_C TFolderSyncType CT_MsgUtilsEnumConverter::ConvertDesToTFolderSyncType(TDesC& aFolderSyncType)
+	{
+	TFolderSyncType syncType;
+	
+	STR_SWITCH(aFolderSyncType)
+		
+	STR_CASE(KStrEUseCombination)
+		{
+		syncType = EUseCombination;
+		break;
+		}
+	STR_CASE(KStrEUseLocal)
+		{
+		syncType = EUseLocal;
+		break;
+		}
+
+	DEFAULT_CASE()
+		{
+		syncType = EUseRemote;
+		}
+		
+	STR_SWITCH_END()
+
+	return syncType;
+	}
+
+
+/**
+ConvertDesToTFolderSubscribeType()
+Returns the corresponding TFolderSubscribeType Enumeration
+
+@param aFolderSubscriberType
+@return
+TFolderSubscribeType enumeration
+*/	
+EXPORT_C TFolderSubscribeType CT_MsgUtilsEnumConverter::ConvertDesToTFolderSubscribeType(TDesC& aFolderSubscriberType)
+	{
+	TFolderSubscribeType subscriberType;
+	
+	STR_SWITCH(aFolderSubscriberType)
+		
+	STR_CASE(KStrEUpdateLocal)
+		{
+		subscriberType = EUpdateLocal;
+		break;
+		}
+	STR_CASE(KStrEUpdateRemote)
+		{
+		subscriberType = EUpdateRemote;
+		break;
+		}
+	STR_CASE(KStrEUpdateBoth)
+		{
+		subscriberType = EUpdateBoth;
+		break;
+		}
+
+	DEFAULT_CASE()
+		{
+		subscriberType = EUpdateNeither;
+		}
+		
+	STR_SWITCH_END()
+
+	return subscriberType;
+	}
+
+
+/**
+ConvertDesToTImImap4PartialMailOptions()
+Returns the corresponding TImImap4PartialMailOptions Enumeration
+
+@param aPartialMailOption
+@return
+TImImap4PartialMailOptions
+*/
+EXPORT_C TImImap4PartialMailOptions CT_MsgUtilsEnumConverter::ConvertDesToTImImap4PartialMailOptions(TDesC& aPartialMailOption)
+	{
+	TImImap4PartialMailOptions partialOption;
+
+	STR_SWITCH(aPartialMailOption)
+		
+	STR_CASE(KStrEBodyTextOnly)
+		{
+		partialOption = EBodyTextOnly;
+		break;
+		}
+	STR_CASE(KStrEAttachmentsOnly)
+		{
+		partialOption = EAttachmentsOnly;
+		break;
+		}
+	STR_CASE(KStrEBodyTextAndAttachments)
+		{
+		partialOption = EBodyTextAndAttachments;
+		break;
+		}
+	STR_CASE(KStrECumulative)
+		{
+		partialOption = ECumulative;
+		break;
+		}
+	STR_CASE(KStrEBodyAlternativeText)
+		{
+		partialOption = EBodyAlternativeText;
+		break;
+		}
+	DEFAULT_CASE()
+		{
+		partialOption = ENoSizeLimits;
+		}
+		
+	STR_SWITCH_END()
+
+	return partialOption;
+	}
+
+
+/**
+ConvertDesToTMsgOutboxBodyEncoding()
+Returns the corresponding TMsgOutboxBodyEncoding Enumeration
+
+@param aOutboxBodyEncoding
+@return
+TMsgOutboxBodyEncoding 
+*/
+EXPORT_C TMsgOutboxBodyEncoding CT_MsgUtilsEnumConverter::ConvertDesToTMsgOutboxBodyEncoding(TDesC& aOutboxBodyEncoding)
+	{
+	TMsgOutboxBodyEncoding bodyEncoding;
+
+	STR_SWITCH(aOutboxBodyEncoding)
+		
+	STR_CASE(KStrEMsgOutboxNoAlgorithm)
+		{
+		bodyEncoding = EMsgOutboxNoAlgorithm;
+		break;
+		}
+	STR_CASE(KStrEMsgOutboxMIME)
+		{
+		bodyEncoding = EMsgOutboxMIME;
+		break;
+		}
+	STR_CASE(KStrEMsgOutboxMHTMLAsMIME)
+		{
+		bodyEncoding = EMsgOutboxMHTMLAsMIME;
+		break;
+		}
+	STR_CASE(KStrEMsgOutboxMHTMLAlternativeAsMIME)
+		{
+		bodyEncoding = EMsgOutboxMHTMLAlternativeAsMIME;
+		break;
+		}
+	DEFAULT_CASE()
+		{
+		bodyEncoding = EMsgOutboxDefault;
+		}
+		
+	STR_SWITCH_END()
+											
+	return bodyEncoding;
+	}
+
+
+/**
+ConvertDesToTImSMTPSendMessageOption()
+Returns the corresponding TImSMTPSendMessageOption Enumeration
+
+@param aSendMsgOption
+@return 
+TImSMTPSendMessageOption 
+*/
+EXPORT_C TImSMTPSendMessageOption CT_MsgUtilsEnumConverter::ConvertDesToTImSMTPSendMessageOption(TDesC& aSendMsgOption)
+	{
+	TImSMTPSendMessageOption messageOption;
+
+	STR_SWITCH(aSendMsgOption)
+		
+	STR_CASE(KStrESendMessageOnNextConnection)
+		{
+		messageOption = ESendMessageOnNextConnection;
+		break;
+		}
+	STR_CASE(KStrESendMessageOnRequest)
+		{
+		messageOption = ESendMessageOnRequest;
+		break;
+		}	
+	DEFAULT_CASE()
+		{
+		messageOption = ESendMessageImmediately;
+		}
+		
+	STR_SWITCH_END()
+						
+	return messageOption;
+	}
+
+
+/**
+ConvertDesToTImSMTPSendCopyToSelf()
+Returns the corresponding TImSMTPSendCopyToSelf Enumeration
+
+@param aSmtpCopyToSelf
+@return
+TImSMTPSendCopyToSelf 
+*/
+EXPORT_C TImSMTPSendCopyToSelf CT_MsgUtilsEnumConverter::ConvertDesToTImSMTPSendCopyToSelf(TDesC& aSmtpCopyToSelf)
+	{
+	TImSMTPSendCopyToSelf copyToSelf;
+
+	STR_SWITCH(aSmtpCopyToSelf)
+		
+	STR_CASE(KStrESendCopyAsToRecipient)
+		{
+		copyToSelf= ESendCopyAsToRecipient;
+		break;
+		}
+	STR_CASE(KStrESendCopyAsCcRecipient)
+		{
+		copyToSelf= ESendCopyAsCcRecipient;
+		break;
+		}
+	STR_CASE(KStrESendCopyAsBccRecipient)
+		{
+		copyToSelf= ESendCopyAsBccRecipient;
+		break;
+		}
+	DEFAULT_CASE()
+		{
+		copyToSelf= ESendNoCopy;
+		}
+		
+	STR_SWITCH_END()
+
+	return copyToSelf;
+	}	
+
+
+/**
+ConvertDesToTPop3GetMailOptions()
+Returns the corresponding TPop3GetMailOptions Enumeration
+
+@param aPop3MailOption
+@return
+TPop3GetMailOptions 
+*/
+EXPORT_C TPop3GetMailOptions CT_MsgUtilsEnumConverter::ConvertDesToTPop3GetMailOptions(TDesC& aPop3MailOption)
+	{
+	TPop3GetMailOptions popMailOption;
+
+	STR_SWITCH(aPop3MailOption)
+		
+	STR_CASE(KStrEGetPop3EmailMessages)
+		{
+		popMailOption = EGetPop3EmailMessages;
+		break;
+		}
+	DEFAULT_CASE()
+		{
+		popMailOption = EGetPop3EmailHeaders;
+		}
+		
+	STR_SWITCH_END()
+
+	return popMailOption;
+	}
+
+
+/**
+ConvertDesToEventCode()
+Returns the corresponding TInstrumentationPoint Enumeration
+
+@param aEventCodeString
+@return
+TInstrumentationPoint 
+*/
+EXPORT_C TInstrumentationPoint CT_MsgUtilsEnumConverter::ConvertDesToEventCode(TDesC& aEventCodeString)
+	{
+	TInstrumentationPoint eventCode;
+
+	STR_SWITCH(aEventCodeString)
+		
+	STR_CASE(KStrImapRamUsageStart)
+		{
+		eventCode = EImapRamUsageStart;
+		break;
+		}
+	STR_CASE(KStrImapRamUsageStop)
+		{
+		eventCode = EImapRamUsageStop;
+		break;
+		}
+	STR_CASE(KStrPopRamUsageStart)
+		{
+		eventCode = EPopRamUsageStart;
+		break;
+		}
+	STR_CASE(KStrPopRamUsageStop)
+		{
+		eventCode = EPopRamUsageStop;
+		break;
+		}
+	STR_CASE(KStrSmtpRamUsageStart)
+		{
+		eventCode = ESmtpRamUsageStart;
+		break;
+		}
+	STR_CASE(KStrSmtpRamUsageStop)
+		{
+		eventCode = ESmtpRamUsageStop;
+		break;
+		}
+	STR_CASE(KStrSmtpRamUsageCreateMessageStart)
+		{
+		eventCode = ESmtpRamUsageCreateMessageStart;
+		break;
+		}
+	STR_CASE(KStrSmtpRamUsageCreateMessageStop)
+		{
+		eventCode = ESmtpRamUsageCreateMessageStop;
+		break;
+		}
+	STR_CASE(KStrSmtpRamUsageSendMessageStart)
+		{
+		eventCode = ESmtpRamUsageSendMessageStart;
+		break;
+		}
+	STR_CASE(KStrSmtpRamUsageSendMessageStop)
+		{
+		eventCode = ESmtpRamUsageSendMessageStop;
+		break;
+		}
+	STR_CASE(KStrSmtpCreateMessageSpeedStart)
+		{
+		eventCode = ESmtpCreateMessageSpeedStart;
+		break;
+		}
+	STR_CASE(KStrSmtpCreateMessageSpeedStop)
+		{
+		eventCode = ESmtpCreateMessageSpeedStop;
+		break;
+		}
+	STR_CASE(KStrSmtpSendMessageSpeedStart)
+		{
+		eventCode = ESmtpSendMessageSpeedStart;
+		break;
+		}
+	STR_CASE(KStrSmtpSendMessageSpeedStop)
+		{
+		eventCode = ESmtpSendMessageSpeedStop;
+		break;
+		}
+	STR_CASE(KStrImapDownloadMessageSpeedStart)
+		{
+		eventCode = EImapDownloadMessageSpeedStart;
+		break;
+		}
+	STR_CASE(KStrImapDownloadMessageSpeedStop)
+		{
+		eventCode = EImapDownloadMessageSpeedStop;
+		break;
+		}
+		
+	DEFAULT_CASE()
+		{
+		eventCode = EBadEventCode;
+		}
+		
+	STR_SWITCH_END()
+
+	return eventCode;
+	}
+
+/**
+ConvertDesToBearerTypes()
+Returns the corresponding TUint32 representing bearer types
+
+@param aBearerTypesString Bearer types string
+@return Bearer types enum
+*/
+EXPORT_C TUint32 CT_MsgUtilsEnumConverter::ConvertDesToBearerTypes(const TDesC& aBearerTypesString)
+	{
+	TUint32 bearerTypes;
+
+	STR_SWITCH(aBearerTypesString)
+
+	STR_CASE(KStrBearerTypeUnknown)
+		{
+		bearerTypes = KCommDbBearerUnknown;
+		break;
+		}
+
+	STR_CASE(KStrBearerTypeCsd)
+		{
+		bearerTypes = KCommDbBearerCSD;
+		break;
+		}
+
+	STR_CASE(KStrBearerTypeWcdma)
+		{
+		bearerTypes = KCommDbBearerWcdma;
+		break;
+		}
+
+	STR_CASE(KStrBearerTypeLan)
+		{
+		bearerTypes = KCommDbBearerLAN;
+		break;
+		}
+
+	STR_CASE(KStrBearerTypeCdma2000)
+		{
+		bearerTypes = KCommDbBearerCdma2000;
+		break;
+		}
+
+	STR_CASE(KStrBearerTypeVirtual)
+		{
+		bearerTypes = KCommDbBearerVirtual;
+		break;
+		}
+
+	STR_CASE(KStrBearerTypePan)
+		{
+		bearerTypes = KCommDbBearerPAN;
+		break;
+		}
+
+	STR_CASE(KStrBearerTypeWlan)
+		{
+		bearerTypes = KCommDbBearerWLAN;
+		break;
+		}
+
+	STR_CASE(KStrBearerTypePsd)
+		{
+		bearerTypes = KCommDbBearerPSD;
+		break;
+		}
+
+	STR_CASE(KStrBearerTypeCsdLan)
+		{
+		bearerTypes = KCommDbBearerCSD | KCommDbBearerLAN;
+		break;
+		}
+
+	DEFAULT_CASE()
+		{
+		bearerTypes = KCommDbBearerUnknown;
+		}
+		
+	STR_SWITCH_END()
+
+	return bearerTypes;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/email/testutils/src/T_UtilsReadEmailSettingsFromConfigFile.cpp	Fri Oct 30 09:36:23 2009 +0000
@@ -0,0 +1,999 @@
+// Copyright (c) 2006-2009 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 "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Utility functions for reading the config/setting file to update
+// the CImImap4Settings, CImPop3Settings, CImSmtpSettings and CImIAPPreferences objects.
+// 
+//
+
+
+// User include
+#include <t_utilsenumconverter.h>
+#include <t_utilsconfigfileparserutility.h>
+#include <t_utilsconfigfilemachinename.h>
+#include <t_utilsreademailsettingsfromconfigfile.h>
+
+// epoc inlcude
+#include <f32file.h>
+#include <cdbcols.h>
+#include <imapset.h>
+#include <smtpset.h>
+#include <iapprefs.h>
+
+// Literals used
+
+// Imap Settings related literals
+_LIT(KCfgImapServerAddress, "ImapServerAddress"); 
+_LIT(KCfgImapLoginName, "ImapLoginName"); 
+_LIT(KCfgImapPassword, "ImapPassword");
+_LIT(KCfgImapPort, "ImapPort"); 
+_LIT(KCfgImapSecureSockets, "ImapSecureSockets");
+_LIT(KCfgImapSSLWrapper, "ImapSSLWrapper");
+_LIT(KCfgImapFolderPath, "ImapFolderPath");
+_LIT(KCfgImapPathSeperator, "ImapPathSeperator");
+_LIT(KCfgImapMaxEmailSize, "ImapMaxEmailSize");
+_LIT(KCfgImapGetMailOptions, "ImapGetMailOptions");
+_LIT(KCfgImapInboxSynchronisationLimit, "ImapInboxSynchronisationLimit");
+_LIT(KCfgImapMailboxSynchronisationLimit, "ImapMailSynchronisationLimit");
+_LIT(KUseExpunge , "ImapUseExpunge" );
+_LIT(KCfgImapAutoSendOnConnect, "ImapAutoSendOnConnect" );
+_LIT(KCfgImapDeleteEmailsWhenDisconnecting, "ImapDeleteEmailsWhenDisconnecting" );
+_LIT(KCfgImapAcknowledgeReceipts, "ImapAcknowledgeReceipts" );
+_LIT(KCfgImapDisconnectedUserMode, "ImapDisconnectedUserMode" );
+_LIT(KCfgImapSynchronise, "ImapSynchronise" );
+_LIT(KCfgImapSubscribe, "ImapSubscribe" );
+_LIT(KCfgImapUpdatingSeenFlags, "ImapUpdatingSeenFlags" );
+_LIT(KCfgImapSyncRate, "ImapSyncRate" );
+_LIT(KCfgImapFetchSize, "ImapFetchSize" );
+_LIT(KCfgImapIdle, "ImapIdle" );
+_LIT(KCfgImapIdleTimeout, "ImapIdleTimeout" );
+_LIT(KCfgImapPartialMailOptions, "ImapPartialMailOptions" );
+_LIT(KCfgImapBodyTextSizeLimit, "ImapBodyTextSizeLimit" ); 
+_LIT(KCfgImapAttachmentSizeLimit, "ImapAttachmentSizeLimit" );
+
+_LIT(KCfgImapIapList, "ImapIapList");
+_LIT(KCfgImapSNAPId, "ImapSNAPId");
+_LIT(KCfgImapBearerMobility, "ImapBearerMobility");
+_LIT(KCfgImapDownloadRules, "ImapDownloadRules");
+
+//
+// POP Settings related literals
+//
+_LIT(KCfgPopServerAddress, "PopServerAddress");
+_LIT(KCfgPopLoginName, "PopLoginName");
+_LIT(KCfgPopPassword, "PopPassword");
+_LIT(KCfgPopMaxEmailSize, "PopMaxEmailSize");
+_LIT(KCfgPopPort, "PopPort");
+_LIT(KCfgPopInboxSynchronisationLimit, "PopInboxSynchronisationLimit");
+_LIT(KCfgPopSecureSockets, "PopSecureSockets");
+_LIT(KCfgPopSSLWrapper, "PopSSLWrapper");
+_LIT(KCfgPopGetMailOptions, "PopGetMailOptions");
+_LIT(KCfgPopPopulationLimit, "PopPopulationLimit");
+_LIT(KCfgPopAutoSendOnConnect, "PopAutoSendOnConnect" );
+_LIT(KCfgPopDeleteEmailsWhenDisconnecting, "PopDeleteEmailsWhenDisconnecting" );
+_LIT(KCfgPopAcknowledgeReceipts, "PopAcknowledgeReceipts" );
+_LIT(KCfgPopDisconnectedUserMode, "PopDisconnectedUserMode" );
+_LIT(KCfgPopAPOPEncryption, "PopAPOPEncryption" );
+
+_LIT(KCfgPopIapList, "PopIapList");
+_LIT(KCfgPopSNAPId, "PopSNAPId");
+_LIT(KCfgPopBearerMobility, "PopBearerMobility");
+
+//
+// SMTP settings related literals
+//
+_LIT(KCfgSmtpServerAddress, "SmtpServerAddress");
+_LIT(KCfgSmtpEmailAddress, "SmtpEmailAddress");
+_LIT(KCfgSmtpBodyEncoding, "SmtpBodyEncoding");
+_LIT(KCfgSmtpReceiptAddress, "SmtpReceiptAddress");
+_LIT(KCfgSmtpRequestReceipts, "SmtpRequestReceipts");
+_LIT(KCfgSmtpSendMessageOption, "SmtpSendMessageOption");
+_LIT(KCfgSmtpEmailAlias, "SmtpEmailAlias");
+_LIT(KCfgSmtpDefaultMsgCharSet, "SmtpMsgCharSet");
+_LIT(KCfgSmtpSetPort, "SmtpSetPort");
+_LIT(KCfgSmtpSetReplyToAddress, "SmtpSetReplyToAddress");
+_LIT(KCfgSmtpSetAddVCardToEmail, "SmtpSetAddVCardToEmail");
+_LIT(KCfgSmtpSetAddSignatureToEmail, "SmtpSetAddSignatureToEmail");
+_LIT(KCfgSmtpSetSendCopyToSelf, "SmtpSetSendCopyToSelf");
+_LIT(KCfgSmtpSetLoginName, "SmtpSetLoginName");
+_LIT(KCfgSmtpSetPassword, "SmtpSetPassword");
+_LIT(KCfgSmtpSetSMTPAuth, "SmtpSetSMTPAuth");
+_LIT(KCfgSmtpSetInboxLoginDetails, "SmtpSetInboxLoginDetails");
+_LIT(KCfgSmtpSecureSockets, "SmtpSetSecureSockets");
+_LIT(KCfgSmtpSSLWrapper, "SmtpSetSSLWrapper");
+
+_LIT(KCfgSmtpIapList, "SmtpIapList");
+_LIT(KCfgSmtpSNAPId, "SmtpSNAPId");
+_LIT(KCfgSmtpBearerMobility, "SmtpBearerMobility");
+
+// Other Literals
+_LIT(KImapIAPSuffix, "_ImapIAP");
+_LIT(KImapCommDbDialogPref, "_ImapCommDbDialogPref");
+_LIT(KImapIAPIndex, "_ImapIAPIndex");
+_LIT(KPopIAPSuffix, "_PopIAP");
+_LIT(KPopCommDbDialogPref, "_PopCommDbDialogPref");
+_LIT(KPopIAPIndex, "_PopIAPIndex");
+_LIT(KSmtpIAPSuffix, "_SmtpIAP");
+_LIT(KSmtpCommDbDialogPref, "_SmtpCommDbDialogPref");
+_LIT(KSmtpIAPIndex, "_SmtpIAPIndex");
+
+
+/**
+ReadImapSettingsFromConfigurationFileL()
+Modifies the IMAP related default setting and IAP objects.
+
+@param  aSettingsFile
+Configuration/setting file path. 
+
+@param  aImapSet
+CImImap4Settings object.
+
+@param  aImapIapPref
+CImIAPPreferences object.
+*/
+EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadImapSettingsFromConfigurationFileL(
+															TDesC& aSettingsFile, CImImap4Settings& aImapSet, CImIAPPreferences& aImapIapPref,const TDesC& /* aPtrEmailAdd */)
+
+	{
+	// Parses the setting file
+	CT_MsgUtilsConfigFileParserUtility* scriptFileParser = CT_MsgUtilsConfigFileParserUtility::NewL(aSettingsFile);
+	CleanupStack::PushL(scriptFileParser);	
+	
+	TPtrC8 string8Ptr; 
+	TPtrC stringPtr = KNone(); 
+	TInt intTmp;
+		
+	if(scriptFileParser->GetFieldAsString(KCfgImapServerAddress, stringPtr) == KErrNone)
+		{
+		aImapSet.SetServerAddressL(stringPtr);
+		}
+
+	CT_MsgUtilsConfigFileMachineName* machineNameFile = CT_MsgUtilsConfigFileMachineName::NewLC(stringPtr);
+	TPtrC8 machineName(machineNameFile->MachineName());
+	
+	if(scriptFileParser->GetFieldAsString8(KCfgImapLoginName, string8Ptr) == KErrNone)
+		{
+		aImapSet.SetLoginNameL(string8Ptr);
+		}
+	else
+		{
+		aImapSet.SetLoginNameL(machineName);
+		}
+
+	if(scriptFileParser->GetFieldAsString8(KCfgImapPassword, string8Ptr) == KErrNone)
+		{
+		aImapSet.SetPasswordL(string8Ptr);
+		}
+	else
+		{
+		aImapSet.SetPasswordL(machineName);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapPort, intTmp) == KErrNone)
+		{
+		aImapSet.SetPort(intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapSecureSockets, intTmp) == KErrNone)
+		{		
+		aImapSet.SetSecureSockets( (TBool) intTmp );
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapSSLWrapper, intTmp ) == KErrNone)
+		{		
+		aImapSet.SetSSLWrapper( (TBool) intTmp );
+		}
+
+	if(scriptFileParser->GetFieldAsString8(KCfgImapFolderPath, string8Ptr) == KErrNone)
+		{
+		aImapSet.SetFolderPathL(string8Ptr);
+		}
+
+	if(scriptFileParser->GetFieldAsString8(KCfgImapPathSeperator, string8Ptr) == KErrNone)
+		{
+		if ( string8Ptr.Length() == 1  )
+			{
+			aImapSet.SetPathSeparator( string8Ptr[0] );			
+			}
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapMaxEmailSize, intTmp) == KErrNone)
+		{
+		aImapSet.SetMaxEmailSize(intTmp);
+		}
+	
+	if(scriptFileParser->GetFieldAsString(KCfgImapGetMailOptions, stringPtr) == KErrNone)
+		{
+		TImap4GetMailOptions setGetMailOptions = CT_MsgUtilsEnumConverter::ConvertDesToTImap4GetMailOptions(stringPtr);
+		aImapSet.SetGetMailOptions(setGetMailOptions);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapInboxSynchronisationLimit, intTmp) == KErrNone)
+		{
+		aImapSet.SetInboxSynchronisationLimit(intTmp);
+		}
+		
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapMailboxSynchronisationLimit, intTmp) == KErrNone)
+		{
+		aImapSet.SetMailboxSynchronisationLimit(intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapAutoSendOnConnect, intTmp) == KErrNone)
+		{		
+		aImapSet.SetAutoSendOnConnect((TBool) intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapDeleteEmailsWhenDisconnecting, intTmp) == KErrNone)
+		{		
+		aImapSet.SetDeleteEmailsWhenDisconnecting((TBool) intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapAcknowledgeReceipts, intTmp) == KErrNone)
+		{		
+		aImapSet.SetAcknowledgeReceipts((TBool) intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapDisconnectedUserMode, intTmp) == KErrNone)
+		{		
+		aImapSet.SetDisconnectedUserMode((TBool) intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsString(KCfgImapSynchronise, stringPtr) == KErrNone)
+		{
+		TFolderSyncType setFolderSyncType = CT_MsgUtilsEnumConverter::ConvertDesToTFolderSyncType(stringPtr);
+		aImapSet.SetSynchronise(setFolderSyncType);
+		}
+
+	if(scriptFileParser->GetFieldAsString(KCfgImapSubscribe, stringPtr) == KErrNone)
+		{
+		TFolderSubscribeType setFolderSubscribeType = CT_MsgUtilsEnumConverter::ConvertDesToTFolderSubscribeType(stringPtr);
+		aImapSet.SetSubscribe(setFolderSubscribeType);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapUpdatingSeenFlags, intTmp) == KErrNone)
+		{		
+		aImapSet.SetUpdatingSeenFlags((TBool) intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapSyncRate, intTmp) == KErrNone)
+		{
+		aImapSet.SetSyncRateL(intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapFetchSize, intTmp) == KErrNone)
+		{
+		aImapSet.SetFetchSizeL(intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapIdle, intTmp) == KErrNone)
+		{		
+		aImapSet.SetImapIdle( (TBool) intTmp );
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapIdleTimeout, intTmp) == KErrNone)
+		{
+		aImapSet.SetImapIdleTimeoutL(intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsString(KCfgImapPartialMailOptions, stringPtr) == KErrNone)
+		{
+		TImImap4PartialMailOptions setImap4PartialMailOptions = CT_MsgUtilsEnumConverter::ConvertDesToTImImap4PartialMailOptions(stringPtr);
+		aImapSet.SetPartialMailOptionsL(setImap4PartialMailOptions);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapBodyTextSizeLimit, intTmp) == KErrNone)
+		{
+		aImapSet.SetBodyTextSizeLimitL(intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapAttachmentSizeLimit, intTmp) == KErrNone)
+		{
+		aImapSet.SetAttachmentSizeLimitL(intTmp);
+		}
+
+	if(scriptFileParser->GetFieldAsString(KCfgImapIapList, stringPtr) == KErrNone)
+		{
+		ReadImapIAPAndAddL(scriptFileParser, (TDesC&)KCfgImapIapList, aImapIapPref);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KUseExpunge, intTmp) == KErrNone)
+		{		
+		aImapSet.SetUseExpunge( (TBool) intTmp);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapSNAPId, intTmp) == KErrNone)
+		{		
+		aImapIapPref.SetSNAPL(intTmp);
+		}
+		
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapBearerMobility, intTmp) == KErrNone)
+		{		
+		aImapSet.SetBearerMobility((TBool) intTmp);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgImapDownloadRules, intTmp) == KErrNone)
+		{		
+		aImapSet.SetUseSyncDownloadRules((TBool) intTmp);
+		}	
+	
+	CleanupStack::PopAndDestroy(2,scriptFileParser);
+	}
+
+/**
+ReadImapIAPAndAdd()_
+Gets the base string for the IAP list.
+
+@param  aScriptFileParser
+CT_MsgUtilsConfigFileParserUtility object.
+
+@param  aParamListName
+@param  aImapIapPref
+CImIAPPreferences object.
+*/	
+EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadImapIAPAndAddL(CT_MsgUtilsConfigFileParserUtility* aScriptFileParser, const TDesC& aParamListName, CImIAPPreferences& aImapIapPref)
+	{
+	TPtrC stringPtr; 	
+	TPtrC baseString; 
+	
+	if( aScriptFileParser->GetFieldAsString(aParamListName, stringPtr ) == KErrNone )
+		{
+		TInt start = 0;
+		TInt end = stringPtr.Length();
+		
+		while (GetString(stringPtr, start, end, baseString))
+			{
+			ReadImapIAPAndAddFieldL(aScriptFileParser, baseString, aImapIapPref);
+			//ReadImapIAPAndAddL(aScriptFileParser, baseString, aImapIapPref);
+			}
+		}		
+	}
+
+/**
+ReadImapIAPAndAddField()
+Modifies the CImIAPPreferences object.
+
+@param  aScriptFileParser
+CT_MsgUtilsConfigFileParserUtility object.
+
+@param  aFieldName 
+@param  aImapIapPref
+CImIAPPreferences object.
+*/
+EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadImapIAPAndAddFieldL( 
+										CT_MsgUtilsConfigFileParserUtility* aScriptFileParser, 
+										const TDesC& aFieldName, CImIAPPreferences& aImapIapPref)
+	{
+	
+	TPtrC stringPtr; 
+	TInt intTmp;
+	
+	TImIAPChoice iapChoice;
+	iapChoice.iIAP = 0;
+	iapChoice.iDialogPref = ECommDbDialogPrefUnknown;
+	
+	TInt index = 0;
+	TBool modified = EFalse;
+
+	HBufC* buf = HBufC::NewLC(100);
+			
+	buf->Des() = aFieldName;
+	buf->Des().Append(KImapIAPSuffix);
+			
+	if(aScriptFileParser->GetFieldAsInteger(buf->Des(), intTmp) == KErrNone)
+		{
+		iapChoice.iIAP = intTmp;
+		modified = ETrue;
+		}
+
+	buf->Des() = aFieldName;
+	buf->Des().Append(KImapCommDbDialogPref);
+	
+	if(aScriptFileParser->GetFieldAsString(buf->Des(), stringPtr) == KErrNone)
+		{
+		TCommDbDialogPref setCommDbDialogPref = CT_MsgUtilsEnumConverter::ConvertDesToTCommDbDialogPref(stringPtr);
+		iapChoice.iDialogPref = setCommDbDialogPref;
+		modified = ETrue;
+		}
+	
+	buf->Des() = aFieldName;
+	buf->Des().Append(KImapIAPIndex);
+	if(aScriptFileParser->GetFieldAsInteger(buf->Des(), intTmp) == KErrNone)
+		{
+		index = intTmp;
+		modified = ETrue;
+		}
+	
+	if (modified)
+		{ 
+		aImapIapPref.AddIAPL(iapChoice ,index );
+		}
+
+	CleanupStack::PopAndDestroy(buf);
+	}
+
+
+/**
+GetString()
+
+@param aStringPtr
+@param aStart
+@param aEnd
+@param aBaseString
+@return 
+*/
+EXPORT_C TBool CT_MsgUtilsReadEmailSettingsFromConfigFile::GetString(TDesC& aStringPtr, TInt& aStart, TInt aEnd, TPtrC& aBaseString)
+	{
+	TBool ret = EFalse;
+
+	if (aStart == aEnd)
+		{
+		return EFalse;				
+		}
+	
+	TInt currPos = aStart;
+	
+	// strip out any starting spaces.
+	while (currPos < aEnd )
+		{
+		if (aStringPtr[currPos] == ' ' || aStringPtr[currPos] == '\t')
+			{			
+			currPos++;	
+			}
+		else
+			{			
+			break;	
+			}
+		}
+	TInt startTmp = currPos;
+	//Looking for terminating space or Tab to determine the length of string
+	while (currPos < aEnd )
+		{
+		if (aStringPtr[currPos] == ' ' || aStringPtr[currPos] == '\t')
+			{			
+			break;
+			}
+		else
+			{
+			currPos++;
+			ret = ETrue;
+			}
+		}
+	
+	if (ret)
+		{	// We have a string.
+		aBaseString.Set(aStringPtr.Mid( startTmp, currPos - startTmp)); 
+		}
+		
+	aStart = currPos;
+	return ret;
+	}
+
+/**
+ReadPopSettingsFromConfigurationFileL()
+Modifies the POP related default setting and IAP objects.
+
+@param  aSettingsFile
+Configuration/setting file path. 
+
+@param  aPopSet
+CImPop3Settings object.
+
+@param  aPopIapPref
+*/
+EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(TDesC& aSettingsFile, 
+											CImPop3Settings& aPopSet, CImIAPPreferences& aPopIapPref, const TDesC& /*aPtrEmailAdd*/)
+	{
+	// Parses the setting file
+	CT_MsgUtilsConfigFileParserUtility* scriptFileParser = CT_MsgUtilsConfigFileParserUtility::NewL(aSettingsFile);
+	CleanupStack::PushL(scriptFileParser);	
+	
+	TPtrC8 string8Ptr; 
+	TPtrC stringPtr = KNone(); 
+	TInt intValue;
+
+	if(scriptFileParser->GetFieldAsString(KCfgPopServerAddress, stringPtr) == KErrNone)
+		{	
+		aPopSet.SetServerAddressL(stringPtr);
+		}
+
+	CT_MsgUtilsConfigFileMachineName* machineNameFile = CT_MsgUtilsConfigFileMachineName::NewLC(stringPtr);
+	TPtrC8 machineName(machineNameFile->MachineName());
+
+	
+	if(scriptFileParser->GetFieldAsString8(KCfgPopLoginName, string8Ptr) == KErrNone)
+		{
+		aPopSet.SetLoginNameL(string8Ptr);
+		}
+
+	else
+		{
+		aPopSet.SetLoginNameL(machineName);
+		}
+	
+	if(scriptFileParser->GetFieldAsString8(KCfgPopPassword, string8Ptr) == KErrNone)
+		{
+		aPopSet.SetPasswordL(string8Ptr);
+		}
+
+	else
+		{
+		aPopSet.SetPasswordL(machineName);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopMaxEmailSize, intValue) == KErrNone)
+		{
+		aPopSet.SetMaxEmailSize(intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopPort, intValue) == KErrNone)
+		{
+		aPopSet.SetPort(intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopInboxSynchronisationLimit, intValue) == KErrNone)
+		{
+		aPopSet.SetInboxSynchronisationLimit(intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopSecureSockets, intValue) == KErrNone)
+		{
+		aPopSet.SetSecureSockets((TBool)intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopSSLWrapper, intValue) == KErrNone)
+		{
+		aPopSet.SetSSLWrapper((TBool)intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsString(KCfgPopGetMailOptions, stringPtr) == KErrNone)
+		{
+		TPop3GetMailOptions options = CT_MsgUtilsEnumConverter::ConvertDesToTPop3GetMailOptions(stringPtr);
+		aPopSet.SetGetMailOptions(options);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopPopulationLimit, intValue) == KErrNone)
+		{
+		aPopSet.SetPopulationLimitL(intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopAutoSendOnConnect, intValue) == KErrNone)
+		{	
+		aPopSet.SetAutoSendOnConnect((TBool) intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopDeleteEmailsWhenDisconnecting, intValue) == KErrNone)
+		{	
+		aPopSet.SetDeleteEmailsWhenDisconnecting((TBool) intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopAcknowledgeReceipts, intValue) == KErrNone)
+		{	
+		aPopSet.SetAcknowledgeReceipts((TBool) intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopDisconnectedUserMode, intValue) == KErrNone)
+		{	
+		aPopSet.SetDisconnectedUserMode((TBool) intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopAPOPEncryption, intValue) == KErrNone)
+		{	
+		aPopSet.SetApop((TBool) intValue);
+		}
+		
+	if(scriptFileParser->GetFieldAsString(KCfgPopIapList, stringPtr) == KErrNone)
+		{
+		ReadPopIAPAndAddL(scriptFileParser, (TDesC&) KCfgPopIapList, aPopIapPref);
+		}
+		
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopSNAPId, intValue) == KErrNone)
+		{		
+		aPopIapPref.SetSNAPL(intValue);
+		}
+		
+	if(scriptFileParser->GetFieldAsInteger(KCfgPopBearerMobility, intValue) == KErrNone)
+		{	
+		aPopSet.SetBearerMobility((TBool) intValue);
+		}
+		
+	CleanupStack::PopAndDestroy(2,scriptFileParser);
+	}
+
+/**
+*
+ReadPopIAPAndAdd()
+Gets the base string for the IAP list.
+
+@param  aScriptFileParser
+CT_MsgUtilsConfigFileParserUtility object.
+
+@param  aParamListName
+@param  aPopIapPref
+*/	
+EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopIAPAndAddL( 
+									CT_MsgUtilsConfigFileParserUtility* aScriptFileParser,
+									const TDesC& aParamListName, CImIAPPreferences& aPopIapPref)
+	{
+	TPtrC stringPtr; 	
+	TPtrC baseString; 
+	
+	if( aScriptFileParser->GetFieldAsString(aParamListName, stringPtr) == KErrNone )
+		{
+		TInt start = 0;
+		TInt end = stringPtr.Length();
+		
+		while (GetString(stringPtr, start, end, baseString))
+			{
+			ReadPopIAPAndAddFieldL(aScriptFileParser, baseString, aPopIapPref);
+			}
+		}		
+		
+	}
+/**
+ReadPopIAPAndAddField()
+Modifies the CImIAPPreferences object.
+
+@param  aScriptFileParser
+CT_MsgUtilsConfigFileParserUtility object.
+
+@param  aFieldName
+@param  aPopIapPref
+*/	
+EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopIAPAndAddFieldL( 
+									CT_MsgUtilsConfigFileParserUtility* aScriptFileParser, 
+									const TDesC& aFieldName, CImIAPPreferences& aPopIapPref)
+	{
+	TPtrC stringPtr; 
+	TInt intTmp;
+	
+	TImIAPChoice iapChoice;
+
+	iapChoice.iIAP = 0;
+	iapChoice.iDialogPref = ECommDbDialogPrefUnknown;
+	
+	TInt index = 0;
+	TBool modified = EFalse;
+		
+	HBufC* buf = HBufC::NewLC(100);
+			
+	buf->Des() = aFieldName;
+	buf->Des().Append(KPopIAPSuffix);
+	
+	if(aScriptFileParser->GetFieldAsInteger(buf->Des(), intTmp) == KErrNone)
+		{
+		iapChoice.iIAP = intTmp;
+		modified = ETrue;
+		}
+
+	buf->Des() = aFieldName;
+	buf->Des().Append(KPopCommDbDialogPref);
+	if(aScriptFileParser->GetFieldAsString(buf->Des(), stringPtr) == KErrNone)
+		{
+		TCommDbDialogPref setCommDbDialogPref = CT_MsgUtilsEnumConverter::ConvertDesToTCommDbDialogPref(stringPtr);
+		iapChoice.iDialogPref = setCommDbDialogPref;
+		modified = ETrue;
+		}
+
+	buf->Des() = aFieldName;
+	buf->Des().Append(KPopIAPIndex);
+	if(aScriptFileParser->GetFieldAsInteger(buf->Des(), intTmp) == KErrNone)
+		{
+		index = intTmp;
+		modified = ETrue;
+		}
+	
+	if (modified)
+		{
+		aPopIapPref.AddIAPL(iapChoice ,index);
+		}
+
+	CleanupStack::PopAndDestroy(buf);		
+	}
+
+/**
+ReadSmtpSettingsFromConfigurationFileL()
+Modifies the POP related default setting and IAP objects.
+
+@param  aSettingsFile
+Configuration/setting file path. 
+
+@param  aSmtpSet
+@param  aSmtpIapPref
+*/	
+EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(TDesC& aSettingsFile, 
+										CImSmtpSettings& aSmtpSet, CImIAPPreferences& aSmtpIapPref,const TDesC&/* aPtrEmailAdd*/)
+	{
+	// Parses the setting file
+	CT_MsgUtilsConfigFileParserUtility* scriptFileParser = CT_MsgUtilsConfigFileParserUtility::NewL(aSettingsFile);
+	CleanupStack::PushL(scriptFileParser);	
+	
+	TPtrC8 string8Ptr; 
+	TPtrC stringPtr = KNone(); 
+	TInt intValue;
+
+	if(scriptFileParser->GetFieldAsString(KCfgSmtpServerAddress, stringPtr) == KErrNone)
+		{
+		aSmtpSet.SetServerAddressL(stringPtr);
+		}
+	
+	CT_MsgUtilsConfigFileMachineName* machineNameFile = CT_MsgUtilsConfigFileMachineName::NewLC(stringPtr);
+	TPtrC emailAddr(machineNameFile->MachineNameEmail());
+	TPtrC8 machineName(machineNameFile->MachineName());
+	
+	if(scriptFileParser->GetFieldAsString(KCfgSmtpEmailAddress, stringPtr) == KErrNone)
+		{
+		aSmtpSet.SetEmailAddressL(stringPtr);
+		}
+		
+	else
+		{
+		aSmtpSet.SetEmailAddressL(emailAddr);
+		}
+
+	if(scriptFileParser->GetFieldAsString(KCfgSmtpBodyEncoding, stringPtr) == KErrNone)
+		{
+		TMsgOutboxBodyEncoding setBodyEncoding = CT_MsgUtilsEnumConverter::ConvertDesToTMsgOutboxBodyEncoding(stringPtr);
+		aSmtpSet.SetBodyEncoding(setBodyEncoding);
+		}
+	
+	if(scriptFileParser->GetFieldAsString(KCfgSmtpReceiptAddress, stringPtr) == KErrNone)
+		{
+		aSmtpSet.SetReceiptAddressL(stringPtr);
+		}
+		
+	else
+		{
+		aSmtpSet.SetReceiptAddressL(emailAddr);
+		}
+		
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpRequestReceipts, intValue) == KErrNone)
+		{		
+		aSmtpSet.SetRequestReceipts((TBool) intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsString(KCfgSmtpSendMessageOption, stringPtr) == KErrNone)
+		{
+		TImSMTPSendMessageOption setSendMessageOption = CT_MsgUtilsEnumConverter::ConvertDesToTImSMTPSendMessageOption(stringPtr);
+		aSmtpSet.SetSendMessageOption(setSendMessageOption);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetPort, intValue) == KErrNone)
+		{
+		aSmtpSet.SetPort(intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsString(KCfgSmtpEmailAlias, stringPtr) == KErrNone)
+		{
+		aSmtpSet.SetEmailAliasL(stringPtr);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpDefaultMsgCharSet, intValue) == KErrNone)
+		{
+		TUid tmp = { intValue };
+		aSmtpSet.SetDefaultMsgCharSet(tmp);
+		}
+	
+	if(scriptFileParser->GetFieldAsString(KCfgSmtpSetReplyToAddress, stringPtr) == KErrNone)
+		{
+		aSmtpSet.SetReplyToAddressL(stringPtr);
+		}
+		
+	else
+		{
+		aSmtpSet.SetReplyToAddressL(emailAddr);
+		}
+			
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetAddVCardToEmail, intValue) == KErrNone)
+		{		
+		aSmtpSet.SetAddVCardToEmail((TBool) intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetAddSignatureToEmail, intValue) == KErrNone)
+		{		
+		aSmtpSet.SetAddSignatureToEmail((TBool) intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsString(KCfgSmtpSetSendCopyToSelf, stringPtr) == KErrNone)
+		{
+		TImSMTPSendCopyToSelf setSMTPSendCopyToSelf = CT_MsgUtilsEnumConverter::ConvertDesToTImSMTPSendCopyToSelf(stringPtr);
+		aSmtpSet.SetSendCopyToSelf(setSMTPSendCopyToSelf);
+		}
+	
+	if(scriptFileParser->GetFieldAsString8(KCfgSmtpSetLoginName, string8Ptr) == KErrNone)
+		{
+		aSmtpSet.SetLoginNameL(string8Ptr);
+		}
+		
+	else
+		{
+		aSmtpSet.SetLoginNameL(machineName);	
+		}
+			
+	if(scriptFileParser->GetFieldAsString8(KCfgSmtpSetPassword, string8Ptr) == KErrNone)
+		{
+		aSmtpSet.SetPasswordL(string8Ptr);
+		}
+
+	else
+		{
+		aSmtpSet.SetPasswordL(machineName);	
+		}
+			
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetSMTPAuth, intValue) == KErrNone)
+		{		
+		aSmtpSet.SetSMTPAuth((TBool) intValue);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetInboxLoginDetails, intValue) == KErrNone)
+		{		
+		aSmtpSet.SetInboxLoginDetails((TBool) intValue);
+		}
+
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSecureSockets, intValue) == KErrNone)
+		{		
+		aSmtpSet.SetSecureSockets((TBool) intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSSLWrapper, intValue) == KErrNone)
+		{		
+		aSmtpSet.SetSSLWrapper((TBool) intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsString(KCfgSmtpIapList, stringPtr) == KErrNone)
+		{
+		ReadSmtpIAPAndAddL(scriptFileParser, KCfgSmtpIapList, aSmtpIapPref);
+		}
+		
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSNAPId, intValue) == KErrNone)
+		{		
+		aSmtpIapPref.SetSNAPL(intValue);
+		}
+	
+	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpBearerMobility, intValue) == KErrNone)
+		{		
+		aSmtpSet.SetBearerMobility((TBool) intValue);
+		}	
+	
+	CleanupStack::PopAndDestroy(2,scriptFileParser);
+	
+	}
+	
+/**
+ReadSmtpIAPAndAdd()
+Gets the base string for the IAP list.
+
+@param  aScriptFileParser
+CT_MsgUtilsConfigFileParserUtility object.
+
+@param  aParamListName
+@param  aSmtpIapPref
+*/	
+EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpIAPAndAddL(
+						CT_MsgUtilsConfigFileParserUtility* aScriptFileParser, 
+						const TDesC& aParamListName, CImIAPPreferences& aSmtpIapPref)
+	{
+	
+	TPtrC stringPtr; 	
+	TPtrC baseString; 
+	
+	if( aScriptFileParser->GetFieldAsString(aParamListName, stringPtr) == KErrNone)
+		{
+		TInt start = 0;
+		TInt end = stringPtr.Length();
+		
+		while (GetString(stringPtr ,start, end, baseString))
+			{
+			ReadSmtpIAPAndAddFieldL(aScriptFileParser, baseString, aSmtpIapPref);
+			}
+		}
+	}
+
+/**
+ReadSmtpIAPAndAddField()
+Modifies the CImIAPPreferences object.
+
+@param  aScriptFileParser
+CT_MsgUtilsConfigFileParserUtility object.
+
+@param  aFieldName
+@param  aSmtpIapPref
+*/	
+EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpIAPAndAddFieldL(
+							CT_MsgUtilsConfigFileParserUtility* aScriptFileParser , 
+							const TDesC& aFieldName, CImIAPPreferences& aSmtpIapPref)
+	{
+	TPtrC stringPtr; 
+	TInt intTmp;
+	
+	TImIAPChoice iapChoice;
+
+	iapChoice.iIAP = 0;
+	iapChoice.iDialogPref = ECommDbDialogPrefUnknown;
+	
+	TInt index = 0;
+	TBool modified = EFalse;
+		
+	HBufC* buf = HBufC::NewLC(100);
+			
+	buf->Des() = aFieldName;
+	buf->Des().Append(KSmtpIAPSuffix);
+	
+	if(aScriptFileParser->GetFieldAsInteger(buf->Des(), intTmp) == KErrNone)
+		{
+		iapChoice.iIAP = intTmp;
+		modified = ETrue;
+		}
+
+	buf->Des() = aFieldName;
+	buf->Des().Append(KSmtpCommDbDialogPref);
+	if(aScriptFileParser->GetFieldAsString(buf->Des(), stringPtr) == KErrNone)
+		{
+		TCommDbDialogPref setCommDbDialogPref = CT_MsgUtilsEnumConverter::ConvertDesToTCommDbDialogPref(stringPtr);
+		iapChoice.iDialogPref = setCommDbDialogPref;
+		modified = ETrue;
+		}
+
+	buf->Des() = aFieldName;
+	buf->Des().Append(KSmtpIAPIndex);
+	if(aScriptFileParser->GetFieldAsInteger(buf->Des(), intTmp) == KErrNone)
+		{
+		index = intTmp;
+		modified = ETrue;
+		}
+	
+	if (modified)
+		{
+		aSmtpIapPref.AddIAPL(iapChoice, index);
+		}
+	CleanupStack::PopAndDestroy(buf);		
+	}
+	
+
+/**
+CompareIapPrefs()
+Compares the IAP preference objects.
+
+@param  aPrefs1
+CImIAPPreferences object.
+
+@param  aPrefs2
+CImIAPPreferences object.
+
+@return
+If the objects are same returns ETrue
+*/
+EXPORT_C TBool CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(CImIAPPreferences& aPrefs1, CImIAPPreferences& aPrefs2)
+	{
+	// Compare version
+	if (aPrefs1.Version() != aPrefs2.Version())
+		{
+		return EFalse;
+		}	
+	// Compare number of IAPs stored
+	TInt numIAPs1 = aPrefs1.NumberOfIAPs();
+	
+	if (numIAPs1 != aPrefs2.NumberOfIAPs())
+		{
+		return EFalse;
+		}
+	// Compare individual IAPs
+	for (TInt i = 0; i < numIAPs1; i++)
+		{
+		if (aPrefs1.IAPPreference(i).iIAP != aPrefs2.IAPPreference(i).iIAP ||
+			aPrefs1.IAPPreference(i).iDialogPref != aPrefs2.IAPPreference(i).iDialogPref)
+			{
+			return EFalse;
+			}
+		}
+	return ETrue;
+	}