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