email/pop3andsmtpmtm/clientmtms/test/src/T_imcm02b2.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name of test harness: T_IMCM02B2
       
    15 // Component: IMCM
       
    16 // Owner: KP
       
    17 // Brief description of test harness:
       
    18 // Tests CImEmailOperation - reply to plaintext message including/excluding 
       
    19 // attachments; reply to plaintext message as HTML including/excluding 
       
    20 // attachments; reply to HTML message including/excluding attachments; reply 
       
    21 // to HTML message without text alternative including/excluding attachments; 
       
    22 // Also tests adding VCard and signature from the SMTP settings.
       
    23 // Detailed description of test harness:
       
    24 // As above
       
    25 // Input files required to run test harness:
       
    26 // \MSG\IMCMTSRC\contacts.cdb					<DRIVE>:\system\data\contacts.cdb
       
    27 // \MSG\IMCMTSRC\T_IMCM02B2_Entry_Structure.txt	<DRIVE>:\msgtest\IMCM\T_IMCM02B2_Entry_Structure.txt
       
    28 // \MSG\IMCMTSRC\rfc82201.txt					<DRIVE>:\msgtest\IMCM\rfc82201.txt
       
    29 // \MSG\IMCMTSRC\rfc82202.txt					<DRIVE>:\msgtest\IMCM\rfc82202.txt
       
    30 // \MSG\IMCMTSRC\rfc82203.txt					<DRIVE>:\msgtest\IMCM\rfc82203.txt
       
    31 // \MSG\IMCMTSRC\rfc82204.txt					<DRIVE>:\msgtest\IMCM\rfc82204.txt
       
    32 // \MSG\IMCMTSRC\rfc82205.txt					<DRIVE>:\msgtest\IMCM\rfc82205.txt
       
    33 // \MSG\IMCMTSRC\rfc82206.txt					<DRIVE>:\msgtest\IMCM\rfc82206.txt
       
    34 // Intermediate files produced while running test harness:
       
    35 // <DRIVE>:\msglogs\T_IMCM02B2\Entry_Structure.txt
       
    36 // Output files produced by running test harness:
       
    37 // <DRIVE>:\msglogs\T_IMCM02B2.<PLATFORM>.<VARIANT>.LOG.txt
       
    38 // Description of how to build test harness:
       
    39 // cd \msg\imcm\
       
    40 // bldmake bldfiles
       
    41 // abld test build
       
    42 // Description of how to run test harness:
       
    43 // The following instructions are the same for all platforms:
       
    44 // 1. Build T_DB test harness from COMMDB component:
       
    45 // cd \commdb\group
       
    46 // bldmake bldfiles
       
    47 // abld test build t_db
       
    48 // 2. Build the test utilities:
       
    49 // cd \msg\testutils\group\
       
    50 // bldmake bldfiles
       
    51 // abld build
       
    52 // WINS running instructions:
       
    53 // 1. \epoc32\release\wins\<VARIANT>\T_IMCM02B2.exe can be used at the command prompt
       
    54 // or executable can be run from Windows Explorer.
       
    55 // All other platform running instructions:
       
    56 // 1. Copy \epoc32\release\<PLATFORM>\<VARIANT>\T_IMCM02B2.exe onto the other platform
       
    57 // 2. Copy \epoc32\release\<PLATFORM>\<VARIANT>\MSVTESTUTILS.DLL into 
       
    58 // <DRIVE>:\system\libs on the other platform
       
    59 // 3. Copy \epoc32\release\<PLATFORM>\<VARIANT>\EMAILTESTUTILS.DLL into 
       
    60 // <DRIVE>:\system\libs on the other platform
       
    61 // 4. Run T_IMCM02B2.exe on the other platform
       
    62 // 
       
    63 //
       
    64 
       
    65 #include "emailtestutils.h"
       
    66 
       
    67 #include <miutmsg.h>
       
    68 
       
    69 
       
    70 #include <apfrec.h>
       
    71 #include <apgicnfl.h>
       
    72 #include <ecom/ecom.h>
       
    73 
       
    74 #include <mmsvattachmentmanager.h>
       
    75 #include <cemailaccounts.h>
       
    76 
       
    77 #include <cntdb.h>
       
    78 
       
    79 // local variables etc //
       
    80 
       
    81 _LIT(KImcm02Test, "T_IMCM02b2 - CImEmailOperation Tests");
       
    82 RTest test(KImcm02Test);
       
    83 
       
    84 LOCAL_D CTrapCleanup* theCleanup;
       
    85 
       
    86 LOCAL_D TMsvId pop3Service;
       
    87 LOCAL_D TMsvId smtpService;
       
    88 LOCAL_D CEmailTestUtils* testUtils;
       
    89 LOCAL_D CMsvEntrySelection* messageSelection;
       
    90 LOCAL_D TInt testNo = 1;
       
    91 LOCAL_D TBool testFailed=EFalse;
       
    92 
       
    93 #define KComponent				_L("IMCM")
       
    94 #define KTestMessageDir			_L("")
       
    95 #define KOkFileNameEntryStructure _L("T_IMCM02b2_Entry_Structure.txt")
       
    96 
       
    97 LOCAL_D TBool StartTimeSet=EFalse;
       
    98 LOCAL_D TTime StartTime;
       
    99 LOCAL_D TInt  KnownDateTimeIndex=0;
       
   100 
       
   101 LOCAL_C void SetKnownDateAndTime()
       
   102 	{
       
   103 	TDateTime aDateTimes[]={
       
   104 				TDateTime(2002,EJune,18,10,30,0,0),
       
   105 				TDateTime(2003,EJanuary,1,21,0,0,0),
       
   106 				TDateTime(2001,EDecember,18,2,15,0,0),
       
   107 				TDateTime(2004,EMay,18,17,50,0,0)
       
   108 				};
       
   109 	if (!StartTimeSet)
       
   110 		{
       
   111 		StartTime.UniversalTime();
       
   112 		StartTimeSet=ETrue;
       
   113 		}
       
   114 	TTime aFakeTime(aDateTimes[KnownDateTimeIndex++]);
       
   115 	KnownDateTimeIndex&=3;
       
   116 	User::SetHomeTime(aFakeTime);
       
   117 	}
       
   118 
       
   119 LOCAL_C void RestoreDateAndTime()
       
   120 	{
       
   121 	if (StartTimeSet)
       
   122 		{
       
   123 		TTime aCurrentTime;
       
   124 		aCurrentTime.UniversalTime();
       
   125 		TTimeIntervalSeconds aDuration;
       
   126 		if (!aCurrentTime.SecondsFrom(StartTime,aDuration))
       
   127 			StartTime+=aDuration;
       
   128 		User::SetHomeTime(StartTime);
       
   129 		StartTimeSet=EFalse;
       
   130 		}
       
   131 	}
       
   132 
       
   133 LOCAL_C void InitL()
       
   134 	{
       
   135 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
       
   136 	CActiveScheduler::Install(scheduler);
       
   137 	CleanupStack::PushL(scheduler);
       
   138 
       
   139 	testUtils = CEmailTestUtils::NewLC(test);
       
   140 	testUtils->CreateAllTestDirectories();
       
   141 	CContactDatabase* contacts(NULL);
       
   142 	TRAPD(err, contacts = CContactDatabase::OpenL());
       
   143 	delete contacts;
       
   144 	if (err==KErrNotFound)
       
   145 		{
       
   146 		testUtils->WriteComment(_L("contacts file is missing from system data"));		
       
   147 		testFailed=ETrue;
       
   148 		return;
       
   149 		}
       
   150 	testUtils->FileSession().SetSessionPath(_L("C:\\"));
       
   151 	testUtils->ClearEmailAccountsL();
       
   152 	testUtils->CleanMessageFolderL();
       
   153 	testUtils->GoServerSideL();
       
   154 
       
   155 	testUtils->WriteComment(_L("CImEmailOperation Tests"));
       
   156 	}
       
   157 	
       
   158 LOCAL_C void Closedown()
       
   159 	{
       
   160 	CleanupStack::PopAndDestroy(2);  //testUtils, scheduler
       
   161 	User::After(5000000);
       
   162 	}
       
   163 
       
   164 LOCAL_C void CreateReplyL(TMsvId aMessageId, TMsvPartList aPartList, TMsvEmailTypeList aMsvEmailTypeList, TInt aTestNo)
       
   165 	{
       
   166 	testUtils->TestStart(aTestNo);
       
   167 	CTestActive* testActive = new (ELeave) CTestActive();
       
   168 	CleanupStack::PushL(testActive);
       
   169 
       
   170 	CImEmailOperation* emailOperation = CImEmailOperation::CreateReplyL(testActive->iStatus, *(testUtils->iMsvSession), aMessageId, KMsvGlobalOutBoxIndexEntryId, aPartList, aMsvEmailTypeList, KUidMsgTypeSMTP);
       
   171 	CleanupStack::PushL(emailOperation);
       
   172 
       
   173 	testActive->StartL();
       
   174 	CActiveScheduler::Start();
       
   175 	testUtils->TestFinish(aTestNo,testActive->iStatus.Int());
       
   176 	CleanupStack::PopAndDestroy(2); // testActive, emailOperation
       
   177 	}
       
   178 
       
   179 LOCAL_C void SetAddVCardToEmailL(TBool addVCard, TMsvId serviceId)
       
   180 	{
       
   181 	CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
       
   182 	CleanupStack::PushL(smtpSettings);
       
   183 
       
   184 	CEmailAccounts* accounts = CEmailAccounts::NewLC();	
       
   185 	TSmtpAccount account;
       
   186 	accounts->GetSmtpAccountL(serviceId, account);
       
   187   	accounts->LoadSmtpSettingsL(account, *smtpSettings);
       
   188 
       
   189 	smtpSettings->SetAddVCardToEmail(addVCard);
       
   190 	accounts->SaveSmtpSettingsL(account, *smtpSettings);
       
   191 
       
   192 	CleanupStack::PopAndDestroy(2); // smtpSettings, msvStore/accounts
       
   193 	}
       
   194 
       
   195 LOCAL_C void CreateSignatureL(TMsvId serviceId)
       
   196 	{
       
   197 	testUtils->iMsvEntry->SetEntryL(serviceId);
       
   198 	CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL();
       
   199 	CleanupStack::PushL(paraFormatLayer);
       
   200 
       
   201 	CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); 
       
   202 	CleanupStack::PushL(charFormatLayer);
       
   203 
       
   204 	CRichText* signature=CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256);
       
   205 	CleanupStack::PushL(signature);
       
   206 
       
   207 	TBuf<100> bodyContents = _L("(Signature:) Symbian Ltd.");
       
   208 	signature->InsertL(0, bodyContents);
       
   209 
       
   210 	CMsvStore* msvStore = testUtils->iMsvEntry->EditStoreL();
       
   211 	CleanupStack::PushL(msvStore);
       
   212 	
       
   213 	msvStore->StoreBodyTextL(*signature);
       
   214 	msvStore->Commit();
       
   215 	CleanupStack::PopAndDestroy(4); // msvStore, signature, charFormatLayer, paraFormatLayer
       
   216 	}
       
   217 
       
   218 LOCAL_C void SetSignatureToEmailL(TBool addSignature, TMsvId serviceId)
       
   219 	{
       
   220 	CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
       
   221 	CleanupStack::PushL(smtpSettings);
       
   222 
       
   223 	CEmailAccounts* accounts = CEmailAccounts::NewLC();
       
   224 	TSmtpAccount account;
       
   225 	accounts->GetSmtpAccountL(serviceId, account);
       
   226   	accounts->LoadSmtpSettingsL(account, *smtpSettings);
       
   227 
       
   228 	smtpSettings->SetAddSignatureToEmail(addSignature);
       
   229 	accounts->SaveSmtpSettingsL(account, *smtpSettings);
       
   230 
       
   231 	CleanupStack::PopAndDestroy(2); // smtpSettings, msvStore/accounts
       
   232 
       
   233 	if (addSignature)
       
   234 		testUtils->WriteComment(_L("\tAdd VCard"));
       
   235 	}
       
   236 
       
   237 
       
   238 LOCAL_C void SetDefaultServiceL(TMsvId smtpService)
       
   239 	{
       
   240 	CEmailAccounts* accounts = CEmailAccounts::NewLC();
       
   241 	TSmtpAccount account;
       
   242 	accounts->GetSmtpAccountL(smtpService, account);
       
   243 	accounts->SetDefaultSmtpAccountL(account);
       
   244 	// is default service ??
       
   245 	TSmtpAccount defaultAccount;
       
   246 	accounts->DefaultSmtpAccountL(defaultAccount);
       
   247 	if (smtpService != defaultAccount.iSmtpService)
       
   248 		{
       
   249 		User::Leave(KErrNotFound);
       
   250 		}
       
   251 	CleanupStack::PopAndDestroy(accounts);
       
   252 	}
       
   253 
       
   254 
       
   255 LOCAL_C TMsvId CreateNewPlaintextMessageWithIncompleteAttachmentL()
       
   256 	{
       
   257 	TMsvEmailTypeList msvEmailTypeList = 0;
       
   258 	TMsvPartList partList = 0;
       
   259 
       
   260 	CTestActive* testActive = new (ELeave) CTestActive();
       
   261 	CleanupStack::PushL(testActive);
       
   262 	partList = (KMsvMessagePartBody | KMsvMessagePartAttachments);
       
   263 	CImEmailOperation* emailOperation = CImEmailOperation::CreateNewL(testActive->iStatus, *(testUtils->iMsvSession), KMsvGlobalInBoxIndexEntryId, partList, msvEmailTypeList, KUidMsgTypeSMTP);
       
   264 	CleanupStack::PushL(emailOperation);
       
   265 
       
   266 	testActive->StartL();
       
   267 	CActiveScheduler::Start();
       
   268 	if (testActive->iStatus.Int())
       
   269 		{
       
   270 		testUtils->WriteComment(_L("CreateNewPlaintextMessageWithIncompleteAttachmentL failed"));
       
   271 		testUtils->TestHarnessFailed(testActive->iStatus.Int());
       
   272 		}
       
   273 
       
   274 	//check progress
       
   275 	TMsvId temp;	
       
   276 	TPckgC<TMsvId> paramPack(temp);
       
   277 	const TDesC8& progBuf1 = emailOperation->ProgressL();	
       
   278 	paramPack.Set(progBuf1);
       
   279 	TMsvId messageId = paramPack();	
       
   280 
       
   281 	CleanupStack::PopAndDestroy(2); // testActive, emailOperation
       
   282 
       
   283 	//
       
   284 	// Add an attachment
       
   285 	//
       
   286 	testActive = new (ELeave) CTestActive();
       
   287 	CleanupStack::PushL(testActive);
       
   288 
       
   289 	_LIT(KAttachment1, "C:\\mailtest\\IMCM\\rfc82201.txt");
       
   290 	_LIT(KAttachment2, "C:\\mailtest\\IMCM\\rfc82202.txt");
       
   291 
       
   292 	CImEmailMessage* imEmailMessage = CImEmailMessage::NewLC(*(testUtils->iMsvEntry));
       
   293 	testUtils->iMsvEntry->SetEntryL(messageId);
       
   294 	CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
       
   295 	CleanupStack::PushL(attachmentInfo);
       
   296 	imEmailMessage->AttachmentManager().AddAttachmentL(KAttachment1, attachmentInfo, testActive->iStatus);
       
   297 	CleanupStack::Pop(attachmentInfo);	
       
   298 
       
   299 	testActive->StartL();
       
   300 	CActiveScheduler::Start();	// wait for the asynch operation to complete
       
   301 
       
   302 	if (testActive->iStatus.Int())
       
   303 		{
       
   304 		testUtils->WriteComment(_L("CreateNewPlaintextMessageWithIncompleteAttachmentL failed"));
       
   305 		testUtils->TestHarnessFailed(testActive->iStatus.Int());
       
   306 		}
       
   307 		
       
   308 	testUtils->iMsvEntry->SetEntryL(messageId);
       
   309 	attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
       
   310 	CleanupStack::PushL(attachmentInfo);
       
   311 	imEmailMessage->AttachmentManager().AddAttachmentL(KAttachment2, attachmentInfo, testActive->iStatus);
       
   312 	CleanupStack::Pop(attachmentInfo);	
       
   313 	testActive->StartL();
       
   314 	CActiveScheduler::Start();	// wait for the asynch operation to complete
       
   315 
       
   316 	if (testActive->iStatus.Int())
       
   317 		{
       
   318 		testUtils->WriteComment(_L("CreateNewPlaintextMessageWithIncompleteAttachmentL failed"));
       
   319 		testUtils->TestHarnessFailed(testActive->iStatus.Int());
       
   320 		}
       
   321 	const TDesC8& progBuf2 = imEmailMessage->ProgressL();	
       
   322 	paramPack.Set(progBuf2);
       
   323 	TMsvId attachmentId = paramPack();	
       
   324 
       
   325 	CleanupStack::PopAndDestroy(2); // imEmailMessage, testActive
       
   326 
       
   327 	//
       
   328 	// Set the attachment to be not complete
       
   329 	//
       
   330 	
       
   331 	testUtils->iMsvEntry->SetEntryL(attachmentId);
       
   332 	TMsvEmailEntry attachmentEntry = testUtils->iMsvEntry->Entry();
       
   333 	attachmentEntry.SetComplete(EFalse);
       
   334 	testUtils->iMsvEntry->ChangeL(attachmentEntry);
       
   335 
       
   336 	return messageId;
       
   337 	}
       
   338 
       
   339 LOCAL_C void DoHtmlCreateReplyTestsL(TMsvId aMessageId)
       
   340 	{
       
   341 	TMsvPartList partList = 0;
       
   342 	TMsvEmailTypeList emailTypeList = KMsvEmailTypeListMHTMLMessage;
       
   343 
       
   344 	//
       
   345 	// HTML Messages
       
   346 	//
       
   347 	testUtils->WriteComment(_L("\tHTML Create Reply Message Tests"));
       
   348 
       
   349 	// basic new message with nothing!
       
   350 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   351 
       
   352 	// only body
       
   353 	partList = KMsvMessagePartBody;
       
   354 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   355 
       
   356 	// only attachment
       
   357 	partList = KMsvMessagePartAttachments;
       
   358 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   359 
       
   360 	// only body and attachment
       
   361 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   362 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   363 
       
   364 	// basic new message with subject
       
   365 	partList = KMsvMessagePartDescription;
       
   366 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   367 
       
   368 	// only body and subject
       
   369 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   370 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   371 
       
   372 	// only attachment and subject
       
   373 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   374 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   375 
       
   376 	// only body, attachment and subject 
       
   377 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   378 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   379 
       
   380 	// basic new message with originator
       
   381 	partList = KMsvMessagePartOriginator;
       
   382 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   383 
       
   384 	// only body and originator
       
   385 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   386 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   387 
       
   388 	// only attachment and originator
       
   389 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   390 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   391 
       
   392 	// only body, attachment and originator
       
   393 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   394 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   395 
       
   396 	// basic new message with subject and originator
       
   397 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   398 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   399 
       
   400 	// only body, subject and originator
       
   401 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   402 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   403 
       
   404 	// only attachment, subject and originator
       
   405 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   406 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   407 
       
   408 	// only body, attachment, subject and originator
       
   409 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   410 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   411 
       
   412 	// basic new message with recipients
       
   413 	partList = KMsvMessagePartRecipient;
       
   414 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   415 
       
   416 	// only body and recipients
       
   417 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   418 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   419 
       
   420 	// only attachment and recipients
       
   421 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   422 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   423 
       
   424 	// only body, attachment and recipients
       
   425 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   426 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   427 
       
   428 	// basic new message with subject and recipients
       
   429 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   430 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   431 
       
   432 	// only body, subject and recipients
       
   433 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   434 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   435 
       
   436 	// only attachment, subject and recipients
       
   437 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   438 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   439 
       
   440 	// only body, attachment, subject and recipients
       
   441 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   442 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   443 
       
   444 	// basic new message with originator and recipients
       
   445 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   446 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   447 
       
   448 	// only body, originator and recipients
       
   449 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   450 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   451 
       
   452 	// only attachment, originator and recipients
       
   453 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   454 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   455 
       
   456 	// only body, attachment, originator and recipients
       
   457 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   458 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   459 
       
   460 	// basic new message with subject, originator and recipients
       
   461 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   462 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   463 
       
   464 	// only body, subject, originator and recipients
       
   465 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   466 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   467 
       
   468 	// only attachment, subject, originator and recipients
       
   469 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   470 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   471 
       
   472 	// only body, attachment, subject, originator and recipients
       
   473 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   474 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   475 
       
   476 	// Create a VCard and store in the SMTP settings
       
   477 	SetAddVCardToEmailL(ETrue, smtpService);
       
   478 	testUtils->WriteComment(_L("\tHTML Create Reply Message with VCard Tests"));
       
   479 
       
   480 	// basic new message with VCard
       
   481 	partList = 0;
       
   482 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   483 
       
   484 	// only body and VCard
       
   485 	partList = KMsvMessagePartBody;
       
   486 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   487 
       
   488 	// only attachment and VCard
       
   489 	partList = KMsvMessagePartAttachments;
       
   490 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   491 
       
   492 	// only body, attachment and VCard
       
   493 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   494 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   495 
       
   496 	// basic new message with subject and VCard
       
   497 	partList = KMsvMessagePartDescription;
       
   498 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   499 
       
   500 	// only body, subject and VCard
       
   501 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   502 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   503 
       
   504 	// only attachment, subject and VCard
       
   505 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   506 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   507 
       
   508 	// only body, attachment, subject and VCard
       
   509 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   510 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   511 
       
   512 	// basic new message with originator and VCard
       
   513 	partList = KMsvMessagePartOriginator;
       
   514 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   515 
       
   516 	// only body, originator and VCard
       
   517 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   518 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   519 
       
   520 	// only attachment, originator and VCard
       
   521 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   522 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   523 
       
   524 	// only body, attachment, originator and VCard
       
   525 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   526 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   527 
       
   528 	// basic new message with subject, originator and VCard
       
   529 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   530 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   531 
       
   532 	// only body, subject, originator and VCard
       
   533 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   534 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   535 
       
   536 	// only attachment, subject, originator and VCard
       
   537 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   538 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   539 
       
   540 	// only body, attachment, subject, originator and VCard
       
   541 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   542 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   543 
       
   544 	// basic new message with recipients and VCard
       
   545 	partList = KMsvMessagePartRecipient;
       
   546 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   547 
       
   548 	// only body, recipients and VCard
       
   549 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   550 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   551 
       
   552 	// only attachment, recipients and VCard
       
   553 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   554 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   555 
       
   556 	// only body, attachment, recipients and VCard
       
   557 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   558 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   559 
       
   560 	// basic new message with subject, recipients and VCard
       
   561 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   562 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   563 
       
   564 	// only body, subject, recipients and VCard
       
   565 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   566 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   567 
       
   568 	// only attachment, subject, recipients and VCard
       
   569 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   570 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   571 
       
   572 	// only body, attachment, subject, recipients and VCard
       
   573 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   574 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   575 
       
   576 	// basic new message with originator, recipients and VCard
       
   577 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   578 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   579 
       
   580 	// only body, originator, recipients and VCard
       
   581 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   582 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   583 
       
   584 	// only attachment, originator, recipients and VCard
       
   585 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   586 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   587 
       
   588 	// only body, attachment, originator, recipients and VCard
       
   589 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   590 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   591 
       
   592 	// basic new message with subject, originator, recipients and VCard
       
   593 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   594 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   595 
       
   596 	// only body, subject, originator, recipients and VCard
       
   597 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   598 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   599 
       
   600 	// only attachment, subject, originator, recipients and VCard
       
   601 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   602 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   603 
       
   604 	// only body, attachment, subject, originator, recipients and VCard
       
   605 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   606 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   607 
       
   608 	// Store signature in the SMTP settings
       
   609 	SetAddVCardToEmailL(EFalse, smtpService);
       
   610 	CreateSignatureL(smtpService);
       
   611 	SetSignatureToEmailL(ETrue, smtpService);
       
   612 	testUtils->WriteComment(_L("\tHTML Create Reply Message with Signature Tests"));
       
   613 
       
   614 	// basic new message with signature!
       
   615 	partList = 0;
       
   616 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   617 
       
   618 	// only body and signature
       
   619 	partList = KMsvMessagePartBody;
       
   620 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   621 
       
   622 	// only attachment and signature
       
   623 	partList = KMsvMessagePartAttachments;
       
   624 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   625 
       
   626 	// only body, attachment and signature
       
   627 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   628 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   629 
       
   630 	// basic new message with subject and signature
       
   631 	partList = KMsvMessagePartDescription;
       
   632 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   633 
       
   634 	// only body, subject and signature
       
   635 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   636 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   637 
       
   638 	// only attachment, subject and signature
       
   639 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   640 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   641 
       
   642 	// only body, attachment, subject and signature
       
   643 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   644 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   645 
       
   646 	// basic new message with originator and signature
       
   647 	partList = KMsvMessagePartOriginator;
       
   648 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   649 
       
   650 	// only body, originator and signature
       
   651 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   652 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   653 
       
   654 	// only attachment, originator and signature
       
   655 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   656 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   657 
       
   658 	// only body, attachment, originator and signature
       
   659 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   660 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   661 
       
   662 	// basic new message with subject, originator and signature
       
   663 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   664 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   665 
       
   666 	// only body, subject, originator and signature
       
   667 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   668 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   669 
       
   670 	// only attachment, subject, originator and signature
       
   671 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   672 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   673 
       
   674 	// only body, attachment, subject, originator and signature
       
   675 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   676 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   677 
       
   678 	// basic new message with recipients and signature
       
   679 	partList = KMsvMessagePartRecipient;
       
   680 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   681 
       
   682 	// only body, recipients and signature
       
   683 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   684 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   685 
       
   686 	// only attachment, recipients and signature
       
   687 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   688 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   689 
       
   690 	// only body, attachment, recipients and signature
       
   691 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   692 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   693 
       
   694 	// basic new message with subject, recipients and signature
       
   695 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   696 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   697 
       
   698 	// only body, subject, recipients and signature
       
   699 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   700 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   701 
       
   702 	// only attachment, subject, recipients and signature
       
   703 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   704 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   705 
       
   706 	// only body, attachment, subject, recipients and signature
       
   707 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   708 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   709 
       
   710 	// basic new message with originator, recipients and signature
       
   711 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   712 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   713 
       
   714 	// only body, originator, recipients and signature
       
   715 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   716 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   717 
       
   718 	// only attachment, originator, recipients and signature
       
   719 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   720 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   721 
       
   722 	// only body, attachment, originator, recipients and signature
       
   723 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   724 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   725 
       
   726 	// basic new message with subject, originator, recipients and signature
       
   727 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   728 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   729 
       
   730 	// only body, subject, originator, recipients and signature
       
   731 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   732 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   733 
       
   734 	// only attachment, subject, originator, recipients and signature
       
   735 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   736 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   737 
       
   738 	// only body, attachment, subject, originator, recipients and signature
       
   739 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   740 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   741 
       
   742 	// Create a VCard and store in the SMTP settings
       
   743 	SetAddVCardToEmailL(ETrue, smtpService);
       
   744 	testUtils->WriteComment(_L("\tHTML Create Reply Message with VCard and signature Tests"));
       
   745 
       
   746 	// basic new message with VCard and Signature!
       
   747 	partList = 0;
       
   748 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   749 
       
   750 	// only body, VCard and Signature
       
   751 	partList = KMsvMessagePartBody;
       
   752 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   753 
       
   754 	// only attachment, VCard and Signature
       
   755 	partList = KMsvMessagePartAttachments;
       
   756 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   757 
       
   758 	// only body, attachment, VCard and Signature
       
   759 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   760 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   761 
       
   762 	// basic new message with subject, VCard and Signature
       
   763 	partList = KMsvMessagePartDescription;
       
   764 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   765 
       
   766 	// only body, subject, VCard and Signature
       
   767 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   768 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   769 
       
   770 	// only attachment, subject, VCard and Signature
       
   771 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   772 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   773 
       
   774 	// only body, attachment, subject, VCard and Signature
       
   775 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   776 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   777 
       
   778 	// basic new message with originator, VCard and Signature
       
   779 	partList = KMsvMessagePartOriginator;
       
   780 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   781 
       
   782 	// only body, originator, VCard and Signature
       
   783 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   784 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   785 
       
   786 	// only attachment, originator, VCard and Signature
       
   787 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   788 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   789 
       
   790 	// only body, attachment, originator, VCard and Signature
       
   791 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   792 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   793 
       
   794 	// basic new message with subject, originator, VCard and Signature
       
   795 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   796 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   797 
       
   798 	// only body, subject, originator, VCard and Signature
       
   799 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   800 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   801 
       
   802 	// only attachment, subject, originator, VCard and Signature
       
   803 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   804 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   805 
       
   806 	// only body, attachment, subject, originator, VCard and Signature
       
   807 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   808 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   809 
       
   810 	// basic new message with recipients, VCard and Signature
       
   811 	partList = KMsvMessagePartRecipient;
       
   812 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   813 
       
   814 	// only body, recipients, VCard and Signature
       
   815 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   816 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   817 
       
   818 	// only attachment, recipients, VCard and Signature
       
   819 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   820 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   821 
       
   822 	// only body, attachment, recipients, VCard and Signature
       
   823 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   824 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   825 
       
   826 	// basic new message with subject, recipients, VCard and Signature
       
   827 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   828 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   829 
       
   830 	// only body, subject, recipients, VCard and Signature
       
   831 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   832 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   833 
       
   834 	// only attachment, subject, recipients, VCard and Signature
       
   835 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   836 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   837 
       
   838 	// only body, attachment, subject, recipients, VCard and Signature
       
   839 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   840 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   841 
       
   842 	// basic new message with originator, recipients, VCard and Signature
       
   843 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   844 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   845 
       
   846 	// only body, originator, recipients, VCard and Signature
       
   847 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   848 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   849 
       
   850 	// only attachment, originator, recipients, VCard and Signature
       
   851 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   852 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   853 
       
   854 	// only body, attachment, originator, recipients, VCard and Signature
       
   855 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   856 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   857 
       
   858 	// basic new message with subject, originator, recipients, VCard and Signature
       
   859 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   860 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   861 
       
   862 	// only body, subject, originator, recipients, VCard and Signature
       
   863 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   864 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   865 
       
   866 	// only attachment, subject, originator, recipients, VCard and Signature
       
   867 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   868 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   869 
       
   870 	// only body, attachment, subject, originator, recipients, VCard and Signature
       
   871 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   872 	CreateReplyL(aMessageId, partList, emailTypeList, testNo++);
       
   873 	}
       
   874 
       
   875 LOCAL_C TBool CompareLogsL()
       
   876 	{
       
   877 	TBool errorOccured = EFalse;
       
   878 
       
   879 	CDesCArray* correctFile = new (ELeave) CDesCArrayFlat(1);
       
   880 	CPtrCArray* resultFile = new (ELeave) CPtrCArray(1);
       
   881 
       
   882 	TParse parsedFileName;
       
   883 	TParse parsedResultFileName;
       
   884 	TFileName name;
       
   885 	name.Append(KOkFileNameEntryStructure);
       
   886 	testUtils->ResolveFile(KComponent, name, parsedFileName);
       
   887 	correctFile->AppendL(parsedFileName.FullName());
       
   888 	name.Zero();
       
   889 	name.Copy(KFileNameEntryStructure);
       
   890 	testUtils->ResolveLogFile(name, parsedResultFileName);
       
   891 	resultFile->AppendL(parsedResultFileName.FullName());
       
   892 
       
   893 	RFileReadStream file1;
       
   894 	RFileReadStream file2;
       
   895 	HBufC8* line1Buffer = HBufC8::NewLC(1024);
       
   896 	TPtr8 line1 = line1Buffer->Des();
       
   897 	TBuf8<1> aChar1;
       
   898 
       
   899 	HBufC8* line2Buffer = HBufC8::NewLC(1024);
       
   900 	TPtr8 line2 = line2Buffer->Des();
       
   901 	TBuf8<1> aChar2;
       
   902 
       
   903 	for(TInt i=0; i<correctFile->MdcaCount(); i++)
       
   904 		{
       
   905 		TFileName file1Name = correctFile->MdcaPoint(i);
       
   906 
       
   907 		TFileName file2Name = resultFile->MdcaPoint(i);
       
   908 
       
   909 		TInt error1=KErrNone;
       
   910 		TInt error2=KErrNone;
       
   911 		
       
   912 		test.Printf(_L("\n%s"), file2Name.PtrZ());
       
   913 
       
   914 		error1=file1.Open(testUtils->FileSession(), file1Name, EFileShareAny);
       
   915 		if(error1!=KErrNone)
       
   916 			{
       
   917 			errorOccured = ETrue;
       
   918 			}
       
   919 		else
       
   920 			{
       
   921 			error2=file2.Open(testUtils->FileSession(), file2Name, EFileShareAny);
       
   922 			if(error2!=KErrNone)
       
   923 				{
       
   924 				errorOccured = ETrue;
       
   925 				}
       
   926 			}
       
   927 		
       
   928 		if((error1==KErrNone)&&(error2==KErrNone))
       
   929 			{
       
   930 			// read the file into the conversion object
       
   931 			TBool finished = EFalse;
       
   932 	
       
   933 			do	{
       
   934 				line1.FillZ();
       
   935 				line1.SetLength(0);
       
   936 				// compile the lines one char at a time
       
   937 				do	{
       
   938 					TRAPD( error, file1.ReadL(aChar1, 1) ); 
       
   939 					if (error!=KErrEof)
       
   940 						line1.Append(aChar1);
       
   941 					else
       
   942 						{
       
   943 						finished = ETrue;
       
   944 						break;
       
   945 						}
       
   946 					// stop at the end of line or no more data
       
   947 					}
       
   948 				while((aChar1[0]!=0x0A)&&(line1.Length()<1024));
       
   949 
       
   950 				line2.FillZ();
       
   951 				line2.SetLength(0);
       
   952 				do	{
       
   953 					TRAPD( error, file2.ReadL(aChar2, 1) ); 
       
   954 					if (error!=KErrEof)
       
   955 						line2.Append(aChar2);
       
   956 					else
       
   957 						{
       
   958 						finished = ETrue;
       
   959 						break;
       
   960 						}
       
   961 					// stop at the end of line or no more data
       
   962 					}
       
   963 				while((aChar2[0]!=0x0A)&&(line2.Length()<1024));
       
   964 
       
   965 				// get rid of white space
       
   966    				line1.TrimRight();
       
   967    				line2.TrimRight();
       
   968    
       
   969    				if(line1.Compare(line2) != 0)
       
   970    					{
       
   971    					// error so no point in continuing to compare!!
       
   972    					errorOccured = ETrue;
       
   973    					file1.Close();
       
   974    					file2.Close();
       
   975    					delete correctFile;
       
   976    					delete resultFile;
       
   977    					CleanupStack::PopAndDestroy(2);  //line 1 , line 2
       
   978    					return ETrue;
       
   979    					}
       
   980 
       
   981 				}
       
   982 			while(!finished);
       
   983 			}		
       
   984 
       
   985 		file1.Close();
       
   986 		file2.Close();
       
   987 		}
       
   988 
       
   989 	delete correctFile;
       
   990 	delete resultFile;
       
   991 	CleanupStack::PopAndDestroy(2);  //line 1 , line 2
       
   992 	
       
   993 	return errorOccured;
       
   994 	}
       
   995 
       
   996 LOCAL_C void doMainL()
       
   997 	{
       
   998 	InitL();
       
   999 	if (testFailed)
       
  1000 		{
       
  1001 		Closedown();
       
  1002 		return;
       
  1003 		}
       
  1004 	testUtils->GoClientSideL();
       
  1005 	smtpService = testUtils->CreateSmtpServiceL();
       
  1006 	pop3Service = testUtils->CreatePopServiceL();
       
  1007 	testUtils->GoServerSideL();
       
  1008 
       
  1009 	testUtils->CreateMessageFilesL(pop3Service, KMsvGlobalInBoxIndexEntryId, _L("c:\\mailtest\\IMCM\\"));
       
  1010 
       
  1011 	test.Console()->SetPos(0, 6);
       
  1012 	test.Printf(_L("Performing Tests:\n"));
       
  1013 	
       
  1014 	testUtils->GoClientSideL();
       
  1015 
       
  1016 	SetDefaultServiceL(smtpService);
       
  1017 
       
  1018 	// get a list of all email messages in the Inbox
       
  1019 	testUtils->iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
       
  1020 	delete messageSelection;
       
  1021 	messageSelection = testUtils->iMsvEntry->ChildrenWithTypeL(KUidMsvMessageEntry);
       
  1022 
       
  1023 	TParse parsedFileName;
       
  1024 	TFileName name(KTestMessageDir);
       
  1025 	testUtils->ResolveLogFile(name, parsedFileName);
       
  1026 
       
  1027 	SetKnownDateAndTime();
       
  1028 
       
  1029 	test.Console()->SetPos(3, 13);
       
  1030 	test.Printf(_L("Create Reply Tests 1:  "));
       
  1031 	//Create reply to html message with attachment and no text alternative to the HTML
       
  1032 	testUtils->WriteComment(_L("Test 1 - Create Reply to HTML message with attachment and no text alt. Tests"));
       
  1033 	TRAPD(ret,DoHtmlCreateReplyTestsL(messageSelection->At(3)));
       
  1034 	if (ret)
       
  1035 		{
       
  1036 		testUtils->TestHarnessFailed(ret);
       
  1037 		delete messageSelection;
       
  1038 		Closedown();
       
  1039 		return;
       
  1040 		}
       
  1041 
       
  1042 	SetKnownDateAndTime();
       
  1043 
       
  1044 	test.Console()->SetPos(3, 14);
       
  1045 	test.Printf(_L("Create Reply Tests 2:  "));
       
  1046 	//Create message with attachment which is not complete
       
  1047 	testUtils->WriteComment(_L("Test 2 - Create Reply to HTML message with incomplete attachment Tests"));
       
  1048 	TMsvId messageWithIncompleteAttachment = CreateNewPlaintextMessageWithIncompleteAttachmentL();
       
  1049 	TRAP(ret,DoHtmlCreateReplyTestsL(messageWithIncompleteAttachment));
       
  1050 	if (ret)
       
  1051 		{
       
  1052 		testUtils->TestHarnessFailed(ret);
       
  1053 		delete messageSelection;
       
  1054 		Closedown();
       
  1055 		return;
       
  1056 		}
       
  1057 
       
  1058 	RestoreDateAndTime();
       
  1059 
       
  1060 	testUtils->FindChildrenL(KMsvGlobalOutBoxIndexEntryId, parsedFileName.FullName(), ETrue, EFalse); // writes message info (from Outbox) into files
       
  1061 
       
  1062 	testUtils->TestFinish(testNo-1);
       
  1063 	testUtils->TestHarnessCompleted();
       
  1064 
       
  1065 	delete messageSelection;
       
  1066 	Closedown();
       
  1067 	
       
  1068 	// shouldn't have to do this, but convertor plugins aren't 
       
  1069 	// doing it yet so we get a false memory leak so remove this
       
  1070 	// when they fix that.
       
  1071 	REComSession::FinalClose();
       
  1072 	}
       
  1073 
       
  1074 GLDEF_C TInt E32Main()
       
  1075 	{	
       
  1076 	__UHEAP_MARK;
       
  1077 	test.Start(_L("T_IMCM02 Test CImEmailOperation class\n"));
       
  1078 	theCleanup=CTrapCleanup::New();
       
  1079 	TRAPD(ret,doMainL());
       
  1080 	test(ret==KErrNone);
       
  1081 	RestoreDateAndTime();
       
  1082 	delete theCleanup;	
       
  1083 	test.End();
       
  1084 	test.Close();
       
  1085 	__UHEAP_MARKEND;
       
  1086 	User::Heap().Check();
       
  1087 	return(KErrNone);
       
  1088 	}